mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-31 08:21:54 +08:00
refactor(武器系统): 优化武器攻击逻辑和能量检查
- 将武器攻击前的条件检查提取为独立方法 canAttackBy - 重构能量检查逻辑,增加 isEnergyEnough 方法 - 简化公鸡角色的输入处理,合并重复代码为 tryLaunch 方法 - 调整钢管武器的冷却时间为 3000.0
This commit is contained in:
@@ -292,11 +292,12 @@ func finalEnergy(base: float):
|
||||
return base / fields.get(FieldStore.Entity.SAVE_ENERGY)
|
||||
func fillingProgress(base: float):
|
||||
return energy / finalEnergy(base)
|
||||
func isEnergyEnough(base: float):
|
||||
return energy >= finalEnergy(base)
|
||||
func useEnergy(value: float):
|
||||
value = finalEnergy(value)
|
||||
var state = energy >= value
|
||||
var state = isEnergyEnough(value)
|
||||
if state:
|
||||
energy -= value
|
||||
energy -= finalEnergy(value)
|
||||
energyChanged.emit(energy, false)
|
||||
return state
|
||||
func tryAttack(type: int, needChargeUp: bool = false):
|
||||
|
||||
Reference in New Issue
Block a user