1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +02:00

Fixes for necromancy.

This commit is contained in:
DjWarmonger 2011-06-23 13:50:13 +00:00
parent 5f53531f4b
commit 3f85ca4504

View File

@ -1344,8 +1344,12 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
for (std::map<ui32,si32>::const_iterator it = casualties.begin(); it != casualties.end(); it++)
{
// Get lost enemy hit points convertible to units.
const ui32 raisedHP = VLC->creh->creatures[it->first]->valOfBonuses(Bonus::STACK_HEALTH) * it->second * necromancySkill;
raisedUnits += std::min<ui32>(raisedHP / raisedUnitHP, it->second * necromancySkill); //limit to % of HP and % of original stack count
CCreature * c = VLC->creh->creatures[it->first];
if (!(c->hasBonusOfType(Bonus::UNDEAD) || c->hasBonusOfType(Bonus::NON_LIVING)))
{
const ui32 raisedHP = c->valOfBonuses(Bonus::STACK_HEALTH) * it->second * necromancySkill;
raisedUnits += std::min<ui32>(raisedHP / raisedUnitHP, it->second * necromancySkill); //limit to % of HP and % of original stack count
}
}
// Make room for new units.
@ -1375,7 +1379,7 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
void CGHeroInstance::showNecromancyDialog(const CStackBasicDescriptor &raisedStack) const
{
InfoWindow iw;
iw.soundID = soundBase::treasure; //should be random from among resource sounds
iw.soundID = soundBase::pickup01 + ran() % 7;
iw.player = tempOwner;
iw.components.push_back(Component(raisedStack));