private static void UndoBotMove(Match game, PlayerType playerType, int playerNumber, BotMove move) { var command = move.Command.ToString(); if (move.Command == ShipCommand.BuildShield) { var botShip = game.GetPlayer(playerNumber); if (botShip.Ship == null) { botShip.Lives += Settings.Default.ShieldCost; game.Undo(playerType); game.Depth--; return; } } game.SetPlayerMove(playerNumber, command); game.Undo(playerType); //should use LastCommand or else restore command before game.Depth--; }
private static void UndoAlienLevelTwoMove(Match game, PlayerType playerType, int playerNumber, AlienLevelTwoMove move) { //TODO: level two alien undomove game.Undo(playerType); var alienManager = game.GetPlayer(playerNumber).AlienManager; var shotAlien = FindShotAlien(alienManager, move.ShotAlienId); alienManager.UndoIssueShootOrdersIfPossible(shotAlien); game.Depth--; }