From 5cab8ede902e53aba42e6be46bfc2bd153ef5e5d Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Tue, 28 Feb 2023 09:14:01 +0200 Subject: [PATCH] Fix battle ai trying to act with killed stack --- AI/BattleAI/BattleAI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AI/BattleAI/BattleAI.cpp b/AI/BattleAI/BattleAI.cpp index 888e51842..0b7e41f05 100644 --- a/AI/BattleAI/BattleAI.cpp +++ b/AI/BattleAI/BattleAI.cpp @@ -117,9 +117,9 @@ BattleAction CBattleAI::activeStack( const CStack * stack ) attemptCastingSpell(); - if(auto ret = cb->battleIsFinished()) + if(cb->battleIsFinished() || !stack->alive()) { - //spellcast may finish battle + //spellcast may finish battle or kill active stack //send special preudo-action BattleAction cancel; cancel.actionType = EActionType::CANCEL;