mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	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.
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -62,7 +62,6 @@ class CBattleAI : public CBattleGameInterface | ||||
| 	bool wasWaitingForRealize; | ||||
| 	bool wasUnlockingGs; | ||||
| 	int movesSkippedByDefense; | ||||
| 	bool skipCastUntilNextBattle; | ||||
|  | ||||
| public: | ||||
| 	CBattleAI(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user