1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Removes a removable event if a draw occurs

This commit is contained in:
Opuszek
2025-09-02 16:27:36 +02:00
parent 568fa41d72
commit df8282cb7e
2 changed files with 13 additions and 0 deletions

View File

@@ -294,6 +294,18 @@ void CGEvent::init()
}
}
void CGEvent::battleFinished(IGameEventCallback & gameEvents, const CGHeroInstance *hero, const BattleResult &result) const
{
if(result.winner == BattleSide::ATTACKER)
{
CRewardableObject::onHeroVisit(gameEvents, hero);
}
if(result.winner == BattleSide::NONE && removeAfterVisit) //rewards are lost if therer is a draw and an event is not repeatable
{
gameEvents.removeObject(this, result.attacker);
}
}
void CGEvent::grantRewardWithMessage(IGameEventCallback & gameEvents, const CGHeroInstance * contextHero, int rewardIndex, bool markAsVisit) const
{
CRewardableObject::grantRewardWithMessage(gameEvents, contextHero, rewardIndex, markAsVisit);