package effect import ( "blazing/logic/service/fight/action" "blazing/logic/service/fight/input" "github.com/alpacahq/alpacadecimal" ) // 58. 按一定条件触发魔王的愤怒,触发时,战斗等级提升至一定状态,可以被消强化(SideEffect="33")恢复至正常状态(+6)(a1-a6: atk/def/sp_atk/sp_def/spd/accuracy,-1为不设置) type NewSel58 struct { NewSel0 active bool used bool } func (e *NewSel58) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { if !e.IsOwner() || e.used { return } currentHP := e.Ctx().Our.CurrentPet.GetHP() maxHP := e.Ctx().Our.CurrentPet.GetMaxHP() if maxHP.IntPart() == 0 { return } // 当前仓库里没有更具体的触发参数,采用半血触发作为兜底实现。 if currentHP.Mul(alpacadecimal.NewFromInt(2)).Cmp(maxHP) == 1 { return } e.used = true e.active = true for i, arg := range e.Args() { if arg.IntPart() < 0 { continue } target := int8(arg.IntPart()) if target > e.Ctx().Our.AttackValue.Prop[i] { e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), target-e.Ctx().Our.AttackValue.Prop[i]) } } } func (e *NewSel58) TurnEnd() { if !e.IsOwner() || !e.active { return } hasPositive := false for i, arg := range e.Args() { if arg.IntPart() < 0 { continue } if e.Ctx().Our.AttackValue.Prop[i] > 0 { hasPositive = true break } } if !hasPositive { e.active = false } } func init() { input.InitEffect(input.EffectType.NewSel, 58, &NewSel58{}) }