mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-04 18:57:13 +08:00
fix: 统一子弹伤害属性设置并添加类型检查
修改多个武器和召唤物的攻击逻辑,将直接设置damage属性改为设置baseDamage属性 添加BulletBase类型检查确保安全访问子弹属性 移除Weapon.gd中冗余的鼠标事件连接
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user