feat(fight): 重构战斗模块并添加新功能

- 重构了战斗动作处理逻辑,增加了新的战斗动作类型
- 新增了逃跑、使用药剂、系统放弃等战斗动作
- 优化了战斗回合循环和动作执行顺序
- 增加了战斗结束处理逻辑
- 调整了玩家和AI的战斗行为
-增加精灵捕捉
This commit is contained in:
2025-09-05 22:40:36 +08:00
parent a86b69dd1e
commit 52d35119c8
10 changed files with 386 additions and 126 deletions

View File

@@ -44,6 +44,10 @@ func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundIn
if err1 != nil {
panic(err)
}
if c.FightC != nil {
return nil, -1
}
c.FightC = &service.FightC{}
c.FightC.NewFight(&ttt, c) //把两个玩家都传进去
c.FightC.OwnerID = c.Info.UserID
@@ -72,15 +76,6 @@ func (h Controller) UseSkill(data *fight.UseSkillInboundInfo, c *service.Player)
// 战斗逃跑
func (h Controller) Escape(data *fight.EscapeFightInboundInfo, c *service.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
defer func() {
//战斗结束Escape
ttt := service.NewTomeeHeader(2506, c.Info.UserID)
c.SendPack(ttt.Pack(&fight.FightOverInfo{
Reason: 0,
}))
c.FightC = nil
}()
c.FightC.Escape(c)
return nil, 0
}