Files
bl/logic/service/fight/boss/NewSeIdx_58.go
xinian 9c6f3988de
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构 CurrentPet 为 CurPet
2026-04-04 04:34:43 +08:00

68 lines
1.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.CurPet[0].GetHP()
maxHP := e.Ctx().Our.CurPet[0].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{})
}