Files
bl/logic/service/fight/effect/568.go
xinian 875ad668aa
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 实现战斗效果逻辑和接口重构
2026-03-28 21:57:22 +08:00

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{})
}