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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user