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

62 lines
1.2 KiB
Go

package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// Effect 3: 解除自身的能力下降状态
type Effect3 struct {
node.EffectNode
Reverse bool
Level int8
}
// ----------------------
// 执行时逻辑
// ----------------------
func (e *Effect3) Skill_Use() bool {
for i, v := range e.Ctx().Our.Prop[:] {
if v < 0 {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0)
}
}
return true
}
// Effect 33: 消除对手能力提升状态
type Effect33 struct {
node.EffectNode
Reverse bool
Level int8
}
// ----------------------
// 执行时逻辑
// ----------------------
func (e *Effect33) Skill_Use() bool {
for i, v := range e.Ctx().Opp.Prop[:] {
if v > 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
}
}
return true
}
// ----------------------
// 注册所有效果
// ----------------------
func init() {
// {3, false, 0}, // 解除自身能力下降状态
// {33, true, 0}, // 消除对手能力提升状态{3, false, 0}, // 解除自身能力下降状态
// {33, true, 0}, // 消除对手能力提升状态
input.InitEffect(input.EffectType.Skill, 3, &Effect3{})
input.InitEffect(input.EffectType.Skill, 33, &Effect33{})
}