// Check if one or both armies have been fully destroyed void AnnihilationCheck() { if (HasUnitsLeft() && !Opponent.HasUnitsLeft()) { Server.OnGameEnd(Game, GameOutcomeType.Annihilation, this); } else if (HasUnitsLeft() && !Opponent.HasUnitsLeft()) { Server.OnGameEnd(Game, GameOutcomeType.Annihilation, Opponent); } else { Server.OnGameEnd(Game, GameOutcomeType.MutualAnnihilation); } }
public new void NewTurn() { base.NewTurn(); if (SmallTurnCounter <= 2 * GameConfiguration.TurnLimit) { // The game continues, more turns have to be played ServerClient activeClient, inactiveClient; if (Owner.PlayerState.State == PlayerStateType.MyTurn) { activeClient = Owner; inactiveClient = Opponent; } else { activeClient = Opponent; inactiveClient = Owner; } activeClient.ResetUnits(); inactiveClient.ResetUnits(); var attritionUnits = EvaluateSupply(); activeClient.NewTurn(true, attritionUnits); inactiveClient.NewTurn(false, attritionUnits); StartTurnTimer(); } else { // The maximum number of turns have been played, it's time to evaluate the map control to determine the winner of the game Dictionary <PlayerIdentifier, int> mapControl = Map.GetMapControl(); int captures1 = mapControl[PlayerIdentifier.Player1]; int captures2 = mapControl[PlayerIdentifier.Player2]; if (captures1 > captures2) { Server.OnGameEnd(this, GameOutcomeType.Domination, GetClient(PlayerIdentifier.Player1)); } else if (captures2 > captures1) { Server.OnGameEnd(this, GameOutcomeType.Domination, GetClient(PlayerIdentifier.Player2)); } else { Server.OnGameEnd(this, GameOutcomeType.Draw); } } }