Browse Source

Award 500 experience for towns conquered during a battle.

Krisztián Szabó 2 years ago
parent
commit
b9b51334eb
1 changed files with 5 additions and 0 deletions
  1. 5 0
      server/CGameHandler.cpp

+ 5 - 0
server/CGameHandler.cpp

@@ -589,6 +589,11 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance * heroAttacker, con
 			battleResult.data->exp[0] += 500;
 	}
 
+	// Give 500 exp to winner if a town was conquered during the battle
+	const auto * defendedTown = battleGetDefendedTown();
+	if (defendedTown && battleResult.data->winner == BattleSide::ATTACKER)
+		battleResult.data->exp[BattleSide::ATTACKER] += 500;
+
 	if(heroAttacker)
 		battleResult.data->exp[0] = heroAttacker->calculateXp(battleResult.data->exp[0]);//scholar skill
 	if(heroDefender)