diff --git a/AI/BattleAI/BattleEvaluator.cpp b/AI/BattleAI/BattleEvaluator.cpp index ce70e7bce..d591b8d7d 100644 --- a/AI/BattleAI/BattleEvaluator.cpp +++ b/AI/BattleAI/BattleEvaluator.cpp @@ -731,55 +731,6 @@ bool BattleEvaluator::attemptCastingSpell(const CStack * activeStack) ps.value = scoreEvaluator.evaluateExchange(updatedAttack, cachedAttack.turn, *targets, innerCache, state); } - //! Some units may be dead alltogether. So if they existed before but not now, we know they were killed by the spell - for (const auto& unit : all) - { - if (!unit->isValidTarget()) - continue; - bool isDead = true; - for (const auto& remainingUnit : allUnits) - { - if (remainingUnit->unitId() == unit->unitId()) - isDead = false; - } - if (isDead) - { - auto newHealth = 0; - auto oldHealth = vstd::find_or(healthOfStack, unit->unitId(), 0); - if (oldHealth != newHealth) - { - auto damage = std::abs(oldHealth - newHealth); - auto originalDefender = cb->getBattle(battleID)->battleGetUnitByID(unit->unitId()); - auto dpsReduce = AttackPossibility::calculateDamageReduce( - nullptr, - originalDefender && originalDefender->alive() ? originalDefender : unit, - damage, - innerCache, - state); - auto ourUnit = unit->unitSide() == side ? 1 : -1; - auto goodEffect = newHealth > oldHealth ? 1 : -1; - if (ourUnit * goodEffect == 1) - { - if (ourUnit && goodEffect && (unit->isClone() || unit->isGhost())) - continue; - ps.value += dpsReduce * scoreEvaluator.getPositiveEffectMultiplier(); - } - else - ps.value -= dpsReduce * scoreEvaluator.getNegativeEffectMultiplier(); -#if BATTLE_TRACE_LEVEL >= 1 - logAi->trace( - "Spell %s to %d affects %s (%d), dps: %2f oldHealth: %d newHealth: %d", - ps.spell->getNameTranslated(), - ps.dest.at(0).hexValue.hex, - unit->creatureId().toCreature()->getNameSingularTranslated(), - unit->getCount(), - dpsReduce, - oldHealth, - newHealth); -#endif - } - } - } for(const auto & unit : allUnits) { if(!unit->isValidTarget(true))