fix(fight): 修复战斗中属性变化与暴击判定逻辑

- 调整能力提升计算时机,确保命中后再恢复原始属性
- 暴击判断前置,仅在命中时计算暴击翻倍及破防逻辑
- 优化回合结束效果清除逻辑,增加状态存活判断

refactor(controller): 重构擂台相关接口返回结构体类型

- 将 ARENA_SET_OWENR、ARENA_FIGHT_OWENR 等函数的返回值统一改为
  NullOutboundInfo,并移除冗余字段返回
- 广播逻辑调整,统一使用 Broadcast
This commit is contained in:
2025-11-20 05:57:29 +08:00
parent c0b09c92c4
commit 53d6db7e17
37 changed files with 555 additions and 151 deletions

View File

@@ -17,8 +17,10 @@ func (h Controller) OnPlayerHandleFightInvite(data *fight.HandleFightInviteInbou
return nil, errorcode.ErrorCodes.ErrInBattle
}
c.Fightinfo.PlayerID = data.UserID
c.Fightinfo.PlayerID = c.Info.UserID
c.Fightinfo.Mode = data.Mode
c.Fightinfo.Status = 1
c.Fightinfo.Type = 0
err = c.AgreeBattle(data.UserID, data.Flag, func(p common.PlayerI) bool {
_, err = fight.NewFight(p, c, func(foi *info.FightOverInfo) {
@@ -34,12 +36,14 @@ func (h Controller) OnPlayerInviteOtherFight(data *fight.InviteToFightInboundInf
//进入邀请,以及确认对战模式
if !atomic.CompareAndSwapUint32(&c.Fightinfo.PlayerID, 0, data.UserID) { //邀请前提是自己没邀请别人
return nil, errorcode.ErrorCodes.ErrCannotPerformAction
// if !atomic.CompareAndSwapUint32(&c.Fightinfo.PlayerID, 0, data.UserID) { //邀请前提是自己没邀请别人
// return nil, errorcode.ErrorCodes.ErrCannotPerformAction
}
// }
c.Fightinfo.PlayerID = data.UserID
c.Fightinfo.Mode = data.Mode
c.Fightinfo.Status = 1
c.Fightinfo.Type = 0
c.InvitePlayerToBattle()
return nil, 0
@@ -50,7 +54,7 @@ func (h Controller) OnPlayerCanceledOtherInviteFight(data *fight.InviteFightCanc
if atomic.LoadUint32(&c.Fightinfo.Status) != 0 { //如果没有战斗状态,则不做任何处理
atomic.StoreUint32(&c.Fightinfo.Status, 0) //设置状态为0
return nil, 0
}
//否则报错
return nil, errorcode.ErrorCodes.ErrCannotCancelBattle