feat(fight): 增加战斗模式枚举并重构战斗逻辑判断

- 引入完整的 BattleMode 枚举定义,替代原有的 BattleStatus,明确区分各类战斗场景
- 在多个控制器中替换对旧 Status 字段的依赖,统一使用 Mode 判断战斗状态
- 修复部分函数调用前未检查 FightC 是否为空的问题,增加 ErrBattleEnded 错误返回
- 调整
This commit is contained in:
2025-11-21 02:40:27 +08:00
parent 105c6f5a23
commit e54d4bacaa
18 changed files with 217 additions and 123 deletions

View File

@@ -14,10 +14,10 @@ import (
func (h Controller) PET_MELEE(data *fight.StartPetWarInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
c.Fightinfo.Mode = info.BattleMode.PET_MELEE
c.Fightinfo.Status = info.BattleStatus.FIGHT_WITH_PLAYER
c.Fightinfo.Status = info.BattleMode.PET_MELEE
err = c.JoinFight(func(p common.PlayerI) bool {
fight.NewFight(p, c, func(foi *info.FightOverInfo) {
_, err = fight.NewFight(p, c, func(foi *info.FightOverInfo) {
if foi.Reason == 0 { //我放获胜
if foi.WinnerId == c.GetInfo().UserID {
@@ -29,6 +29,10 @@ func (h Controller) PET_MELEE(data *fight.StartPetWarInboundInfo, c *player.Play
}
}) ///开始对战,房主方以及被邀请方
if err > 0 { //说明有报错
return false
}
return true
})
@@ -37,7 +41,7 @@ func (h Controller) PET_MELEE(data *fight.StartPetWarInboundInfo, c *player.Play
}
func (h Controller) PET_King(data *fight.PetKingJoinInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
c.Fightinfo.Status = info.BattleStatus.FIGHT_WITH_PLAYER
c.Fightinfo.Status = info.BattleMode.PET_TOPLEVEL
switch data.Type {
case 5: