1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Fix bug when no casualties but 1 skeleton is raised

This commit is contained in:
Michał Zaremba
2025-03-17 12:29:12 +01:00
parent d1f1acf76c
commit 63906c4446

View File

@@ -969,11 +969,13 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
const ui8 necromancyLevel = valOfBonuses(BonusType::IMPROVED_NECROMANCY);
vstd::amin(necromancySkill, 1.0); //it's impossible to raise more creatures than all...
const std::map<CreatureID,si32> &casualties = battleResult.casualties[CBattleInfoEssentials::otherSide(battleResult.winner)];
if(casualties.empty())
return CStackBasicDescriptor();
// figure out what to raise - pick strongest creature meeting requirements
CreatureID creatureTypeRaised = CreatureID::NONE; //now we always have IMPROVED_NECROMANCY, no need for hardcode
int requiredCasualtyLevel = 1;
TConstBonusListPtr improvedNecromancy = getBonusesOfType(BonusType::IMPROVED_NECROMANCY);
if(!improvedNecromancy->empty())
if(!improvedNecromancy->empty())
{
int maxCasualtyLevel = 1;
for(const auto & casualty : casualties)