feat(fight): 添加战斗前状态检查与经验获取限制判断

- 在挑战BOSS和野外怪物战斗前,增加 CanFight 状态检查,防止非法战斗
- 修复战斗胜利后经验与物品发放逻辑,增加 CanGetExp 判断避免重复获取
- 优化战斗中精灵切换逻辑与相关伤害效果处理,确保死亡标记正确设置
- 修正战斗轮次中被动切换行为及技能执行顺序问题
- 移除无用的管理员会话控制器和宠物融合模型代码
- 调整战斗输入结构体中的 Switch 类型为 Map 以提高查找效率
- 修复战斗中精灵存活判定条件,
This commit is contained in:
2025-12-01 23:31:48 +08:00
parent 6d54efbbf6
commit aad1e2f44c
21 changed files with 335 additions and 181 deletions

View File

@@ -32,7 +32,7 @@ type FightC struct {
ownerID uint32 // 战斗发起者ID
Our *input.Input //始终等于房主ID
Opp *input.Input //对手ID
Switch []*action.ActiveSwitchAction
Switch map[uint32]*action.ActiveSwitchAction
startl sync.Once
rand *rand.Rand
StartTime time.Time
@@ -227,7 +227,7 @@ func NewFight(p1, p2 common.PlayerI, fn func(*info.FightOverInfo)) (*FightC, err
f := &FightC{}
f.ownerID = p1.GetInfo().UserID
// 1. 构建战斗开始信息(整理双方初始宠物信息)
f.Switch = make(map[uint32]*action.ActiveSwitchAction)
f.callback = fn //战斗结束的回调
f.quit = make(chan struct{})
f.over = make(chan struct{})