1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +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

@ -2535,8 +2535,15 @@ void CBattleInterface::stacksAreAttacked(std::vector<SStackAttackedInfo> attacke
for(int h = 0; h < attackedInfos.size(); ++h)
{
addNewAnim(new CDefenceAnim(attackedInfos[h], this));
if (attackedInfos[h].rebirth)
displayEffect(50, attackedInfos[h].defender->position); //TODO: play reverse death animation
}
waitForAnims();
for(int h = 0; h < attackedInfos.size(); ++h)
{
if (attackedInfos[h].rebirth)
creAnims[attackedInfos[h].defender->ID]->setType(CCreatureAnim::HOLDING);
}
}
void CBattleInterface::stackAttacking( const CStack * attacker, THex dest, const CStack * attacked, bool shooting )

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
}
}
}