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