From f56681d52100c61ce31fb3f4318b4a305bf84b59 Mon Sep 17 00:00:00 2001 From: Xilmi Date: Sun, 8 Dec 2024 21:43:17 +0100 Subject: [PATCH] Removed weird logic that prevented AI from casting spells. What was the rationale? AI loses fights with full Mana that it could easily have won otherwise. I just removed that weird logic and now it uses it's mana and wins. --- AI/BattleAI/BattleAI.cpp | 6 +----- AI/BattleAI/BattleAI.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/AI/BattleAI/BattleAI.cpp b/AI/BattleAI/BattleAI.cpp index b1e5172e0..9b15eafb6 100644 --- a/AI/BattleAI/BattleAI.cpp +++ b/AI/BattleAI/BattleAI.cpp @@ -167,14 +167,12 @@ void CBattleAI::activeStack(const BattleID & battleID, const CStack * stack ) result = evaluator.selectStackAction(stack); - if(autobattlePreferences.enableSpellsUsage && !skipCastUntilNextBattle && evaluator.canCastSpell()) + if(autobattlePreferences.enableSpellsUsage && evaluator.canCastSpell()) { auto spelCasted = evaluator.attemptCastingSpell(stack); if(spelCasted) return; - - skipCastUntilNextBattle = true; } logAi->trace("Spellcast attempt completed in %lld", timeElapsed(start)); @@ -256,8 +254,6 @@ void CBattleAI::battleStart(const BattleID & battleID, const CCreatureSet *army1 { LOG_TRACE(logAi); side = Side; - - skipCastUntilNextBattle = false; } void CBattleAI::print(const std::string &text) const diff --git a/AI/BattleAI/BattleAI.h b/AI/BattleAI/BattleAI.h index f36c2cb26..18df749f0 100644 --- a/AI/BattleAI/BattleAI.h +++ b/AI/BattleAI/BattleAI.h @@ -62,7 +62,6 @@ class CBattleAI : public CBattleGameInterface bool wasWaitingForRealize; bool wasUnlockingGs; int movesSkippedByDefense; - bool skipCastUntilNextBattle; public: CBattleAI();