36 lines
846 B
Go
36 lines
846 B
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/action"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
// Effect 541: 造成的攻击伤害若低于{0}则恢复自身{1}点体力
|
|
type Effect541 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect541) Skill_Use() bool {
|
|
damageThreshold := int(e.Args()[0].IntPart()) // 伤害阈值
|
|
healAmount := int(e.Args()[1].IntPart()) // 恢复体力值
|
|
|
|
// 检查造成的伤害是否低于阈值
|
|
if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(damageThreshold))) < 0 {
|
|
// 恢复指定数值的体力
|
|
e.Ctx().Our.Heal(
|
|
e.Ctx().Our,
|
|
&action.SelectSkillAction{},
|
|
alpacadecimal.NewFromInt(int64(healAmount)),
|
|
)
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 541, &Effect541{})
|
|
}
|