Files
bl/logic/controller/fight_tawor.go
昔念 b8d6772256 ```
feat(fight_tawor): 优化试炼之塔和勇者之塔战斗逻辑

- 修正函数注释格式,使用正确的缩进格式化参数说明
- 移除硬编码的MapID设置,统一在EnterMap/LeaveMap中处理
- 将进入地图逻辑改为离开地图,优化战斗流程
- 简化退出战斗逻辑,移除重复的MapID设置

refactor(config): 重命名塔配置模型和接口前缀

- 将试炼之塔模型TrialTowerConfig重命名为Tower500Config
- 将勇者之塔模型BraveTowerConfig重命名为Tower600Config
- 移除重复的业务操作方法,统一使用基础配置
- 更新Boss控制器接口前缀从/monster/boss到/config/boss

refactor(boss): 移除不必要的导入和扩展结构

- 移除boss_pet.go中的冗余data包导入
- 移除BossConfigEX扩展结构,简化模型
2025-12-26 05:41:51 +08:00

55 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package controller
import (
"blazing/common/socket/errorcode"
"blazing/common/utils"
"blazing/logic/service/fight"
"blazing/logic/service/player"
"blazing/logic/service/space/info"
"sync/atomic"
"github.com/jinzhu/copier"
)
// FreshChoiceFightLevel 处理玩家选择挑战模式(试炼之塔或勇者之塔)
// 根据不同的CMD值设置玩家的挑战状态和地图信息并返回当前挑战层级信息
// 参数:
//
// data: 客户端发送的挑战层级选择请求数据包含CMD和挑战层级
// c: 玩家对象,包含玩家的详细信息
//
// 返回值:
//
// result: 服务器返回给客户端的挑战层级信息包含当前战斗层级和Boss ID
// err: 错误码,表示处理过程中是否出现错误
func (h Controller) FreshChoiceFightLevel(data *fight.C2S_FRESH_CHOICE_FIGHT_LEVEL, c *player.Player) (result *fight.S2C_FreshChoiceLevelRequestInfo, err errorcode.ErrorCode) {
result = &fight.S2C_FreshChoiceLevelRequestInfo{}
switch data.Head.CMD {
case 2428: //试炼之塔
c.Info.CurrentFreshStage = utils.Max(c.Info.CurrentFreshStage, 1)
result.CurFightLevel = uint(c.Info.CurrentFreshStage)
case 2414: //勇者之塔
c.Info.CurrentStage = utils.Max(c.Info.CurrentStage, 1)
result.CurFightLevel = uint(c.Info.CurrentStage)
}
// 设置Boss ID为固定值10
result.BossId = []uint32{10}
// 重置玩家的Canmon标志位为0表示可以刷怪
atomic.StoreUint32(&c.Canmon, 0)
// 在函数结束时将玩家传送到对应地图
defer c.GetSpace().LeaveMap(c)
return result, 0
}
func (h Controller) FreshLeaveFightLevel(data *fight.FRESH_LEAVE_FIGHT_LEVEL, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
defer c.GetSpace().EnterMap(c)
out := info.NewOutInfo()
copier.CopyWithOption(out, c.GetInfo(), copier.Option{DeepCopy: true})
c.SendPackCmd(2001, out)
return result, 0
}