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

Allow different subtypes of SOUL_STEAL work concurrently

This commit is contained in:
dydzio 2017-01-29 14:45:36 +01:00
parent 330c0961b7
commit b5bfb763fd

View File

@ -983,6 +983,7 @@ void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, cons
//soul steal handling
if (att->hasBonusOfType(Bonus::SOUL_STEAL) && def->isLiving())
{
StacksHealedOrResurrected shi;
shi.lifeDrain = true;
shi.tentHealing = false;
@ -990,15 +991,36 @@ void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, cons
shi.canOverheal = true;
shi.drainedFrom = def->ID;
StacksHealedOrResurrected::HealInfo hi;
hi.stackID = att->ID;
hi.healedHP = bsa.killedAmount * att->valOfBonuses(Bonus::SOUL_STEAL) * att->MaxHealth(); //TODO: Should unit be additionally healed after life drain?
hi.lowLevelResurrection = att->hasBonusOfType(Bonus::SOUL_STEAL, 1);
shi.healedStacks.push_back(hi);
if (hi.healedHP > 0)
if (att->hasBonusOfType(Bonus::SOUL_STEAL, 0) && att->hasBonusOfType(Bonus::SOUL_STEAL, 1))
{
bsa.healedStacks.push_back(shi);
StacksHealedOrResurrected::HealInfo hi0;
hi0.stackID = att->ID;
hi0.healedHP = bsa.killedAmount * att->valOfBonuses(Bonus::SOUL_STEAL, 0) * att->MaxHealth();
hi0.lowLevelResurrection = false;
StacksHealedOrResurrected::HealInfo hi1;
hi1.stackID = att->ID;
hi1.healedHP = bsa.killedAmount * att->valOfBonuses(Bonus::SOUL_STEAL, 1) * att->MaxHealth();
hi1.lowLevelResurrection = true;
shi.healedStacks.push_back(hi0);
shi.healedStacks.push_back(hi1);
if (hi0.healedHP > 0 || hi1.healedHP > 0)
bsa.healedStacks.push_back(shi);
}
else
{
StacksHealedOrResurrected::HealInfo hi;
hi.stackID = att->ID;
hi.healedHP = bsa.killedAmount * att->valOfBonuses(Bonus::SOUL_STEAL) * att->MaxHealth(); //TODO: Should unit be additionally healed after life drain?
hi.lowLevelResurrection = att->hasBonusOfType(Bonus::SOUL_STEAL, 1);
shi.healedStacks.push_back(hi);
if (hi.healedHP > 0)
{
bsa.healedStacks.push_back(shi);
}
}
}
bat.bsa.push_back(bsa); //add this stack to the list of victims after drain life has been calculated