54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
// Effect 568: 解除自身能力下降状态,若解除成功则{0}回合内躲避所有攻击
|
|
type Effect568 struct {
|
|
node.EffectNode
|
|
can bool
|
|
}
|
|
|
|
func (e *Effect568) OnSkill() bool {
|
|
|
|
if !e.can {
|
|
rounds := int(e.Args()[0].IntPart()) // 回避攻击的回合数
|
|
// 检查是否有能力下降状态
|
|
hasNegativeStatus := false
|
|
|
|
// 解除能力下降状态
|
|
for i, prop := range e.Ctx().Our.Prop {
|
|
if prop < 0 {
|
|
|
|
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
hasNegativeStatus = true
|
|
}
|
|
}
|
|
}
|
|
|
|
// 如果之前有负面状态且成功解除,则获得回避效果
|
|
if hasNegativeStatus {
|
|
e.Duration(rounds)
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
func (e *Effect568) DamageLockEx(t *info.DamageZone) bool {
|
|
if t.Type != info.DamageType.Red {
|
|
return true
|
|
}
|
|
if !e.can {
|
|
return true
|
|
}
|
|
t.Damage = alpacadecimal.Zero
|
|
return true
|
|
}
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 568, &Effect568{})
|
|
}
|