Files
bl/logic/service/fight/effect/1386.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

67 lines
1.4 KiB
Go

package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// Effect 1386: 当回合击败对手则回合结束时损失{0}层自然祝福
type Effect1386 struct{ node.EffectNode }
func (e *Effect1386) Skill_Use() bool {
if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
return true
}
if e.Ctx().Opp.CurPet[0].Info.Hp > 0 {
return true
}
remove := int(e.Args()[0].IntPart())
if remove <= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1386, remove)
if sub == nil {
return true
}
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
return true
}
type Effect1386Sub struct {
node.EffectNode
remove int
}
func (e *Effect1386Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(1)
e.CanStack(false)
if len(a) > 0 {
e.remove = a[0]
}
}
func (e *Effect1386Sub) TurnEnd() {
removeNaturalBlessingLayers(e.Ctx().Our, e.remove)
e.Alive(false)
}
func removeNaturalBlessingLayers(target *input.Input, amount int) {
if target == nil || amount <= 0 {
return
}
if sub := naturalBlessingEffect(target); sub != nil {
if sub.layers <= amount {
sub.layers = 0
sub.Alive(false)
return
}
sub.layers -= amount
}
}
func init() {
input.InitEffect(input.EffectType.Skill, 1386, &Effect1386{})
input.InitEffect(input.EffectType.Sub, 1386, &Effect1386Sub{})
}