1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Fix handling of upgrades of upgrades for necromancy

Game will now recognize upgrades of upgrades for Necromancy purposes -
if hero has such units in his army, Necromancy can target them with same
2/3 efficiency like direct upgrades
This commit is contained in:
Ivan Savenko
2025-05-27 18:46:11 +03:00
parent f9e88557ca
commit bad46571c0

View File

@@ -1033,11 +1033,11 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
// raise upgraded creature (at 2/3 rate) if no space available otherwise // raise upgraded creature (at 2/3 rate) if no space available otherwise
if(getSlotFor(creatureTypeRaised) == SlotID()) if(getSlotFor(creatureTypeRaised) == SlotID())
{ {
for(const CreatureID & upgraded : creatureTypeRaised.toCreature()->upgrades) for (const auto & slot : Slots())
{ {
if(getSlotFor(upgraded) != SlotID()) if (creatureTypeRaised.toCreature()->isMyDirectOrIndirectUpgrade(slot.second->getCreature()))
{ {
creatureTypeRaised = upgraded; creatureTypeRaised = slot.second->getCreatureID();
necromancySkill *= 2/3.0; necromancySkill *= 2/3.0;
break; break;
} }
@@ -1060,12 +1060,6 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
return CStackBasicDescriptor(); return CStackBasicDescriptor();
} }
/*
int3 CGHeroInstance::getSightCenter() const
{
return getPosition(false);
}*/
int CGHeroInstance::getSightRadius() const int CGHeroInstance::getSightRadius() const
{ {
return valOfBonuses(BonusType::SIGHT_RADIUS); // scouting gives SIGHT_RADIUS bonus return valOfBonuses(BonusType::SIGHT_RADIUS); // scouting gives SIGHT_RADIUS bonus