39 lines
883 B
Go
39 lines
883 B
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
// 522 - n回合内若处于异常状态则受到伤害减少m点
|
|
type Effect522 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect522) DamageSubEx(t *info.DamageZone) bool {
|
|
if e.Ctx().Our.StatEffect_Exist_all() { // 自身处于异常状态
|
|
// 减少受到的伤害m点
|
|
damageReduction := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart()))
|
|
if t.Damage.Cmp(e.Args()[1]) > 0 {
|
|
t.Damage = t.Damage.Sub(damageReduction)
|
|
} else {
|
|
t.Damage = alpacadecimal.Zero
|
|
}
|
|
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
func (e *Effect522) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.EffectNode.Duration(a[0]) // 持续n回合
|
|
}
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 522, &Effect522{})
|
|
|
|
}
|