diff --git a/scripts/Contents/Bullets/SevenSoul.gd b/scripts/Contents/Bullets/SevenSoul.gd index 89deab5..1b240fe 100644 --- a/scripts/Contents/Bullets/SevenSoul.gd +++ b/scripts/Contents/Bullets/SevenSoul.gd @@ -9,6 +9,7 @@ var colors = [ "#FDEB0F" ] var index = 0 +var generationDuration: float = 19500 @onready var heart = $"%heart" @onready var effect: GPUParticles2D = $"%effect" @@ -16,13 +17,14 @@ var index = 0 func spawn(): modulate = Color(colors[index % colors.size()]) effect.emitting = true + launcher.tryHeal(5) func ai(): - rotation_degrees = 360.0 / colors.size() * index + timeLived() / 20000.0 * 360 - index / 6.0 * 360.0 + rotation_degrees = 360.0 / colors.size() * index + timeLived() / generationDuration * 360 - index / 6.0 * 360.0 heart.global_rotation_degrees = 0 PresetBulletAI.lockLauncher(self, launcher, true) func applyDot(): - if timeLived() > 20000 * ((6.0 - index) / 6.0): + if timeLived() > generationDuration * ((6.0 - index) / 6.0): BulletBase.generate(ComponentManager.getBullet("SoulBall"), launcher, heart.global_position, heart.global_position.angle_to_point(get_global_mouse_position())) await TickTool.millseconds(100) return true diff --git a/scripts/Contents/Characters/Rooster.gd b/scripts/Contents/Characters/Rooster.gd index cb84ad9..26cf3a9 100644 --- a/scripts/Contents/Characters/Rooster.gd +++ b/scripts/Contents/Characters/Rooster.gd @@ -27,7 +27,11 @@ func ai(): if Input.is_action_just_pressed("sprint"): trySprint() if Input.is_action_just_pressed("heal"): - tryHeal(20) + if health < fields.get(FieldStore.Entity.MAX_HEALTH): + if useItem({ + ItemStore.ItemType.APPLE: 1 + }): + tryHeal(20) func sprint(): move(Vector2( Input.get_axis("m_left", "m_right"), diff --git a/scripts/Contents/Weapons/SevenSoul.gd b/scripts/Contents/Weapons/SevenSoul.gd index 01bd76f..742ce3d 100644 --- a/scripts/Contents/Weapons/SevenSoul.gd +++ b/scripts/Contents/Weapons/SevenSoul.gd @@ -6,7 +6,7 @@ func attack(entity: EntityBase): for i in 6: for j in BulletBase.generate(ComponentManager.getBullet("SevenSoul"), entity, entity.texture.global_position, 0): j.index = i - await TickTool.millseconds(20000 / 6.0) + await TickTool.millseconds(19500 / 6.0) func update(to, origin, _entity): origin["atk"] += 1 * to * soulLevel return origin diff --git a/scripts/Statemachine/EntityBase.gd b/scripts/Statemachine/EntityBase.gd index 2875cd1..7d8582f 100644 --- a/scripts/Statemachine/EntityBase.gd +++ b/scripts/Statemachine/EntityBase.gd @@ -329,11 +329,9 @@ func tryDie(by: BulletBase = null): died.emit() queue_free() func tryHeal(count: float): - if inventory[ItemStore.ItemType.APPLE] > 0 and health < fields.get(FieldStore.Entity.MAX_HEALTH): - inventory[ItemStore.ItemType.APPLE] -= 1 - playSound("heal") - healed.emit(heal(count * fields.get(FieldStore.Entity.HEAL_ABILITY))) - healthChanged.emit(health) + playSound("heal") + healed.emit(heal(count * fields.get(FieldStore.Entity.HEAL_ABILITY))) + healthChanged.emit(health) func findWeaponAnchor(weaponName: String) -> Vector2: var anchor = $"%weapons".get_node_or_null(weaponName) if anchor is Node2D: