소스 검색

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

DjWarmonger 14 년 전
부모
커밋
036ad1233f
2개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 0
      client/CBattleInterface.cpp
  2. 3 2
      lib/BattleState.cpp

+ 7 - 0
client/CBattleInterface.cpp

@@ -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 )

+ 3 - 2
lib/BattleState.cpp

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