From 15a9e087aaa111f121b8a77400a56fc87c5415ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Fri, 26 Sep 2025 22:22:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(Characters):=20=E4=BF=AE=E5=A4=8D=E6=B2=BB?= =?UTF-8?q?=E7=96=97=E9=80=BB=E8=BE=91=E5=B9=B6=E4=BC=98=E5=8C=96=E4=B8=83?= =?UTF-8?q?=E9=AD=82=E6=AD=A6=E5=99=A8=E8=AE=A1=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构Rooster.gd中的治疗逻辑,现在会检查生命值和物品数量 调整SevenSoul武器的生成间隔从20000ms减少到19500ms 为SevenSoul子弹添加generationDuration变量统一计时逻辑 在子弹生成时添加治疗效果 --- scripts/Contents/Bullets/SevenSoul.gd | 6 ++++-- scripts/Contents/Characters/Rooster.gd | 6 +++++- scripts/Contents/Weapons/SevenSoul.gd | 2 +- scripts/Statemachine/EntityBase.gd | 8 +++----- 4 files changed, 13 insertions(+), 9 deletions(-) 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: