Files
bl/logic/service/fight/battle/node/node.go
昔念 ada45feb01 refactor(fight): 重构效果系统
- 重新定义了基础事件类型和效果触发时机
- 优化了效果的结构和执行逻辑
- 添加了效果生命周期的管理
- 调整了效果注册和触发的方式
2025-08-25 05:28:08 +08:00

41 lines
1.7 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 "github.com/tnnmigga/enum"
// ================= BaseEvent =================
// EnumBaseEvent 定义了战斗中可能触发的基础事件类型。
// 这些事件通常作为 Effect 的触发点,例如攻击前、受到伤害后等。
type EnumBaseEvent string
var BaseEvent = enum.New[struct {
Attack EnumBaseEvent `enum:"attack"` // 攻击事件
Damage EnumBaseEvent `enum:"damage"` // 伤害事件
Heal EnumBaseEvent `enum:"heal"` // 治疗事件
Buff EnumBaseEvent `enum:"buff"` // Buff/状态效果事件
Turn EnumBaseEvent `enum:"turn"` // 回合开始或结束事件
Death EnumBaseEvent `enum:"death"` // 死亡事件
Skill EnumBaseEvent `enum:"skill"` // 技能释放事件
}]()
// ================= HookPhase =================
// EnumHookPhase 定义了事件触发的阶段。
// 在同一个事件中某些效果可能需要在事件发生前Before触发
// 也可能需要在事件发生后After触发。
type EnumHookPhase string
var HookPhase = enum.New[struct {
Before EnumHookPhase `enum:"before"` // 事件发生前触发
After EnumHookPhase `enum:"after"` // 事件发生后触发
}]()
// ================= LifeType =================
// EnumLifeType 定义了效果Effect的生命周期。
// 用来决定效果是持续多个回合、按次数消耗,还是永久存在。
type EnumLifeType string
var LifeType = enum.New[struct {
TurnBased EnumLifeType `enum:"turn_based"` // 按回合数存续如中毒3回合
CountBased EnumLifeType `enum:"count_based"` // 按次数存续如可抵挡2次攻击
Permanent EnumLifeType `enum:"permanent"` // 永久存在(如种族特性/被动)
}]()