fix(fight): 修复技能效果添加逻辑并优化效果管理

- 修改 `AddEffect` 方法,使用 `EffectID` 包装技能效果,并避免重复添加
- 将 `Effects` 类型从 `[]Effect` 改为 `*utils.OrderedMap[int, Effect]` 以提升查找和管理效率
- 移除 `Effect` 接口中的 `ID()` 方法,改由 `EffectID` 结构体维护
- 增加 `GetSkillEffect` 和 `GetDamageEffect` 方法返回带 ID 的效果结构
- 更新 `CancelTurn` 和 `Exec` 方法以适配新的数据结构
- 初始化 `Effects` 为 `OrderedMap` 实例,确保容器正确创建
This commit is contained in:
2025-09-24 19:22:46 +08:00
parent 0a1da7d035
commit 9b078d7820
5 changed files with 269 additions and 51 deletions

View File

@@ -31,11 +31,7 @@ func (this *EffectNode) Alive() bool {
return !this.notAlive
}
func (this *EffectNode) ID() int {
return 0
}
func (this *EffectNode) NotALive() {
this.notAlive = true