Browse Source

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.
Xilmi 1 year ago
parent
commit
f56681d521
2 changed files with 1 additions and 6 deletions
  1. 1 5
      AI/BattleAI/BattleAI.cpp
  2. 0 1
      AI/BattleAI/BattleAI.h

+ 1 - 5
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

+ 0 - 1
AI/BattleAI/BattleAI.h

@@ -62,7 +62,6 @@ class CBattleAI : public CBattleGameInterface
 	bool wasWaitingForRealize;
 	bool wasUnlockingGs;
 	int movesSkippedByDefense;
-	bool skipCastUntilNextBattle;
 
 public:
 	CBattleAI();