private void PerformEndOfGame() { PhaseStarting(this, new PhaseEventArgs { PhaseHeader = ResolutionPhase.FinalRocketMove.GetDescription() }); var rocketFiredLastTurn = SittingDuck.BlueZone.LowerBlueStation.RocketsComponent.RocketFiredLastTurn; if (rocketFiredLastTurn != null) { ResolveDamage(new [] { rocketFiredLastTurn.PerformAttack(null) }, new List <PlayerInterceptorDamage>()); } PhaseStarting(this, new PhaseEventArgs { PhaseHeader = ResolutionPhase.InterceptorsReturnToShip.GetDescription() }); var playersInFarInterceptors = SittingDuck.InterceptorStations .Where(station => station.StationLocation.DistanceFromShip() > 1) .SelectMany(station => station.Players); foreach (var player in playersInFarInterceptors) { player.KnockOut(); } ThreatController.MoveThreats(CurrentTurn); PhaseStarting(this, new PhaseEventArgs { PhaseHeader = ResolutionPhase.JumpToHyperspace.GetDescription() }); ThreatController.OnJumpingToHyperspace(); CalculateScore(); GameStatus = GameStatus.Won; }
public void PerformTurn() { try { if (CurrentTurn == NumberOfTurns + 1) { PerformEndOfGame(); return; } ThreatController.AddNewThreatsToTracks(CurrentTurn); PerformPlayerActions(); var damage = GetStandardDamage(); var interceptorDamage = GetInterceptorDamage(); ResolveDamage(damage, interceptorDamage); ThreatController.MoveThreats(CurrentTurn); PerformEndOfTurn(); if (SittingDuck.WhiteZone.UpperWhiteStation.ComputerComponent.ShouldCheckComputer(CurrentTurn)) { CheckForComputer(); } var isEndOfPhase = phaseEndTurns.Contains(CurrentTurn); if (isEndOfPhase) { PerformEndOfPhase(); } CurrentTurn++; } catch (LoseException loseException) { GameStatus = GameStatus.Lost; KilledBy = loseException.Threat.DisplayName; LostGame(this, EventArgs.Empty); } }