From c74087454a3c3802d2a2fd22c585f5c2ce1737ca 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: Sat, 22 Nov 2025 22:51:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80=E5=AD=90=E5=BC=B9?= =?UTF-8?q?=E4=BC=A4=E5=AE=B3=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE=E5=B9=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=B1=BB=E5=9E=8B=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改多个武器和召唤物的攻击逻辑,将直接设置damage属性改为设置baseDamage属性 添加BulletBase类型检查确保安全访问子弹属性 移除Weapon.gd中冗余的鼠标事件连接 --- scripts/Contents/Bullets/ChainGun.gd | 7 ++++--- scripts/Contents/Summons/HJM.gd | 3 ++- scripts/Contents/Summons/LGBTFlag.gd | 9 +++++---- scripts/Contents/Weapons/ChainGun.gd | 7 ++++--- scripts/Contents/Weapons/Meowmere.gd | 8 +++++--- scripts/Contents/Weapons/PurpleCrystal.gd | 3 ++- scripts/Contents/Weapons/WhiteSoul.gd | 3 ++- scripts/Structs/Weapon.gd | 6 ------ 8 files changed, 24 insertions(+), 22 deletions(-) diff --git a/scripts/Contents/Bullets/ChainGun.gd b/scripts/Contents/Bullets/ChainGun.gd index 3b4b537..c100c19 100644 --- a/scripts/Contents/Bullets/ChainGun.gd +++ b/scripts/Contents/Bullets/ChainGun.gd @@ -8,8 +8,9 @@ var splits: float = 10.0 func spawn(): for j in count: for i in BulletBase.generate(ComponentManager.getBullet("PurpleCrystalSmall"), launcher, anchor.global_position, rotation): - i.damage = baseDamage - var dir = Vector2.from_angle(i.rotation).rotated(deg_to_rad(-90)) - i.global_position += dir * (count - j * 2) * splits / 2 + if i is BulletBase: + var dir = Vector2.from_angle(i.rotation).rotated(deg_to_rad(-90)) + i.baseDamage = baseDamage + i.position += dir * (count - j * 2) * splits / 2 func ai(): PresetBulletAI.lockLauncher(self, launcher, true) diff --git a/scripts/Contents/Summons/HJM.gd b/scripts/Contents/Summons/HJM.gd index 6293d0e..3369af4 100644 --- a/scripts/Contents/Summons/HJM.gd +++ b/scripts/Contents/Summons/HJM.gd @@ -24,4 +24,5 @@ func attack(type): findWeaponAnchor("normal"), 0 ): - bullet.damage = atk + if bullet is BulletBase: + bullet.baseDamage = atk diff --git a/scripts/Contents/Summons/LGBTFlag.gd b/scripts/Contents/Summons/LGBTFlag.gd index 038d238..d3d05e5 100644 --- a/scripts/Contents/Summons/LGBTFlag.gd +++ b/scripts/Contents/Summons/LGBTFlag.gd @@ -23,8 +23,9 @@ func attack(type): findWeaponAnchor("normal"), startAngle + deg_to_rad(i * angle) ): - bullet.tracer = tracer - bullet.damage = atk - bullet.maxTraceTime = maxTraceTime - bullet.tracePower = tracePower + if bullet is LGBTBullet: + bullet.tracer = tracer + bullet.baseDamage = atk + bullet.maxTraceTime = maxTraceTime + bullet.tracePower = tracePower await TickTool.millseconds(50) diff --git a/scripts/Contents/Weapons/ChainGun.gd b/scripts/Contents/Weapons/ChainGun.gd index 7ea29fa..7b702a3 100644 --- a/scripts/Contents/Weapons/ChainGun.gd +++ b/scripts/Contents/Weapons/ChainGun.gd @@ -8,6 +8,7 @@ func update(to, origin, _entity): return origin func attack(entity: EntityBase): for i in BulletBase.generate(ComponentManager.getBullet("ChainGun"), entity, entity.texture.global_position, (get_global_mouse_position() - entity.texture.global_position).angle()): - i.damage = readStore("atk") - i.count = floor(readStore("count")) - i.splits = readStore("split") + if i is BulletBase: + i.baseDamage = readStore("atk") + i.count = floor(readStore("count")) + i.splits = readStore("split") diff --git a/scripts/Contents/Weapons/Meowmere.gd b/scripts/Contents/Weapons/Meowmere.gd index 9281e8f..60d76df 100644 --- a/scripts/Contents/Weapons/Meowmere.gd +++ b/scripts/Contents/Weapons/Meowmere.gd @@ -10,8 +10,10 @@ func update(to, origin, _entity): func attack(entity: EntityBase): var weaponPos = entity.findWeaponAnchor("normal") for i in BulletBase.generate(ComponentManager.getBullet("Meowmere"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position())): - i.damage = readStore("atk") + if i is BulletBase: + i.baseDamage = readStore("atk") for i in readStore("count"): for j in BulletBase.generate(ComponentManager.getBullet("RainbowCat"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position())): - j.damage = readStore("childatk") - j.penerateDamageReduction = readStore("reduce") + if j is BulletBase: + j.baseDamage = readStore("childatk") + j.penerateDamageReduction = readStore("reduce") diff --git a/scripts/Contents/Weapons/PurpleCrystal.gd b/scripts/Contents/Weapons/PurpleCrystal.gd index 2676ab7..a0d88cf 100644 --- a/scripts/Contents/Weapons/PurpleCrystal.gd +++ b/scripts/Contents/Weapons/PurpleCrystal.gd @@ -8,5 +8,6 @@ func update(to: int, origin: Dictionary, _entity: EntityBase): func attack(entity: EntityBase): var weaponPos = entity.findWeaponAnchor("normal") for bullet in BulletBase.generate(ComponentManager.getBullet("PurpleCrystal"), entity, weaponPos, (get_global_mouse_position() - weaponPos).angle()): - bullet.damage = readStore("atk") + if bullet is BulletBase: + bullet.baseDamage = readStore("atk") return true diff --git a/scripts/Contents/Weapons/WhiteSoul.gd b/scripts/Contents/Weapons/WhiteSoul.gd index eccc384..1f1150e 100644 --- a/scripts/Contents/Weapons/WhiteSoul.gd +++ b/scripts/Contents/Weapons/WhiteSoul.gd @@ -13,5 +13,6 @@ func attack(entity: EntityBase): myPos, myPos.angle_to_point(get_global_mouse_position() + MathTool.randv2_range(readStore("radius"))) ): - j.damage = readStore("atk") + if j is BulletBase: + j.baseDamage = readStore("atk") return true diff --git a/scripts/Structs/Weapon.gd b/scripts/Structs/Weapon.gd index f3b30e9..992b308 100644 --- a/scripts/Structs/Weapon.gd +++ b/scripts/Structs/Weapon.gd @@ -40,12 +40,6 @@ func _ready(): cooldownTimer = CooldownTimer.new() cooldownTimer.cooldown = cooldown originalStore = store - updateBtn.mouse_entered.connect(func(): rebuildInfo(true)) - updateBtn.mouse_exited.connect(func(): rebuildInfo()) - extractBtn.mouse_entered.connect(func(): rebuildInfo(true)) - extractBtn.mouse_exited.connect(func(): rebuildInfo()) - inlayBtn.mouse_entered.connect(func(): rebuildInfo(true)) - inlayBtn.mouse_exited.connect(func(): rebuildInfo()) updateBtn.pressed.connect( func(): apply(UIState.player)