mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
fix: 统一子弹伤害属性设置并添加类型检查
修改多个武器和召唤物的攻击逻辑,将直接设置damage属性改为设置baseDamage属性 添加BulletBase类型检查确保安全访问子弹属性 移除Weapon.gd中冗余的鼠标事件连接
This commit is contained in:
@@ -8,8 +8,9 @@ var splits: float = 10.0
|
|||||||
func spawn():
|
func spawn():
|
||||||
for j in count:
|
for j in count:
|
||||||
for i in BulletBase.generate(ComponentManager.getBullet("PurpleCrystalSmall"), launcher, anchor.global_position, rotation):
|
for i in BulletBase.generate(ComponentManager.getBullet("PurpleCrystalSmall"), launcher, anchor.global_position, rotation):
|
||||||
i.damage = baseDamage
|
if i is BulletBase:
|
||||||
var dir = Vector2.from_angle(i.rotation).rotated(deg_to_rad(-90))
|
var dir = Vector2.from_angle(i.rotation).rotated(deg_to_rad(-90))
|
||||||
i.global_position += dir * (count - j * 2) * splits / 2
|
i.baseDamage = baseDamage
|
||||||
|
i.position += dir * (count - j * 2) * splits / 2
|
||||||
func ai():
|
func ai():
|
||||||
PresetBulletAI.lockLauncher(self, launcher, true)
|
PresetBulletAI.lockLauncher(self, launcher, true)
|
||||||
|
|||||||
@@ -24,4 +24,5 @@ func attack(type):
|
|||||||
findWeaponAnchor("normal"),
|
findWeaponAnchor("normal"),
|
||||||
0
|
0
|
||||||
):
|
):
|
||||||
bullet.damage = atk
|
if bullet is BulletBase:
|
||||||
|
bullet.baseDamage = atk
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ func attack(type):
|
|||||||
findWeaponAnchor("normal"),
|
findWeaponAnchor("normal"),
|
||||||
startAngle + deg_to_rad(i * angle)
|
startAngle + deg_to_rad(i * angle)
|
||||||
):
|
):
|
||||||
bullet.tracer = tracer
|
if bullet is LGBTBullet:
|
||||||
bullet.damage = atk
|
bullet.tracer = tracer
|
||||||
bullet.maxTraceTime = maxTraceTime
|
bullet.baseDamage = atk
|
||||||
bullet.tracePower = tracePower
|
bullet.maxTraceTime = maxTraceTime
|
||||||
|
bullet.tracePower = tracePower
|
||||||
await TickTool.millseconds(50)
|
await TickTool.millseconds(50)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ func update(to, origin, _entity):
|
|||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
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()):
|
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")
|
if i is BulletBase:
|
||||||
i.count = floor(readStore("count"))
|
i.baseDamage = readStore("atk")
|
||||||
i.splits = readStore("split")
|
i.count = floor(readStore("count"))
|
||||||
|
i.splits = readStore("split")
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ func update(to, origin, _entity):
|
|||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
for i in BulletBase.generate(ComponentManager.getBullet("Meowmere"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position())):
|
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 i in readStore("count"):
|
||||||
for j in BulletBase.generate(ComponentManager.getBullet("RainbowCat"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position())):
|
for j in BulletBase.generate(ComponentManager.getBullet("RainbowCat"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position())):
|
||||||
j.damage = readStore("childatk")
|
if j is BulletBase:
|
||||||
j.penerateDamageReduction = readStore("reduce")
|
j.baseDamage = readStore("childatk")
|
||||||
|
j.penerateDamageReduction = readStore("reduce")
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
|||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
for bullet in BulletBase.generate(ComponentManager.getBullet("PurpleCrystal"), entity, weaponPos, (get_global_mouse_position() - weaponPos).angle()):
|
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
|
return true
|
||||||
|
|||||||
@@ -13,5 +13,6 @@ func attack(entity: EntityBase):
|
|||||||
myPos,
|
myPos,
|
||||||
myPos.angle_to_point(get_global_mouse_position() + MathTool.randv2_range(readStore("radius")))
|
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
|
return true
|
||||||
|
|||||||
@@ -40,12 +40,6 @@ func _ready():
|
|||||||
cooldownTimer = CooldownTimer.new()
|
cooldownTimer = CooldownTimer.new()
|
||||||
cooldownTimer.cooldown = cooldown
|
cooldownTimer.cooldown = cooldown
|
||||||
originalStore = store
|
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(
|
updateBtn.pressed.connect(
|
||||||
func():
|
func():
|
||||||
apply(UIState.player)
|
apply(UIState.player)
|
||||||
|
|||||||
Reference in New Issue
Block a user