Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
实现1383-1387技能效果,包括自然祝福状态下的属性强化、自然祝福层数管理、护盾效果等
58 lines
1.3 KiB
Go
58 lines
1.3 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
// Effect 1388: 获得{0}点护罩,护罩消失时使对手{1}回合攻击技能无效
|
|
type Effect1388 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1388) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.AddShield(e.Args()[0])
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1388, int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1388Sub struct {
|
|
node.EffectNode
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect1388Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(-1)
|
|
}
|
|
|
|
func (e *Effect1388Sub) ShieldChange(before, after alpacadecimal.Decimal) bool {
|
|
if e.triggered || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if before.Cmp(alpacadecimal.Zero) <= 0 || after.Cmp(alpacadecimal.Zero) > 0 {
|
|
return true
|
|
}
|
|
|
|
e.triggered = true
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1350, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1388, &Effect1388{})
|
|
input.InitEffect(input.EffectType.Sub, 1388, &Effect1388Sub{})
|
|
}
|