public override void SkipButton() { if ((Selection.ThisShip == null) || (Selection.ThisShip.IsAttackPerformed)) { // If no ship is selected or selected ship already performed attack // skip combat for all player's ships with current PS List <GenericShip> shipsToSkipCombat = new List <GenericShip>(); foreach (var shipHolder in Roster.GetPlayer(Phases.CurrentPhasePlayer).Ships) { if (shipHolder.Value.State.Initiative == Phases.CurrentSubPhase.RequiredInitiative) { shipsToSkipCombat.Add(shipHolder.Value); } } SkipCombatByShips(shipsToSkipCombat, Next); } else { // If selected ship can attack - skip attack only for this ship GenericShip skippedShip = Selection.ThisShip; AfterSkippedCombatActivation(skippedShip); skippedShip.CallCombatDeactivation(CheckNext); } }
private void SkipCombatByShips(List <GenericShip> shipsToSkipCombat, Action callback) { if (shipsToSkipCombat != null && shipsToSkipCombat.Count > 0) { GenericShip shipToSkipCombat = shipsToSkipCombat.First(); shipsToSkipCombat.Remove(shipToSkipCombat); if (!shipToSkipCombat.IsAttackPerformed) { shipToSkipCombat.CallCombatActivation( delegate { AfterSkippedCombatActivation(shipToSkipCombat); shipToSkipCombat.CallCombatDeactivation( delegate { SkipCombatByShips(shipsToSkipCombat, callback); } ); }); } else { SkipCombatByShips(shipsToSkipCombat, callback); } } else { callback(); } }
public override void SkipButton() { if ((Selection.ThisShip == null) || (Selection.ThisShip.IsAttackPerformed)) { if (TargetsAreAvailable()) { AskToConfirmSkip(); } else { SkipCombatByShipsWithCurrentInitiative(); } } else { GenericShip skippedShip = Selection.ThisShip; AfterSkippedCombatActivation(skippedShip); skippedShip.CallCombatDeactivation(CheckNext); } }
private static void FinishCombatActivation() { Attacker.CallCombatDeactivation(CleanupAndCheckExtraAttacks); }