diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index d7c37ade..0aea66b4 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -332,7 +332,7 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) { } } - attacker.CanChange = true + //attacker.CanAction = true break } @@ -342,7 +342,7 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) { attacker.CurrentPet.Info.Hp = 1 } - defender.CanChange = true //被打死就可以切精灵了 + //defender.CanAction = true //被打死就可以切精灵了 // AI自动技能 if f.IsWin(attacker, defender.CurrentPet.Info.CatchTime) { //然后检查是否战斗结束 @@ -403,6 +403,6 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) { } f.Broadcast(func(ff *input.Input) { ff.Player.SendPackCmd(2505, &ret) - ff.CanChange = true + ff.CanChange = 0 }) } diff --git a/logic/service/fight/input/input.go b/logic/service/fight/input/input.go index bdf0f050..d194996a 100644 --- a/logic/service/fight/input/input.go +++ b/logic/service/fight/input/input.go @@ -14,7 +14,8 @@ import ( ) type Input struct { - CanChange bool //是否可以死亡切换CanChange + CanChange uint32 //是否可以死亡切换CanChange + // CanAction bool //是否可以行动 CurrentPet *info.BattlePetEntity //当前精灵 AllPet []*info.BattlePetEntity Player common.PlayerI diff --git a/logic/service/fight/loop.go b/logic/service/fight/loop.go index 8f74e7ee..970318a6 100644 --- a/logic/service/fight/loop.go +++ b/logic/service/fight/loop.go @@ -139,11 +139,18 @@ func (f *FightC) collectPlayerActions(ourID, oppID uint32) map[uint32]action.Bat // fmt.Printf("玩家%d 已经提交过动作,忽略重复\n", pid) // continue // } - + selfinput := f.GetInputByAction(paction, false) if ret, ok := paction.(*action.ActiveSwitchAction); ok { - selfinput := f.GetInputByAction(paction, false) - if selfinput.CanChange { - selfinput.CanChange = false + + if selfinput.CanChange == 0 { + if selfinput.CurrentPet.Info.Hp > 0 { //非死亡切换 + selfinput.CanChange = 1 + } else { + + selfinput.CanChange = 2 + + } + InitAttackValue := *selfinput.AttackValue oldpet := selfinput.CurrentPet f.Switch[selfinput.UserID] = ret @@ -162,6 +169,15 @@ func (f *FightC) collectPlayerActions(ourID, oppID uint32) map[uint32]action.Bat }) } + } else { + + if selfinput.CurrentPet.Info.Hp <= 0 { //0血执行非切换动作 + //todo 记录异常操作 + continue + } + if selfinput.CanChange == 1 { //非被动死亡情况下,不能执行额外动作,0允许切,2是死亡,可以额外动作 + continue + } } // AI自动技能 if pid != 0 && (f.Info.Status == info.BattleMode.FIGHT_WITH_NPC) {