Files
bl/logic/service/fight/battle/node/node.go
昔念 5c8f5195cf feat(battle): 添加新的印记处理逻辑
- 在 NodeManager 中增加了 OnBeforeAddMark 和 OnAnyMarkAdded 的执行顺序
- 在 Effect 接口中添加了 OnBeforeAddMark 和 OnAnyMarkAdded 两个
2025-08-26 19:52:21 +08:00

97 lines
2.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package node
import "context"
type Effect interface {
OnBattleStart() bool
OnBattleEnd() bool
BeforeEffect() bool
AfterEffect() bool
OnSwitch() bool
OnTurnStart() bool
ID() int
Stack(int) int
MaxStack() int
OnBeforeAddMark() bool
OnAnyMarkAdded() bool
Duration(int) int
}
///基础节点
type Node struct {
//Turn int // 当前回合数 ,回合数其实从战斗的上下文中获取
//本质上ctx还要传入战斗双方数据来判断是否是本精灵切换
ctx context.Context //节点上下文
duration int // 持续回合/次0 = 即时生效,>0 = 回合数 ,负数是永久)
stacks int // 当前层数
maxStack int // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果
//LifeType EnumLifeType //回合效果 是否可持续 继承到下一直精灵 ,这个用重写事件来实现
// Parent string // 上下文来源(比如 "Skill"、"Buff"、"Passive"
// Trigger node.EnumEffectTrigger // 当前触发的节点
// Container *EffectContainer // 效果容器(通常挂在 Actor 身上)
// Effect *Effect // 当前正在执行的 Effect
// Available bool // 是否可用
// Success bool // 是否执行成功
// Done bool // 是否中止后续执行
}
func (this *Node) ID() int {
return 0
}
func (this *Node) Stacks(t int) int {
if t != 0 {
this.stacks = t
}
return this.stacks
}
func (this *Node) MaxStacks() int {
return this.maxStack
}
func (this *Node) Duration(t int) int {
return this.duration
}
//返回false阻止继续运行
//回合开始
func (this *Node) OnBattleStart() bool {
return true
}
//回合结束
func (this *Node) OnBattleEnd() bool {
return true
}
//技能效果前
func (this *Node) BeforeEffect() bool {
return true
}
//技能效果前
func (this *Node) AfterEffect() bool {
return true
}
//精灵切换时
func (this *Node) OnSwitch() bool {
return true
}