fix(fight): 修复技能命中和伤害计算逻辑错误

- 修正 `Effect7` 中敌我双方血量判断逻辑,确保技能命中率和伤害值正确计算
- 调整 `FightC` 中技能攻击流程,统一使用 `Exec` 替代 `ExecCace` 执行效果
- 移除重复的 `AddEffects` 方法,简化效果添加逻辑
- 注释暂未使用的逻辑,避免无效调用影响战斗流程
- 增加战斗超时保护机制,防止协程泄漏
- 优化玩家离线保存逻辑
This commit is contained in:
2025-11-12 21:44:56 +08:00
parent 0b5cfac0b2
commit 0d61134dd8
6 changed files with 31 additions and 41 deletions

View File

@@ -333,7 +333,13 @@ func (p *Player) Save() {
p.FightC.Over(p, info.BattleOverReason.PlayerOffline) //玩家逃跑,但是不能锁线程
}()
//<-ov
<-p.FightC.GetOverChan() //等待结束
select {
case <-p.FightC.GetOverChan(): //等待结束
case <-time.After(time.Second * 5): //等待5秒
cool.Loger.Error(context.TODO(), "战斗崩溃", p.Info.UserID)
}
}
p.Info.TimeToday = p.Info.TimeToday + uint32(time.Now().Unix()) - uint32(p.Onlinetime) //保存电池时间