refactor(fight): 重构战斗逻辑

- 新增 AI_player 结构体和相关方法,用于创建和管理 AI 玩家
- 重构 FightC 结构体,增加 Input 结构体用于封装玩家输入
- 优化战斗流程,包括回合处理、技能使用、伤害计算等
- 改进广播机制,使用函数回调替代直接调用方法
- 优化玩家和 AI 的动作处理逻辑
This commit is contained in:
2025-09-08 01:23:12 +08:00
parent e111e08638
commit 7ef001f1b9
8 changed files with 408 additions and 317 deletions

View File

@@ -51,8 +51,9 @@ func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundIn
if c.FightC != nil {
return nil, errorcode.ErrorCodes.ErrOnlineOver6HoursCannotFight
}
c.FightC = &service.FightC{}
c.FightC.NewFight(&ttt, c, mo) //把两个玩家都传进去
ai := service.NewAI_player(*mo)
service.NewFight(ttt, c, ai)
c.FightC.OwnerID = c.Info.UserID
return nil, -1