1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +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:
Xilmi 2024-12-08 21:43:17 +01:00
parent 7a5c311d64
commit f56681d521
2 changed files with 1 additions and 6 deletions

View File

@ -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

View File

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