refactor(fight): 重构战斗逻辑
- 新增 AI_player 结构体和相关方法,用于创建和管理 AI 玩家 - 重构 FightC 结构体,增加 Input 结构体用于封装玩家输入 - 优化战斗流程,包括回合处理、技能使用、伤害计算等 - 改进广播机制,使用函数回调替代直接调用方法 - 优化玩家和 AI 的动作处理逻辑
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user