1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

fixes for Phoenix. Its animation will now be restored to Alive.

This commit is contained in:
DjWarmonger
2011-07-10 08:22:20 +00:00
parent 9c3a10b2c7
commit 036ad1233f
2 changed files with 10 additions and 2 deletions

View File

@ -2501,15 +2501,16 @@ void CStack::prepareAttacked(BattleStackAttacked &bsa) const
{
int resurrectedCount = base->count * resurrectFactor / 100;
if (resurrectedCount)
resurrectedCount += ((base->count % resurrectedCount) * resurrectFactor / 100.0f) > ran()%100 ? 1 : 0; //last stack has proportional chance to rebirth
resurrectedCount += ((base->count * resurrectFactor / 100.0f - resurrectedCount) > ran()%100 / 100.0f) ? 1 : 0; //last stack has proportional chance to rebirth
else //only one unit
resurrectedCount += (base->count * resurrectFactor / 100.0f) > ran()%100 ? 1 : 0;
resurrectedCount += ((base->count * resurrectFactor / 100.0f) > ran()%100 / 100.0f) ? 1 : 0;
if (hasBonusOfType(Bonus::REBIRTH, 1))
amax (resurrectedCount, 1); //resurrect at least one Sacred Phoenix
if (resurrectedCount)
{
bsa.flags |= BattleStackAttacked::REBIRTH;
bsa.newAmount = resurrectedCount; //risky?
bsa.newHP = MaxHealth(); //resore full health
}
}
}