mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
add val; stat at end turn; events
This commit is contained in:
@@ -487,6 +487,16 @@ void BattleResultProcessor::endBattleConfirm(const CBattleInfoCallback & battle)
|
||||
// Remove beaten hero
|
||||
if(finishingBattle->loserHero)
|
||||
{
|
||||
if(!finishingBattle->isDraw())
|
||||
{
|
||||
ConstTransitivePtr<CGHeroInstance> strongestHero = nullptr;
|
||||
for(auto & hero : gameHandler->gameState()->getPlayerState(finishingBattle->loser)->heroes)
|
||||
if(!strongestHero || hero->exp > strongestHero->exp)
|
||||
strongestHero = hero;
|
||||
if(strongestHero->id == finishingBattle->loserHero->id)
|
||||
gameHandler->gameState()->statistic.accumulatedValues[finishingBattle->victor].lastDefeatedStrongestHeroDay = gameHandler->gameState()->getDate(Date::DAY);
|
||||
}
|
||||
|
||||
RemoveObject ro(finishingBattle->loserHero->id, finishingBattle->victor);
|
||||
gameHandler->sendAndApply(&ro);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user