refactor(fight): 统一战斗系统方法命名规范并优化逻辑 - 将所有下划线命名的方法统一为驼峰命名,如 Turn_Start 改为 TurnStart, Action_end_ex 改为 ActionEndEx,Turn_End 改为 TurnEnd - 新增 IsOwner() 方法用于判断当前精灵是否为场上的当前宠物 - 将硬编码的 CatchTime 比较逻辑替换为 IsOwner() 方法调用 - 在 NewSel408 中实现消除对手能力强化效果的具体逻辑 - 修复 effect_74 中衰弱状态的数值引用,使用枚举类型代替硬编码 - 优化 input/fight.go 中的技能选择逻辑,使用伤害值比较代替权重比较 - 移除 shiny.go 中未使用的 utils 导入和相关逻辑 - 修正 NewSel77 从 Turn_End 重命名为 TurnStart 的方法 - 在 input/fight.go 中添加 Damage 方法的注释说明 ```
45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/action"
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
)
|
||
|
||
// 16. hp 与 battle_lv 的某一种绑定, 自身体力每减少1/8, 则该battle_lv上升1个等级, 最高到12;(a1: which blv)
|
||
// TODO: 实现hp 与 battle_lv 的某一种绑定, 自身体力每减少1/8, 则该battle_lv上升1个等级, 最高到12;(a1: which blv)的核心逻辑
|
||
type NewSel16 struct {
|
||
NewSel0
|
||
curhp alpacadecimal.Decimal
|
||
}
|
||
|
||
func (e *NewSel16) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
|
||
|
||
// fmt.Println(e.ID().GetCatchTime(), e.Ctx().Our.CurrentPet.Info.CatchTime)
|
||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||
return
|
||
}
|
||
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
if e.curhp.IntPart() == 0 {
|
||
e.curhp = maxHP
|
||
|
||
}
|
||
|
||
//如果当前被扣除的血量少于当前血,说明我方回血
|
||
if e.curhp.Cmp(e.Ctx().Our.CurrentPet.GetHP()) == -1 {
|
||
e.curhp = e.Ctx().Our.CurrentPet.GetHP()
|
||
return
|
||
}
|
||
if e.curhp.Sub(e.Ctx().Our.CurrentPet.GetHP()).Cmp(maxHP.Div(alpacadecimal.NewFromInt(8))) == 1 {
|
||
e.curhp = e.Ctx().Our.CurrentPet.GetHP()
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1, info.AbilityOpType.ADD)
|
||
}
|
||
|
||
return
|
||
}
|
||
func init() {
|
||
input.InitEffect(input.EffectType.NewSel, 16, &NewSel16{})
|
||
}
|