1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00

Don't cast spells with below 0 score.

The AI will no longer cast spells if the best spell's value is still below 0.
This commit is contained in:
Xilmi 2024-08-24 17:15:15 +02:00
parent b92862c04d
commit 69dc32a128

View File

@ -790,7 +790,7 @@ bool BattleEvaluator::attemptCastingSpell(const CStack * activeStack)
};
auto castToPerform = *vstd::maxElementByFun(possibleCasts, pscValue);
if(castToPerform.value > cachedScore)
if(castToPerform.value > cachedScore && castToPerform.value > 0)
{
LOGFL("Best spell is %s (value %d). Will cast.", castToPerform.spell->getNameTranslated() % castToPerform.value);
BattleAction spellcast;