diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index 30262797d8a..c4015dd9b95 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -603,7 +603,7 @@ public class HumanPlayer extends PlayerImpl { passedUntilStackResolved = false; } } - while (isInGame()) { + while (canRespond()) { updateGameStatePriority("priority", game); game.firePriorityEvent(playerId); waitForResponse(game); @@ -697,7 +697,7 @@ public class HumanPlayer extends PlayerImpl { } game.firePlayManaEvent(playerId, "Pay " + promptText, options); waitForResponse(game); - if (!this.isInGame()) { + if (!this.canRespond()) { return false; } if (response.getBoolean() != null) { @@ -1028,7 +1028,7 @@ public class HumanPlayer extends PlayerImpl { public void assignDamage(int damage, List targets, String singleTargetName, UUID sourceId, Game game) { updateGameStatePriority("assignDamage", game); int remainingDamage = damage; - while (remainingDamage > 0 && isInGame()) { + while (remainingDamage > 0 && canRespond()) { Target target = new TargetCreatureOrPlayer(); if (singleTargetName != null) { target.setTargetName(singleTargetName); @@ -1208,7 +1208,7 @@ public class HumanPlayer extends PlayerImpl { if (!source.getAbilityType().equals(AbilityType.TRIGGERED)) { done = true; } - if (!isInGame()) { + if (!canRespond()) { return null; } } diff --git a/Mage.Server/src/main/java/mage/server/game/GameController.java b/Mage.Server/src/main/java/mage/server/game/GameController.java index ba324a5545b..49f8ae0e28b 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameController.java +++ b/Mage.Server/src/main/java/mage/server/game/GameController.java @@ -487,13 +487,21 @@ public class GameController implements GameCallback { if (data instanceof Integer) { turnsToRollback = (Integer) data; if (game.canRollbackTurns(turnsToRollback)) { - requestsOpen = requestPermissionToRollback(userId, turnsToRollback); - if (requestsOpen == 0) { - game.rollbackTurns(turnsToRollback); - turnsToRollback = -1; - requestsOpen = -1; + UUID playerId = getPlayerId(userId); + if (game.getPriorityPlayerId().equals(playerId)) { + requestsOpen = requestPermissionToRollback(userId, turnsToRollback); + if (requestsOpen == 0) { + game.rollbackTurns(turnsToRollback); + turnsToRollback = -1; + requestsOpen = -1; + } else { + userReqestingRollback = userId; + } } else { - userReqestingRollback = userId; + Player player = game.getPlayer(playerId); + if (player != null) { + game.informPlayer(player, "You can only request a rollback if you have priority."); + } } } else { UUID playerId = getPlayerId(userId); diff --git a/Mage.Sets/src/mage/sets/alarareborn/DefilerOfSouls.java b/Mage.Sets/src/mage/sets/alarareborn/DefilerOfSouls.java index 8a6afe04c35..a7069ec7258 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/DefilerOfSouls.java +++ b/Mage.Sets/src/mage/sets/alarareborn/DefilerOfSouls.java @@ -108,7 +108,7 @@ class DefilerOfSoulsEffect extends OneShotEffect { //had, if thats the case this ability should fizzle. if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) { boolean abilityApplied = false; - while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) { + while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } diff --git a/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java b/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java index 61b2394f775..b8d83c987f6 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java +++ b/Mage.Sets/src/mage/sets/alarareborn/SagesOfTheAnima.java @@ -120,7 +120,7 @@ class SagesOfTheAnimaReplacementEffect extends ReplacementEffectImpl { } } TargetCard target = new TargetCard(Zone.PICK, new FilterCard()); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/BrunaLightOfAlabaster.java b/Mage.Sets/src/mage/sets/avacynrestored/BrunaLightOfAlabaster.java index 50c4d359344..574072de20b 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/BrunaLightOfAlabaster.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/BrunaLightOfAlabaster.java @@ -122,7 +122,7 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect { return false; } - while (player.isInGame() && player.chooseUse(Outcome.Benefit, "Attach an Aura from the battlefield?", source, game)) { + while (player.canRespond() && player.chooseUse(Outcome.Benefit, "Attach an Aura from the battlefield?", source, game)) { Target targetAura = new TargetPermanent(filterAura); if (player.choose(Outcome.Benefit, targetAura, source.getSourceId(), game)) { Permanent aura = game.getPermanent(targetAura.getFirstTarget()); @@ -137,7 +137,7 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect { } int count = player.getHand().count(filterAuraCard, game); - while (player.isInGame() && count > 0 && player.chooseUse(Outcome.Benefit, "Attach an Aura from your hand?", source, game)) { + while (player.canRespond() && count > 0 && player.chooseUse(Outcome.Benefit, "Attach an Aura from your hand?", source, game)) { TargetCard targetAura = new TargetCard(Zone.PICK, filterAuraCard); if (player.choose(Outcome.Benefit, player.getHand(), targetAura, game)) { Card aura = game.getCard(targetAura.getFirstTarget()); @@ -151,7 +151,7 @@ class BrunaLightOfAlabasterEffect extends OneShotEffect { } count = player.getGraveyard().count(filterAuraCard, game); - while (player.isInGame() && count > 0 && player.chooseUse(Outcome.Benefit, "Attach an Aura from your graveyard?", source, game)) { + while (player.canRespond() && count > 0 && player.chooseUse(Outcome.Benefit, "Attach an Aura from your graveyard?", source, game)) { TargetCard targetAura = new TargetCard(Zone.PICK, filterAuraCard); if (player.choose(Outcome.Benefit, player.getGraveyard(), targetAura, game)) { Card aura = game.getCard(targetAura.getFirstTarget()); diff --git a/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java b/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java index bb147a16330..00e88453cb5 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java @@ -115,7 +115,7 @@ class CavernOfSoulsEffect extends OneShotEffect { typeChoice.setMessage("Choose creature type"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.Benefit, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java b/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java index cea5bb7a325..25472b037ab 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java @@ -126,7 +126,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { do { selectCards(currentPlayer, selectedObjects, count, source, game); currentPlayer = playerList.getNextInRange(controller, game); - } while (!currentPlayer.equals(controller) && controller.isInGame()); + } while (!currentPlayer.equals(controller) && controller.canRespond()); // move permanents and hand cards to exile for (UUID objectId : selectedObjects) { @@ -159,7 +159,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { int amount = Math.min(count, player.getHand().size() + game.getBattlefield().getAllActivePermanents(player.getId()).size()); int cardsFromHand = 0; - while (player.isInGame() && amount > 0) { + while (player.canRespond() && amount > 0) { Target target; do { @@ -185,7 +185,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { } } } - } while (amount > 0 && !target.getTargets().isEmpty() && player.isInGame()); + } while (amount > 0 && !target.getTargets().isEmpty() && player.canRespond()); if (amount > 0) { TargetCard targetInHand; do { @@ -207,7 +207,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { cardsFromHand++; } } - } while (amount > 0 && !targetInHand.getTargets().isEmpty() && player.isInGame()); + } while (amount > 0 && !targetInHand.getTargets().isEmpty() && player.canRespond()); } } diff --git a/Mage.Sets/src/mage/sets/avacynrestored/LairDelve.java b/Mage.Sets/src/mage/sets/avacynrestored/LairDelve.java index 2e77a4522c9..0021f383139 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/LairDelve.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/LairDelve.java @@ -107,7 +107,7 @@ class LairDelveEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/PrimalSurge.java b/Mage.Sets/src/mage/sets/avacynrestored/PrimalSurge.java index 7dd2e0918d0..524cd8689c6 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/PrimalSurge.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/PrimalSurge.java @@ -113,7 +113,7 @@ class PrimalSurgeEffect extends OneShotEffect { } } } - } while (player.isInGame() && repeat); + } while (player.canRespond() && repeat); return true; } diff --git a/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java b/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java index 724543db09b..8a0ead3bfc9 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/RidersOfGavony.java @@ -102,7 +102,7 @@ class RidersOfGavonyEffect extends OneShotEffect { typeChoice.setMessage("Choose creature type"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/avacynrestored/RiteOfRuin.java b/Mage.Sets/src/mage/sets/avacynrestored/RiteOfRuin.java index 093d3868344..7a2a69f37aa 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/RiteOfRuin.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/RiteOfRuin.java @@ -100,7 +100,7 @@ class RiteOfRuinEffect extends OneShotEffect { LinkedList order = new LinkedList<>(); ChoiceImpl choice = new ChoiceImpl(true); choice.setChoices(choices); - while (controller.isInGame() && controller.choose(Outcome.Sacrifice, choice, game) && choices.size() > 1) { + while (controller.canRespond() && controller.choose(Outcome.Sacrifice, choice, game) && choices.size() > 1) { order.add(getCardType(choice.getChoice())); choices.remove(choice.getChoice()); choice.clearChoice(); diff --git a/Mage.Sets/src/mage/sets/bornofthegods/OracleOfBones.java b/Mage.Sets/src/mage/sets/bornofthegods/OracleOfBones.java index 15fa1489e8a..493f7cc1925 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/OracleOfBones.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/OracleOfBones.java @@ -111,7 +111,7 @@ class OracleOfBonesCastEffect extends OneShotEffect { controller.chooseUse(outcome, "Cast an instant or sorcery card from your hand without paying its mana cost?", source, game)) { Card cardToCast = null; boolean cancel = false; - while (controller.isInGame() && !cancel) { + while (controller.canRespond() && !cancel) { if (controller.chooseTarget(outcome, target, source, game)) { cardToCast = game.getCard(target.getFirstTarget()); if (cardToCast != null && cardToCast.getSpellAbility().canChooseTarget(game)) { diff --git a/Mage.Sets/src/mage/sets/bornofthegods/WhimsOfTheFates.java b/Mage.Sets/src/mage/sets/bornofthegods/WhimsOfTheFates.java index 0ed12b22c02..448bfea2e8c 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/WhimsOfTheFates.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/WhimsOfTheFates.java @@ -101,14 +101,14 @@ class WhimsOfTheFateEffect extends OneShotEffect { Map>> playerPermanents = new LinkedHashMap<>(); PlayerList playerList = game.getState().getPlayerList().copy(); - while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) { + while (!playerList.get().equals(source.getControllerId()) && controller.canRespond()) { playerList.getNext(); } Player currentPlayer = game.getPlayer(playerList.get()); Player nextPlayer; UUID firstNextPlayer = null; - while (!getNextPlayerInDirection(true, playerList, game).equals(firstNextPlayer) && controller.isInGame()) { + while (!getNextPlayerInDirection(true, playerList, game).equals(firstNextPlayer) && controller.canRespond()) { nextPlayer = game.getPlayer(playerList.get()); if (nextPlayer == null) { return false; @@ -116,7 +116,7 @@ class WhimsOfTheFateEffect extends OneShotEffect { if (firstNextPlayer == null) { firstNextPlayer = nextPlayer.getId(); } - if (!nextPlayer.isInGame()) { + if (!nextPlayer.canRespond()) { continue; } // if player is in range of controller he chooses 3 piles with all its permanents diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/CranialExtraction.java b/Mage.Sets/src/mage/sets/championsofkamigawa/CranialExtraction.java index e9fa3622af6..948126caae7 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/CranialExtraction.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/CranialExtraction.java @@ -96,7 +96,7 @@ class CranialExtractionEffect extends OneShotEffect { cardChoice.clearChoice(); while (!controller.choose(Outcome.Exile, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/Mindblaze.java b/Mage.Sets/src/mage/sets/championsofkamigawa/Mindblaze.java index 0c0943c2575..00550c441b6 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/Mindblaze.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/Mindblaze.java @@ -106,13 +106,13 @@ class MindblazeEffect extends OneShotEffect { numberChoice.setChoices(numbers); while (!playerControls.choose(Outcome.Neutral, cardChoice, game)) { - if (!playerControls.isInGame()) { + if (!playerControls.canRespond()) { return false; } } while (!playerControls.choose(Outcome.Neutral, numberChoice, game)) { - if (!playerControls.isInGame()) { + if (!playerControls.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/coldsnap/BlizzardSpecter.java b/Mage.Sets/src/mage/sets/coldsnap/BlizzardSpecter.java index b451efa5ee1..e9e77e9fbdf 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/BlizzardSpecter.java +++ b/Mage.Sets/src/mage/sets/coldsnap/BlizzardSpecter.java @@ -112,7 +112,7 @@ class ReturnToHandEffect extends OneShotEffect { Target target = new TargetControlledPermanent(1, 1, new FilterControlledPermanent(), true); if (target.canChoose(player.getId(), game)) { - while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) { + while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.ReturnToHand, target, source, game); } diff --git a/Mage.Sets/src/mage/sets/commander/AllianceOfArms.java b/Mage.Sets/src/mage/sets/commander/AllianceOfArms.java index 3ec3e4b7ee6..a9a20017a44 100644 --- a/Mage.Sets/src/mage/sets/commander/AllianceOfArms.java +++ b/Mage.Sets/src/mage/sets/commander/AllianceOfArms.java @@ -117,7 +117,7 @@ class AllianceOfArmsEffect extends OneShotEffect { protected static int playerPaysXGenericMana(Player player, Ability source, Game game) { int xValue = 0; boolean payed = false; - while (player.isInGame() && !payed) { + while (player.canRespond() && !payed) { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); diff --git a/Mage.Sets/src/mage/sets/commander/CollectiveVoyage.java b/Mage.Sets/src/mage/sets/commander/CollectiveVoyage.java index 3c5d7f16a40..4c90f57ebc3 100644 --- a/Mage.Sets/src/mage/sets/commander/CollectiveVoyage.java +++ b/Mage.Sets/src/mage/sets/commander/CollectiveVoyage.java @@ -126,7 +126,7 @@ class CollectiveVoyageEffect extends OneShotEffect { protected static int playerPaysXGenericMana(Player player, Ability source, Game game) { int xValue = 0; boolean payed = false; - while (player.isInGame() && !payed) { + while (player.canRespond() && !payed) { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); diff --git a/Mage.Sets/src/mage/sets/commander/ManaChargedDragon.java b/Mage.Sets/src/mage/sets/commander/ManaChargedDragon.java index 116b0b82e47..e12f2e8cbc0 100644 --- a/Mage.Sets/src/mage/sets/commander/ManaChargedDragon.java +++ b/Mage.Sets/src/mage/sets/commander/ManaChargedDragon.java @@ -96,7 +96,7 @@ class ManaChargedDragonEffect extends OneShotEffect { protected static int playerPaysXGenericMana(Player player, Ability source, Game game) { int xValue = 0; boolean payed = false; - while (player.isInGame() && !payed) { + while (player.canRespond() && !payed) { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); diff --git a/Mage.Sets/src/mage/sets/commander/MindsAglow.java b/Mage.Sets/src/mage/sets/commander/MindsAglow.java index 12cba52d24e..5ba8d8bf439 100644 --- a/Mage.Sets/src/mage/sets/commander/MindsAglow.java +++ b/Mage.Sets/src/mage/sets/commander/MindsAglow.java @@ -115,7 +115,7 @@ class MindsAglowEffect extends OneShotEffect { protected static int playerPaysXGenericMana(Player player, Ability source, Game game) { int xValue = 0; boolean payed = false; - while (player.isInGame() && !payed) { + while (player.canRespond() && !payed) { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); diff --git a/Mage.Sets/src/mage/sets/commander/SharedTrauma.java b/Mage.Sets/src/mage/sets/commander/SharedTrauma.java index bbbee2c23e9..79656863cff 100644 --- a/Mage.Sets/src/mage/sets/commander/SharedTrauma.java +++ b/Mage.Sets/src/mage/sets/commander/SharedTrauma.java @@ -116,7 +116,7 @@ class SharedTraumaEffect extends OneShotEffect { protected static int playerPaysXGenericMana(Player player, Ability source, Game game) { int xValue = 0; boolean payed = false; - while (player.isInGame() && !payed) { + while (player.canRespond() && !payed) { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); diff --git a/Mage.Sets/src/mage/sets/commander2013/LimDulsVault.java b/Mage.Sets/src/mage/sets/commander2013/LimDulsVault.java index 70324bd4e97..16dfe1a4085 100644 --- a/Mage.Sets/src/mage/sets/commander2013/LimDulsVault.java +++ b/Mage.Sets/src/mage/sets/commander2013/LimDulsVault.java @@ -113,7 +113,7 @@ class LimDulsVaultEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.PICK, new FilterCard(doAgain ? textBottom : textTop)); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/commander2013/MysticBarrier.java b/Mage.Sets/src/mage/sets/commander2013/MysticBarrier.java index d09ebee60d1..51cbccf2b28 100644 --- a/Mage.Sets/src/mage/sets/commander2013/MysticBarrier.java +++ b/Mage.Sets/src/mage/sets/commander2013/MysticBarrier.java @@ -147,7 +147,7 @@ class MysticBarrierChooseEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { DIRECTION_CHOICE.clearChoice(); - while (!DIRECTION_CHOICE.isChosen() && controller.isInGame()) { + while (!DIRECTION_CHOICE.isChosen() && controller.canRespond()) { controller.choose(outcome, DIRECTION_CHOICE, game); } if (!DIRECTION_CHOICE.getChoice().isEmpty()) { diff --git a/Mage.Sets/src/mage/sets/commander2013/OrderOfSuccession.java b/Mage.Sets/src/mage/sets/commander2013/OrderOfSuccession.java index 207d3d143d9..e62790e6d4c 100644 --- a/Mage.Sets/src/mage/sets/commander2013/OrderOfSuccession.java +++ b/Mage.Sets/src/mage/sets/commander2013/OrderOfSuccession.java @@ -100,14 +100,14 @@ class OrderOfSuccessionEffect extends OneShotEffect { boolean left = source.getChoices().get(0).getChoice().equals("Left"); PlayerList playerList = game.getState().getPlayerList().copy(); // set playerlist to controller - while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) { + while (!playerList.get().equals(source.getControllerId()) && controller.canRespond()) { playerList.getNext(); } Player currentPlayer = game.getPlayer(playerList.get()); Player nextPlayer; UUID firstNextPlayer = null; - while (!getNextPlayerInDirection(left, playerList, game).equals(firstNextPlayer) && controller.isInGame()){ + while (!getNextPlayerInDirection(left, playerList, game).equals(firstNextPlayer) && controller.canRespond()){ nextPlayer = game.getPlayer(playerList.get()); if (nextPlayer == null) { return false; @@ -116,7 +116,7 @@ class OrderOfSuccessionEffect extends OneShotEffect { if (firstNextPlayer == null) { firstNextPlayer = nextPlayer.getId(); } - if (!nextPlayer.isInGame()) { + if (!nextPlayer.canRespond()) { continue; } // if player is in range he chooses a creature to control diff --git a/Mage.Sets/src/mage/sets/conflux/MaelstromArchangel.java b/Mage.Sets/src/mage/sets/conflux/MaelstromArchangel.java index 073e0230c0a..e3b790a50e3 100644 --- a/Mage.Sets/src/mage/sets/conflux/MaelstromArchangel.java +++ b/Mage.Sets/src/mage/sets/conflux/MaelstromArchangel.java @@ -104,7 +104,7 @@ class MaelstromArchangelCastEffect extends OneShotEffect { controller.chooseUse(outcome, "Cast a nonland card from your hand without paying its mana cost?", source, game)) { Card cardToCast = null; boolean cancel = false; - while (controller.isInGame() && !cancel) { + while (controller.canRespond() && !cancel) { if (controller.chooseTarget(outcome, target, source, game)) { cardToCast = game.getCard(target.getFirstTarget()); if (cardToCast != null && cardToCast.getSpellAbility().canChooseTarget(game)) { diff --git a/Mage.Sets/src/mage/sets/darkascension/CallToTheKindred.java b/Mage.Sets/src/mage/sets/darkascension/CallToTheKindred.java index 7d0fcaf0d4d..0e3912d65a8 100644 --- a/Mage.Sets/src/mage/sets/darkascension/CallToTheKindred.java +++ b/Mage.Sets/src/mage/sets/darkascension/CallToTheKindred.java @@ -154,7 +154,7 @@ class CallToTheKindredEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/darkascension/FaithsShield.java b/Mage.Sets/src/mage/sets/darkascension/FaithsShield.java index 8132dccf512..6c1971add28 100644 --- a/Mage.Sets/src/mage/sets/darkascension/FaithsShield.java +++ b/Mage.Sets/src/mage/sets/darkascension/FaithsShield.java @@ -95,7 +95,7 @@ class FaithsShieldEffect extends OneShotEffect { ChoiceColor choice = new ChoiceColor(); while (!choice.isChosen()) { controller.choose(Outcome.Protect, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/CatchRelease.java b/Mage.Sets/src/mage/sets/dragonsmaze/CatchRelease.java index cbb123879ee..e40d9d7265f 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/CatchRelease.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/CatchRelease.java @@ -119,7 +119,7 @@ class ReleaseSacrificeEffect extends OneShotEffect { Target target5 = new TargetControlledPermanent(1, 1, new FilterControlledPlaneswalkerPermanent(), true); if (target1.canChoose(player.getId(), game)) { - while (player.isInGame() && !target1.isChosen() && target1.canChoose(player.getId(), game)) { + while (player.canRespond() && !target1.isChosen() && target1.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target1, source, game); } Permanent artifact = game.getPermanent(target1.getFirstTarget()); @@ -130,7 +130,7 @@ class ReleaseSacrificeEffect extends OneShotEffect { } if (target2.canChoose(player.getId(), game)) { - while (player.isInGame() && !target2.isChosen() && target2.canChoose(player.getId(), game)) { + while (player.canRespond() && !target2.isChosen() && target2.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target2, source, game); } Permanent creature = game.getPermanent(target2.getFirstTarget()); @@ -141,7 +141,7 @@ class ReleaseSacrificeEffect extends OneShotEffect { } if (target3.canChoose(player.getId(), game)) { - while (player.isInGame() && !target3.isChosen() && target3.canChoose(player.getId(), game)) { + while (player.canRespond() && !target3.isChosen() && target3.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target3, source, game); } Permanent enchantment = game.getPermanent(target3.getFirstTarget()); @@ -152,7 +152,7 @@ class ReleaseSacrificeEffect extends OneShotEffect { } if (target4.canChoose(player.getId(), game)) { - while (player.isInGame() && !target4.isChosen() && target4.canChoose(player.getId(), game)) { + while (player.canRespond() && !target4.isChosen() && target4.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target4, source, game); } Permanent land = game.getPermanent(target4.getFirstTarget()); @@ -163,7 +163,7 @@ class ReleaseSacrificeEffect extends OneShotEffect { } if (target5.canChoose(player.getId(), game)) { - while (player.isInGame() && !target5.isChosen() && target5.canChoose(player.getId(), game)) { + while (player.canRespond() && !target5.isChosen() && target5.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target5, source, game); } Permanent planeswalker = game.getPermanent(target5.getFirstTarget()); diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/PlasmCapture.java b/Mage.Sets/src/mage/sets/dragonsmaze/PlasmCapture.java index 6d3398e9a0b..88a299b5c98 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/PlasmCapture.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/PlasmCapture.java @@ -135,7 +135,7 @@ class PlasmCaptureManaEffect extends ManaEffect { for(int i = 0; i < amountOfMana; i++){ ChoiceColor choiceColor = new ChoiceColor(); while (!player.choose(Outcome.Benefit, choiceColor, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/RevealingWind.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/RevealingWind.java index 71108179dac..5baca9c6591 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/RevealingWind.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/RevealingWind.java @@ -102,7 +102,7 @@ class RevealingWindEffect extends OneShotEffect { if (controller != null && sourceObject != null) { while (game.getBattlefield().count(filter, source.getOriginalId(), source.getControllerId(), game) > 0 && controller.chooseUse(outcome, "Look at a face-down attacking creature?", source, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } Target target = new TargetCreaturePermanent(filter); diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/ShorecrasherElemental.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/ShorecrasherElemental.java index 05cd4d56750..24779808257 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/ShorecrasherElemental.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/ShorecrasherElemental.java @@ -150,7 +150,7 @@ class ShorecrasherElementalBoostEffect extends OneShotEffect { choice.getChoices().add(CHOICE_1); choice.getChoices().add(CHOICE_2); while (!choice.isChosen()) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } controller.choose(outcome, choice, game); diff --git a/Mage.Sets/src/mage/sets/eventide/Evershrike.java b/Mage.Sets/src/mage/sets/eventide/Evershrike.java index f413f47643e..776939f0dcd 100644 --- a/Mage.Sets/src/mage/sets/eventide/Evershrike.java +++ b/Mage.Sets/src/mage/sets/eventide/Evershrike.java @@ -122,7 +122,7 @@ class EvershrikeEffect extends OneShotEffect { filterAuraCard.add(new AuraCardCanAttachToPermanentId(evershrikePermanent.getId())); filterAuraCard.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, xAmount)); int count = controller.getHand().count(filterAuraCard, game); - while (controller.isInGame() && count > 0 && controller.chooseUse(Outcome.Benefit, "Do you wish to put an Aura card from your hand onto Evershrike", source, game)) { + while (controller.canRespond() && count > 0 && controller.chooseUse(Outcome.Benefit, "Do you wish to put an Aura card from your hand onto Evershrike", source, game)) { TargetCard targetAura = new TargetCard(Zone.PICK, filterAuraCard); if (controller.choose(Outcome.Benefit, controller.getHand(), targetAura, game)) { Card aura = game.getCard(targetAura.getFirstTarget()); diff --git a/Mage.Sets/src/mage/sets/exodus/Cataclysm.java b/Mage.Sets/src/mage/sets/exodus/Cataclysm.java index e9eac061644..ac1df0bf079 100644 --- a/Mage.Sets/src/mage/sets/exodus/Cataclysm.java +++ b/Mage.Sets/src/mage/sets/exodus/Cataclysm.java @@ -95,7 +95,7 @@ class CataclysmEffect extends OneShotEffect { Target target4 = new TargetControlledPermanent(1, 1, new FilterControlledLandPermanent(), true); if (target1.canChoose(player.getId(), game)) { - while (player.isInGame() && !target1.isChosen() && target1.canChoose(player.getId(), game)) { + while (player.canRespond() && !target1.isChosen() && target1.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target1, source, game); } Permanent artifact = game.getPermanent(target1.getFirstTarget()); @@ -106,7 +106,7 @@ class CataclysmEffect extends OneShotEffect { } if (target2.canChoose(player.getId(), game)) { - while (player.isInGame() && !target2.isChosen() && target2.canChoose(player.getId(), game)) { + while (player.canRespond() && !target2.isChosen() && target2.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target2, source, game); } Permanent creature = game.getPermanent(target2.getFirstTarget()); @@ -117,7 +117,7 @@ class CataclysmEffect extends OneShotEffect { } if (target3.canChoose(player.getId(), game)) { - while (player.isInGame() && !target3.isChosen() && target3.canChoose(player.getId(), game)) { + while (player.canRespond() && !target3.isChosen() && target3.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target3, source, game); } Permanent enchantment = game.getPermanent(target3.getFirstTarget()); @@ -128,7 +128,7 @@ class CataclysmEffect extends OneShotEffect { } if (target4.canChoose(player.getId(), game)) { - while (player.isInGame() && !target4.isChosen() && target4.canChoose(player.getId(), game)) { + while (player.canRespond() && !target4.isChosen() && target4.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target4, source, game); } Permanent land = game.getPermanent(target4.getFirstTarget()); diff --git a/Mage.Sets/src/mage/sets/fifthdawn/DawnsReflection.java b/Mage.Sets/src/mage/sets/fifthdawn/DawnsReflection.java index 8a06a839efe..417381b270e 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/DawnsReflection.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/DawnsReflection.java @@ -138,7 +138,7 @@ class DawnsReflectionManaEffect extends ManaEffect { Mana mana = new Mana(); for(int i = 0; i < x; i++){ ChoiceColor choiceColor = new ChoiceColor(); - while (controller.isInGame() && !controller.choose(Outcome.Benefit, choiceColor, game)) { + while (controller.canRespond() && !controller.choose(Outcome.Benefit, choiceColor, game)) { } if (choiceColor.getColor().isBlack()) { diff --git a/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java b/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java index d5f790e39c8..561def505a0 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java +++ b/Mage.Sets/src/mage/sets/fifthedition/PrimalClay.java @@ -127,7 +127,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl { if (controller != null) { while (!choice.isChosen()) { controller.choose(Outcome.Neutral, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/fifthedition/SylvanLibrary.java b/Mage.Sets/src/mage/sets/fifthedition/SylvanLibrary.java index 107198b3830..e6d7c57a60e 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/SylvanLibrary.java +++ b/Mage.Sets/src/mage/sets/fifthedition/SylvanLibrary.java @@ -130,7 +130,7 @@ class SylvanLibraryEffect extends OneShotEffect { int numberOfCardsToPutBack = cardsPutBack.size(); if (numberOfCardsToPutBack > 1) { TargetCard target2 = new TargetCard(Zone.PICK, new FilterCard("card to put on the top of your library (last chosen will be on top)")); - while (controller.isInGame() && cardsPutBack.size() > 1) { + while (controller.canRespond() && cardsPutBack.size() > 1) { controller.choose(Outcome.Benefit, cardsPutBack, target2, game); Card card = cardsPutBack.get(target2.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/fourthedition/ManaClash.java b/Mage.Sets/src/mage/sets/fourthedition/ManaClash.java index 3af50806837..2491e72b18a 100644 --- a/Mage.Sets/src/mage/sets/fourthedition/ManaClash.java +++ b/Mage.Sets/src/mage/sets/fourthedition/ManaClash.java @@ -86,7 +86,7 @@ class ManaClashEffect extends OneShotEffect { if (controller != null && targetOpponent != null) { boolean bothHeads = false; while (!bothHeads) { - if (!targetOpponent.isInGame() || !controller.isInGame()) { + if (!targetOpponent.canRespond() || !controller.canRespond()) { return false; } boolean controllerFlip = controller.flipCoin(game); diff --git a/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java b/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java index 8b07a5d5a3c..1c7ec71523c 100644 --- a/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java +++ b/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java @@ -103,7 +103,7 @@ class CoalitionRelicEffect extends OneShotEffect { ChoiceColor choice = new ChoiceColor(); for (int i = 0; i < chargeCounters; i++) { while (!choice.isChosen()) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } player.choose(outcome, choice, game); diff --git a/Mage.Sets/src/mage/sets/gatecrash/DevourFlesh.java b/Mage.Sets/src/mage/sets/gatecrash/DevourFlesh.java index 08c0c7cd7c0..ca6a0813125 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/DevourFlesh.java +++ b/Mage.Sets/src/mage/sets/gatecrash/DevourFlesh.java @@ -94,7 +94,7 @@ class DevourFleshSacrificeEffect extends OneShotEffect { int realCount = game.getBattlefield().countAll(filter, player.getId(), game); if (realCount > 0) { Target target = new TargetControlledPermanent(1, 1, filter, true); - while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) { + while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Sacrifice, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/sets/heroesvsmonsters/OrcishLumberjack.java b/Mage.Sets/src/mage/sets/heroesvsmonsters/OrcishLumberjack.java index c6505ff9f7c..93277aa22f2 100644 --- a/Mage.Sets/src/mage/sets/heroesvsmonsters/OrcishLumberjack.java +++ b/Mage.Sets/src/mage/sets/heroesvsmonsters/OrcishLumberjack.java @@ -117,7 +117,7 @@ class OrcishLumberjackManaEffect extends ManaEffect { Mana mana = new Mana(); for(int i = 0; i < 3; i++){ while (!player.choose(Outcome.Benefit, manaChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java b/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java index 3400dc1a706..fec01eeb83c 100644 --- a/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java +++ b/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java @@ -93,7 +93,7 @@ class DemonicConsultationEffect extends OneShotEffect { Choice choice = new ChoiceImpl(); choice.setChoices(CardRepository.instance.getNames()); while (!player.choose(Outcome.Benefit, choice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/iceage/OrcishLibrarian.java b/Mage.Sets/src/mage/sets/iceage/OrcishLibrarian.java index d222dabce1b..2d1db6c7eb2 100644 --- a/Mage.Sets/src/mage/sets/iceage/OrcishLibrarian.java +++ b/Mage.Sets/src/mage/sets/iceage/OrcishLibrarian.java @@ -121,7 +121,7 @@ class OrcishLibrarianEffect extends OneShotEffect { } player.lookAtCards("OrcishLibrarian", cards, game); TargetCard target = new TargetCard (Zone.PICK, new FilterCard("card to put on the top of target player's library")); - while (player.isInGame() && cards.size() > 0) { + while (player.canRespond() && cards.size() > 0) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/innistrad/CreepingRenaissance.java b/Mage.Sets/src/mage/sets/innistrad/CreepingRenaissance.java index 1049985b973..d43daaec59b 100644 --- a/Mage.Sets/src/mage/sets/innistrad/CreepingRenaissance.java +++ b/Mage.Sets/src/mage/sets/innistrad/CreepingRenaissance.java @@ -93,7 +93,7 @@ class CreepingRenaissanceEffect extends OneShotEffect { typeChoice.getChoices().add(CardType.LAND.toString()); typeChoice.getChoices().add(CardType.PLANESWALKER.toString()); - while (controller.isInGame() && !controller.choose(Outcome.ReturnToHand, typeChoice, game)) { + while (controller.canRespond() && !controller.choose(Outcome.ReturnToHand, typeChoice, game)) { } String typeName = typeChoice.getChoice(); diff --git a/Mage.Sets/src/mage/sets/innistrad/DivineReckoning.java b/Mage.Sets/src/mage/sets/innistrad/DivineReckoning.java index e6b2260326a..f1a5bdd979c 100644 --- a/Mage.Sets/src/mage/sets/innistrad/DivineReckoning.java +++ b/Mage.Sets/src/mage/sets/innistrad/DivineReckoning.java @@ -95,7 +95,7 @@ class DivineReckoningEffect extends OneShotEffect { Target target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true); if (target.canChoose(player.getId(), game)) { - while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) { + while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.Benefit, target, source, game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/sets/innistrad/GarrukTheVeilCursed.java b/Mage.Sets/src/mage/sets/innistrad/GarrukTheVeilCursed.java index b702789950c..4a5d8e531d0 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GarrukTheVeilCursed.java +++ b/Mage.Sets/src/mage/sets/innistrad/GarrukTheVeilCursed.java @@ -153,7 +153,7 @@ class GarrukTheVeilCursedEffect extends OneShotEffect { Target target = new TargetControlledPermanent(1, 1, filterCreature, false); boolean sacrificed = false; if (target.canChoose(controller.getId(), game)) { - while (controller.isInGame() && !target.isChosen() && target.canChoose(controller.getId(), game)) { + while (controller.canRespond() && !target.isChosen() && target.canChoose(controller.getId(), game)) { controller.chooseTarget(Outcome.Sacrifice, target, source, game); } diff --git a/Mage.Sets/src/mage/sets/innistrad/Nevermore.java b/Mage.Sets/src/mage/sets/innistrad/Nevermore.java index c5a02b4cbd0..dee67c6f07f 100644 --- a/Mage.Sets/src/mage/sets/innistrad/Nevermore.java +++ b/Mage.Sets/src/mage/sets/innistrad/Nevermore.java @@ -100,7 +100,7 @@ class NevermoreEffect1 extends OneShotEffect { cardChoice.setChoices(CardRepository.instance.getNonLandNames()); cardChoice.clearChoice(); while (!controller.choose(Outcome.Detriment, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/HallOfTriumph.java b/Mage.Sets/src/mage/sets/journeyintonyx/HallOfTriumph.java index 8e4ad8a781f..6fb34b789b2 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/HallOfTriumph.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/HallOfTriumph.java @@ -95,7 +95,7 @@ class HallOfTriumphEffect extends OneShotEffect { ChoiceColor colorChoice = new ChoiceColor(); colorChoice.setMessage("Choose color"); while (!player.choose(Outcome.BoostCreature, colorChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/MarketFestival.java b/Mage.Sets/src/mage/sets/journeyintonyx/MarketFestival.java index 6075982ce44..affa7e15e95 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/MarketFestival.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/MarketFestival.java @@ -148,7 +148,7 @@ class MarketFestivalManaEffect extends ManaEffect { choiceColor.setMessage("Second mana color for " + sourceObject.getLogName()); } while (!controller.choose(Outcome.Benefit, choiceColor, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/judgment/CabalTherapy.java b/Mage.Sets/src/mage/sets/judgment/CabalTherapy.java index b6c15bf2768..524c6e205e3 100644 --- a/Mage.Sets/src/mage/sets/judgment/CabalTherapy.java +++ b/Mage.Sets/src/mage/sets/judgment/CabalTherapy.java @@ -101,7 +101,7 @@ class CabalTherapyEffect extends OneShotEffect { cardChoice.clearChoice(); while (!controller.choose(Outcome.Discard, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/judgment/FlashOfInsight.java b/Mage.Sets/src/mage/sets/judgment/FlashOfInsight.java index 421391c7998..7d3422aac21 100644 --- a/Mage.Sets/src/mage/sets/judgment/FlashOfInsight.java +++ b/Mage.Sets/src/mage/sets/judgment/FlashOfInsight.java @@ -141,7 +141,7 @@ class FlashOfInsightEffect extends OneShotEffect { .append(" card").append(cards.size() > 1 ? "s":"") .append(" on the bottom of his or her library").toString()); } - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/ButcherOfTheHorde.java b/Mage.Sets/src/mage/sets/khansoftarkir/ButcherOfTheHorde.java index d24de33f7a5..cab7e99034a 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/ButcherOfTheHorde.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/ButcherOfTheHorde.java @@ -118,7 +118,7 @@ class ButcherOfTheHordeEffect extends OneShotEffect { abilityChoice.setChoices(abilities); while (!abilityChoice.isChosen()) { controller.choose(Outcome.AddAbility, abilityChoice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/legions/MistformSliver.java b/Mage.Sets/src/mage/sets/legions/MistformSliver.java index 495458f4e11..d401e139c89 100644 --- a/Mage.Sets/src/mage/sets/legions/MistformSliver.java +++ b/Mage.Sets/src/mage/sets/legions/MistformSliver.java @@ -103,7 +103,7 @@ public class MistformSliver extends CardImpl { typeChoice.setMessage("Choose creature type"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.Detriment, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/limitedalpha/NaturalSelection.java b/Mage.Sets/src/mage/sets/limitedalpha/NaturalSelection.java index 38657372332..0a160360c1e 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/NaturalSelection.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/NaturalSelection.java @@ -108,7 +108,7 @@ class NaturalSelectionEffect extends OneShotEffect { you.lookAtCards("Natural Selection", cards, game); TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the top of target player's library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { you.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/lorwyn/HoardersGreed.java b/Mage.Sets/src/mage/sets/lorwyn/HoardersGreed.java index 1fca4665842..0b05ef52053 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/HoardersGreed.java +++ b/Mage.Sets/src/mage/sets/lorwyn/HoardersGreed.java @@ -86,7 +86,7 @@ class HoardersGreedEffect extends OneShotEffect { do { controller.loseLife(2, game); controller.drawCards(2, game); - } while (controller.isInGame() && ClashEffect.getInstance().apply(game, source)); + } while (controller.canRespond() && ClashEffect.getInstance().apply(game, source)); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/magic2010/MirrorOfFate.java b/Mage.Sets/src/mage/sets/magic2010/MirrorOfFate.java index 501a3d8bafa..2452f5850b2 100644 --- a/Mage.Sets/src/mage/sets/magic2010/MirrorOfFate.java +++ b/Mage.Sets/src/mage/sets/magic2010/MirrorOfFate.java @@ -114,7 +114,7 @@ class MirrorOfFateEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on top of your library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/magic2010/SphinxAmbassador.java b/Mage.Sets/src/mage/sets/magic2010/SphinxAmbassador.java index d45e92ec373..595a34013f8 100644 --- a/Mage.Sets/src/mage/sets/magic2010/SphinxAmbassador.java +++ b/Mage.Sets/src/mage/sets/magic2010/SphinxAmbassador.java @@ -116,7 +116,7 @@ class SphinxAmbassadorEffect extends OneShotEffect { cardChoice.setChoices(choices); cardChoice.clearChoice(); while (!targetPlayer.choose(Outcome.Benefit, cardChoice, game)) { - if (!targetPlayer.isInGame()) { + if (!targetPlayer.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/magic2011/ConundrumSphinx.java b/Mage.Sets/src/mage/sets/magic2011/ConundrumSphinx.java index b8143876eb4..18776c87e2f 100644 --- a/Mage.Sets/src/mage/sets/magic2011/ConundrumSphinx.java +++ b/Mage.Sets/src/mage/sets/magic2011/ConundrumSphinx.java @@ -95,8 +95,8 @@ class ConundrumSphinxEffect extends OneShotEffect { for (Player player: game.getPlayers().values()) { if(player.getLibrary().size() > 0){ cardChoice.clearChoice(); - while (!player.choose(Outcome.DrawCard, cardChoice, game) && player.isInGame()) { - if (!player.isInGame()) { + while (!player.choose(Outcome.DrawCard, cardChoice, game) && player.canRespond()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/magic2014/DevoutInvocation.java b/Mage.Sets/src/mage/sets/magic2014/DevoutInvocation.java index 6e918f15df8..3f71b0c0a72 100644 --- a/Mage.Sets/src/mage/sets/magic2014/DevoutInvocation.java +++ b/Mage.Sets/src/mage/sets/magic2014/DevoutInvocation.java @@ -94,7 +94,7 @@ class DevoutInvocationEffect extends OneShotEffect { if (controller != null) { int tappedAmount = 0; TargetPermanent target = new TargetPermanent(0,1,filter, false); - while (true && controller.isInGame()) { + while (true && controller.canRespond()) { target.clearChosen(); if (target.canChoose(source.getControllerId(), game)) { Map options = new HashMap<>(); diff --git a/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java b/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java index 5cbd32e4098..5bc3c1c2891 100644 --- a/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java +++ b/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java @@ -107,7 +107,7 @@ class ChooseCreatureTypeEffect extends OneShotEffect { typeChoice.setMessage("Choose creature type"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/magic2015/AEtherspouts.java b/Mage.Sets/src/mage/sets/magic2015/AEtherspouts.java index c0590adff87..eeff32b8b5c 100644 --- a/Mage.Sets/src/mage/sets/magic2015/AEtherspouts.java +++ b/Mage.Sets/src/mage/sets/magic2015/AEtherspouts.java @@ -135,7 +135,7 @@ class AEtherspoutsEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.BATTLEFIELD, new FilterCard("order to put on the top of library (last choosen will be the top most)")); while (cards.size() > 1) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } player.choose(Outcome.Neutral, cards, target, game); @@ -174,7 +174,7 @@ class AEtherspoutsEffect extends OneShotEffect { } } target = new TargetCard(Zone.BATTLEFIELD, new FilterCard("order to put on bottom of library (last choosen will be bottommost card)")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); @@ -199,7 +199,7 @@ class AEtherspoutsEffect extends OneShotEffect { player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, false, false); } player = playerList.getNext(game); - } while (player != null && !player.getId().equals(game.getActivePlayerId()) && activePlayer.isInGame()); + } while (player != null && !player.getId().equals(game.getActivePlayerId()) && activePlayer.canRespond()); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/magic2015/ObeliskOfUrd.java b/Mage.Sets/src/mage/sets/magic2015/ObeliskOfUrd.java index 4b7687d0e3f..d4a6c4f3a15 100644 --- a/Mage.Sets/src/mage/sets/magic2015/ObeliskOfUrd.java +++ b/Mage.Sets/src/mage/sets/magic2015/ObeliskOfUrd.java @@ -106,7 +106,7 @@ class ObeliskOfUrdEnterBattlefieldEffect extends OneShotEffect { typeChoice.setMessage("Choose a creature type:"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/magic2015/StainTheMind.java b/Mage.Sets/src/mage/sets/magic2015/StainTheMind.java index cb50105e033..804ef524c2f 100644 --- a/Mage.Sets/src/mage/sets/magic2015/StainTheMind.java +++ b/Mage.Sets/src/mage/sets/magic2015/StainTheMind.java @@ -92,7 +92,7 @@ class StainTheMindEffect extends SearchTargetGraveyardHandLibraryForCardNameAndE cardChoice.setMessage("Name a nonland card"); while (!controller.choose(Outcome.Exile, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/magicorigins/InfiniteObliteration.java b/Mage.Sets/src/mage/sets/magicorigins/InfiniteObliteration.java index 3c432dcc1b6..030db436a14 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/InfiniteObliteration.java +++ b/Mage.Sets/src/mage/sets/magicorigins/InfiniteObliteration.java @@ -90,7 +90,7 @@ class InfiniteObliterationEffect extends SearchTargetGraveyardHandLibraryForCard cardChoice.setMessage("Name a creature card"); while (!controller.choose(Outcome.Exile, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java b/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java index 7e75184c2d9..b97b16398ba 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java +++ b/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java @@ -121,7 +121,7 @@ class SphinxsTutelageEffect extends OneShotEffect { } } targetPlayer.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); - } while (colorShared && targetPlayer.isInGame()); + } while (colorShared && targetPlayer.canRespond()); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/magicorigins/TalentOfTheTelepath.java b/Mage.Sets/src/mage/sets/magicorigins/TalentOfTheTelepath.java index 9094d046dcb..3614a8974e2 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/TalentOfTheTelepath.java +++ b/Mage.Sets/src/mage/sets/magicorigins/TalentOfTheTelepath.java @@ -130,7 +130,7 @@ class TalentOfTheTelepathEffect extends OneShotEffect { cardsToCast.remove(card); allCards.remove(card); } - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } target.clearChosen(); diff --git a/Mage.Sets/src/mage/sets/mirrodin/ProteusStaff.java b/Mage.Sets/src/mage/sets/mirrodin/ProteusStaff.java index 1d631448acc..90dc9c2a875 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/ProteusStaff.java +++ b/Mage.Sets/src/mage/sets/mirrodin/ProteusStaff.java @@ -119,7 +119,7 @@ class ProteusStaffEffect extends OneShotEffect { controller.revealCards("Proteus Staff", cards, game); // and the rest on the bottom of his or her library in any order. - while (cards.size() > 0 && controller.isInGame()) { + while (cards.size() > 0 && controller.canRespond()) { if (cards.size() == 1) { Card card = cards.get(cards.iterator().next(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/MitoticManipulation.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/MitoticManipulation.java index def18f8114c..c911a7f3537 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/MitoticManipulation.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/MitoticManipulation.java @@ -130,7 +130,7 @@ class MitoticManipulationEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java index fd0a2c97d80..279bd693526 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/PhyrexianRevoker.java @@ -103,7 +103,7 @@ class PhyrexianRevokerEffect1 extends OneShotEffect { cardChoice.setChoices(CardRepository.instance.getNonLandNames()); cardChoice.clearChoice(); while (!controller.choose(Outcome.Detriment, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/morningtide/DistantMelody.java b/Mage.Sets/src/mage/sets/morningtide/DistantMelody.java index 2c4c17f745b..7a5dd503b10 100644 --- a/Mage.Sets/src/mage/sets/morningtide/DistantMelody.java +++ b/Mage.Sets/src/mage/sets/morningtide/DistantMelody.java @@ -93,7 +93,7 @@ class DistantMelodyEffect extends OneShotEffect { typeChoice.setMessage("Choose a creature type:"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/morningtide/LuminescentRain.java b/Mage.Sets/src/mage/sets/morningtide/LuminescentRain.java index d677141a652..567db004db5 100644 --- a/Mage.Sets/src/mage/sets/morningtide/LuminescentRain.java +++ b/Mage.Sets/src/mage/sets/morningtide/LuminescentRain.java @@ -91,7 +91,7 @@ class LuminescentRainEffect extends OneShotEffect { typeChoice.setMessage("Choose a creature type:"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/morningtide/RoarOfTheCrowd.java b/Mage.Sets/src/mage/sets/morningtide/RoarOfTheCrowd.java index fa9e9d70501..bd30aad56e4 100644 --- a/Mage.Sets/src/mage/sets/morningtide/RoarOfTheCrowd.java +++ b/Mage.Sets/src/mage/sets/morningtide/RoarOfTheCrowd.java @@ -94,7 +94,7 @@ class RoarOfTheCrowdEffect extends OneShotEffect { typeChoice.setMessage("Choose a creature type:"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.LoseLife, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ApostlesBlessing.java b/Mage.Sets/src/mage/sets/newphyrexia/ApostlesBlessing.java index 1106bb635aa..38f851c776d 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ApostlesBlessing.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ApostlesBlessing.java @@ -105,7 +105,7 @@ class ApostlesBlessingEffect extends OneShotEffect { if (controller != null) { ChoiceColorOrArtifact choice = new ChoiceColorOrArtifact(); while (!choice.isChosen()) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } controller.choose(outcome, choice, game); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java b/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java index 35a26e0db75..8178bb45663 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java @@ -150,7 +150,7 @@ class PsychicSurgeryEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on top of his library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java b/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java index 9483fe13c92..e6670e7d7f5 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java @@ -140,7 +140,7 @@ class ShrineOfPiercingVisionEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java b/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java index 88692fb2d1d..df7da676226 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/Xenograft.java @@ -97,7 +97,7 @@ class XenograftEffect extends OneShotEffect { typeChoice.setMessage("Choose creature type"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/ninthedition/StorageMatrix.java b/Mage.Sets/src/mage/sets/ninthedition/StorageMatrix.java index 62c863c93ef..2256c8e78f8 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/StorageMatrix.java +++ b/Mage.Sets/src/mage/sets/ninthedition/StorageMatrix.java @@ -107,7 +107,7 @@ class StorageMatrixRestrictionEffect extends RestrictionEffect { Player player = game.getPlayer(game.getActivePlayerId()); if (player != null) { while (!player.choose(outcome, choiceImpl, game)) { - if (player.isInGame()) { + if (player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/ninthedition/TeferisPuzzleBox.java b/Mage.Sets/src/mage/sets/ninthedition/TeferisPuzzleBox.java index d4cebbe74e7..636a1fe1ad8 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/TeferisPuzzleBox.java +++ b/Mage.Sets/src/mage/sets/ninthedition/TeferisPuzzleBox.java @@ -95,7 +95,7 @@ class TeferisPuzzleBoxEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/odyssey/TaintedPact.java b/Mage.Sets/src/mage/sets/odyssey/TaintedPact.java index 09b9c6d6f25..1674834f938 100644 --- a/Mage.Sets/src/mage/sets/odyssey/TaintedPact.java +++ b/Mage.Sets/src/mage/sets/odyssey/TaintedPact.java @@ -90,7 +90,7 @@ class TaintedPactEffect extends OneShotEffect{ return false; } Set names = new HashSet<>(); - while (player.isInGame() && player.getLibrary().size() > 0) { + while (player.canRespond() && player.getLibrary().size() > 0) { Card card = player.getLibrary().getFromTop(game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/onslaught/AkromasBlessing.java b/Mage.Sets/src/mage/sets/onslaught/AkromasBlessing.java index bf42de81296..4b301c061ec 100644 --- a/Mage.Sets/src/mage/sets/onslaught/AkromasBlessing.java +++ b/Mage.Sets/src/mage/sets/onslaught/AkromasBlessing.java @@ -99,7 +99,7 @@ class AkromasBlessingChooseColorEffect extends OneShotEffect { ChoiceColor choice = new ChoiceColor(); while (!choice.isChosen()) { controller.choose(outcome, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/onslaught/PatriarchsBidding.java b/Mage.Sets/src/mage/sets/onslaught/PatriarchsBidding.java index e5a030662c2..42b4dfd2de0 100644 --- a/Mage.Sets/src/mage/sets/onslaught/PatriarchsBidding.java +++ b/Mage.Sets/src/mage/sets/onslaught/PatriarchsBidding.java @@ -102,7 +102,7 @@ class PatriarchsBiddingEffect extends OneShotEffect { typeChoice.setMessage("Choose a creature type"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.PutCreatureInPlay, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { break; } } diff --git a/Mage.Sets/src/mage/sets/onslaught/PeerPressure.java b/Mage.Sets/src/mage/sets/onslaught/PeerPressure.java index af01dc3a377..0dd856326d4 100644 --- a/Mage.Sets/src/mage/sets/onslaught/PeerPressure.java +++ b/Mage.Sets/src/mage/sets/onslaught/PeerPressure.java @@ -97,7 +97,7 @@ class PeerPressureEffect extends OneShotEffect { choice.setMessage("Choose creature type"); choice.setChoices(CardRepository.instance.getCreatureTypes()); while (!controller.choose(Outcome.GainControl, choice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/onslaught/RiptideShapeshifter.java b/Mage.Sets/src/mage/sets/onslaught/RiptideShapeshifter.java index d7f7e5d00b1..0f4b766a2cd 100644 --- a/Mage.Sets/src/mage/sets/onslaught/RiptideShapeshifter.java +++ b/Mage.Sets/src/mage/sets/onslaught/RiptideShapeshifter.java @@ -102,7 +102,7 @@ class RiptideShapeshifterEffect extends OneShotEffect { choice.setMessage("Choose a creature type:"); choice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(Outcome.BoostCreature, choice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/onslaught/Standardize.java b/Mage.Sets/src/mage/sets/onslaught/Standardize.java index c0f732a3706..760ae76aead 100644 --- a/Mage.Sets/src/mage/sets/onslaught/Standardize.java +++ b/Mage.Sets/src/mage/sets/onslaught/Standardize.java @@ -99,7 +99,7 @@ class StandardizeEffect extends OneShotEffect { types.remove("Wall"); typeChoice.setChoices(types); while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/onslaught/WordsOfWind.java b/Mage.Sets/src/mage/sets/onslaught/WordsOfWind.java index 54cac4d5891..756f729d359 100644 --- a/Mage.Sets/src/mage/sets/onslaught/WordsOfWind.java +++ b/Mage.Sets/src/mage/sets/onslaught/WordsOfWind.java @@ -99,7 +99,7 @@ class WordsOfWindEffect extends ReplacementEffectImpl { List liste = game.getBattlefield().getActivePermanents(new FilterControlledPermanent(), playerId, game); if(!liste.isEmpty()){ while (!player.choose(Outcome.ReturnToHand, target, source.getSourceId(), game)){ - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/phyrexiavsthecoalition/DarigaazTheIgniter.java b/Mage.Sets/src/mage/sets/phyrexiavsthecoalition/DarigaazTheIgniter.java index b8176452454..032facd8255 100644 --- a/Mage.Sets/src/mage/sets/phyrexiavsthecoalition/DarigaazTheIgniter.java +++ b/Mage.Sets/src/mage/sets/phyrexiavsthecoalition/DarigaazTheIgniter.java @@ -101,7 +101,7 @@ class DarigaazTheIgniterEffect extends OneShotEffect { ChoiceColor choice = new ChoiceColor(true); while (!choice.isChosen()) { controller.choose(outcome, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/planarchaos/VoidstoneGargoyle.java b/Mage.Sets/src/mage/sets/planarchaos/VoidstoneGargoyle.java index d222aeb8c4c..76bc947d8e7 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/VoidstoneGargoyle.java +++ b/Mage.Sets/src/mage/sets/planarchaos/VoidstoneGargoyle.java @@ -103,7 +103,7 @@ class VoidstoneGargoyleChooseCardEffect extends OneShotEffect { cardChoice.setChoices(CardRepository.instance.getNonLandNames()); cardChoice.clearChoice(); while (!controller.choose(Outcome.Detriment, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/planechase/VedalkenEngineer.java b/Mage.Sets/src/mage/sets/planechase/VedalkenEngineer.java index e3e2447e1ec..2e3e3d640d6 100644 --- a/Mage.Sets/src/mage/sets/planechase/VedalkenEngineer.java +++ b/Mage.Sets/src/mage/sets/planechase/VedalkenEngineer.java @@ -160,7 +160,7 @@ class VedalkenEngineerEffect extends ManaEffect { Mana mana = new Mana(); ChoiceColor choiceColor = new ChoiceColor(true); while (!controller.choose(Outcome.Benefit, choiceColor, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java b/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java index a638e785d59..4d91881eea1 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java +++ b/Mage.Sets/src/mage/sets/planechase2012/PrimalPlasma.java @@ -128,7 +128,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl { if (controller != null) { while (!choice.isChosen()) { controller.choose(Outcome.Neutral, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/planeshift/SunkenHope.java b/Mage.Sets/src/mage/sets/planeshift/SunkenHope.java index 4f161888409..9779bb3fb30 100644 --- a/Mage.Sets/src/mage/sets/planeshift/SunkenHope.java +++ b/Mage.Sets/src/mage/sets/planeshift/SunkenHope.java @@ -97,7 +97,7 @@ class ReturnToHandEffect extends OneShotEffect { Target target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true); if (target.canChoose(player.getId(), game)) { - while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) { + while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) { player.chooseTarget(Outcome.ReturnToHand, target, source, game); } diff --git a/Mage.Sets/src/mage/sets/portalthreekingdoms/BurningOfXinye.java b/Mage.Sets/src/mage/sets/portalthreekingdoms/BurningOfXinye.java index 4b31451bf46..7ec929aec5b 100644 --- a/Mage.Sets/src/mage/sets/portalthreekingdoms/BurningOfXinye.java +++ b/Mage.Sets/src/mage/sets/portalthreekingdoms/BurningOfXinye.java @@ -111,7 +111,7 @@ class BurningOfXinyeEffect extends OneShotEffect{ Target target = new TargetControlledPermanent(amount, amount, filter, true); if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) { - while (!target.isChosen() && target.canChoose(player.getId(), game) && player.isInGame()) { + while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } diff --git a/Mage.Sets/src/mage/sets/ravnica/CongregationAtDawn.java b/Mage.Sets/src/mage/sets/ravnica/CongregationAtDawn.java index c8dca0990b5..6ca8d911a6d 100644 --- a/Mage.Sets/src/mage/sets/ravnica/CongregationAtDawn.java +++ b/Mage.Sets/src/mage/sets/ravnica/CongregationAtDawn.java @@ -107,7 +107,7 @@ class CongregationAtDawnEffect extends OneShotEffect { TargetCard targetToLib = new TargetCard(Zone.PICK, new FilterCard(textTop)); - while (revealed.size() > 1 && controller.isInGame()) { + while (revealed.size() > 1 && controller.canRespond()) { controller.choose(Outcome.Neutral, revealed, targetToLib, game); Card card = revealed.get(targetToLib.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/ravnica/Mindmoil.java b/Mage.Sets/src/mage/sets/ravnica/Mindmoil.java index b45b2478e6b..f0669f79591 100644 --- a/Mage.Sets/src/mage/sets/ravnica/Mindmoil.java +++ b/Mage.Sets/src/mage/sets/ravnica/Mindmoil.java @@ -91,7 +91,7 @@ class MindmoilEffect extends OneShotEffect { cards.add(card.getId()); } TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - while (you.isInGame() && cards.size() > 1) { + while (you.canRespond() && cards.size() > 1) { you.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java b/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java index 590469bd589..c1a56bc3577 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java @@ -102,7 +102,7 @@ class DestroyTheEvidenceEffect extends OneShotEffect { boolean landFound = false; Cards cards = new CardsImpl(); while (player.getLibrary().size() > 0 && !landFound) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java b/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java index 58be732e789..3be54f89388 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java @@ -263,7 +263,7 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect { } TargetCard targetCard = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - while (player.isInGame() && cardsToLibrary.size() > 1) { + while (player.canRespond() && cardsToLibrary.size() > 1) { player.choose(Outcome.Neutral, cardsToLibrary, targetCard, game); Card card = cardsToLibrary.get(targetCard.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/SlaughterGames.java b/Mage.Sets/src/mage/sets/returntoravnica/SlaughterGames.java index f8fc51cc664..4a9b31a1afe 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/SlaughterGames.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/SlaughterGames.java @@ -101,7 +101,7 @@ class SlaughterGamesEffect extends SearchTargetGraveyardHandLibraryForCardNameAn cardChoice.setMessage("Name a nonland card"); while (!controller.choose(Outcome.Exile, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/TabletOfTheGuilds.java b/Mage.Sets/src/mage/sets/returntoravnica/TabletOfTheGuilds.java index b844e1a25c7..ffe0df331bd 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/TabletOfTheGuilds.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/TabletOfTheGuilds.java @@ -92,7 +92,7 @@ class TabletOfTheGuildsEntersBattlefieldEffect extends OneShotEffect { ChoiceColor colorChoice = new ChoiceColor(); colorChoice.setMessage("Choose the first color"); while (!player.choose(Outcome.GainLife, colorChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } @@ -101,7 +101,7 @@ class TabletOfTheGuildsEntersBattlefieldEffect extends OneShotEffect { colorChoice.getChoices().remove(colorChoice.getChoice()); colorChoice.setMessage("Choose the second color"); - while (!player.choose(Outcome.GainLife, colorChoice, game) && player.isInGame()) { + while (!player.choose(Outcome.GainLife, colorChoice, game) && player.canRespond()) { game.debugMessage("player canceled choosing type. retrying."); } game.getState().setValue(permanent.getId() + "_color2", colorChoice.getColor().toString()); diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/HellcarverDemon.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/HellcarverDemon.java index 0f479e09c9f..21e317a4214 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/HellcarverDemon.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/HellcarverDemon.java @@ -113,7 +113,7 @@ class HellcarverDemonEffect extends OneShotEffect { } } - while (player != null && player.isInGame() && player.chooseUse(Outcome.PlayForFree, "Cast another nonland card exiled with Hellcarver Demon without paying that card's mana cost?", source, game)) { + while (player != null && player.canRespond() && player.chooseUse(Outcome.PlayForFree, "Cast another nonland card exiled with Hellcarver Demon without paying that card's mana cost?", source, game)) { TargetCardInExile target = new TargetCardInExile(filter, source.getSourceId()); while (player.choose(Outcome.PlayForFree, game.getExile().getExileZone(source.getSourceId()), target, game)) { Card card = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/SasayaOrochiAscendant.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/SasayaOrochiAscendant.java index 1692019dc10..3bc2a38c378 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/SasayaOrochiAscendant.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/SasayaOrochiAscendant.java @@ -192,7 +192,7 @@ class SasayasEssenceManaEffectEffect extends ManaEffect { } else { while(!choice.isChosen()) { controller.choose(outcome, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/UndyingFlames.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/UndyingFlames.java index c9a1c61c0ed..a2e743fb821 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/UndyingFlames.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/UndyingFlames.java @@ -91,7 +91,7 @@ class UndyingFlamesEffect extends OneShotEffect { Player you = game.getPlayer(source.getControllerId()); Card sourceCard = game.getCard(source.getSourceId()); while (you != null && sourceCard != null - && you.getLibrary().size() > 0 && you.isInGame()) { + && you.getLibrary().size() > 0 && you.canRespond()) { Card card = you.getLibrary().removeFromTop(game); if (card != null) { you.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java index b200bd833ea..4f984aaf754 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/CloneShell.java @@ -125,7 +125,7 @@ class CloneShellEffect extends OneShotEffect { if (cards.size() > 0) { TargetCard target2 = new TargetCard(Zone.PICK, filter2); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Benefit, cards, target2, game); Card card = cards.get(target2.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/Memoricide.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/Memoricide.java index 3b5df3a250f..1d4bea6649b 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/Memoricide.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/Memoricide.java @@ -93,7 +93,7 @@ class MemoricideEffect extends OneShotEffect { cardChoice.clearChoice(); while (!controller.choose(Outcome.Exile, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/MyrBattlesphere.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/MyrBattlesphere.java index 6b53dcbc271..c0c51087095 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/MyrBattlesphere.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/MyrBattlesphere.java @@ -109,7 +109,7 @@ class MyrBattlesphereEffect extends OneShotEffect { if (controller != null) { int tappedAmount = 0; TargetPermanent target = new TargetPermanent(0,1,filter, false); - while (true && controller.isInGame()) { + while (true && controller.canRespond()) { target.clearChosen(); if (target.canChoose(source.getControllerId(), game)) { Map options = new HashMap<>(); diff --git a/Mage.Sets/src/mage/sets/scourge/KaronaFalseGod.java b/Mage.Sets/src/mage/sets/scourge/KaronaFalseGod.java index bc93b1ed61a..9313ed5c764 100644 --- a/Mage.Sets/src/mage/sets/scourge/KaronaFalseGod.java +++ b/Mage.Sets/src/mage/sets/scourge/KaronaFalseGod.java @@ -148,7 +148,7 @@ class KaronaFalseGodEffect extends OneShotEffect { typeChoice.setMessage("Choose creature type"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!controller.choose(Outcome.BoostCreature, typeChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/ManaforgeCinder.java b/Mage.Sets/src/mage/sets/shadowmoor/ManaforgeCinder.java index 46d33e9ab6c..c650a49008d 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/ManaforgeCinder.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/ManaforgeCinder.java @@ -105,7 +105,7 @@ class ManaforgeCinderManaEffect extends OneShotEffect { manaChoice.setMessage("Select black or red mana to add to your mana pool"); Mana mana = new Mana(); while (!controller.choose(Outcome.Benefit, manaChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/PlagueOfVermin.java b/Mage.Sets/src/mage/sets/shadowmoor/PlagueOfVermin.java index 4bf3c7225d6..a494bd2cb7e 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/PlagueOfVermin.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/PlagueOfVermin.java @@ -93,17 +93,17 @@ class PlagueOfVerminEffect extends OneShotEffect { int totalPaidLife; if (controller != null) { PlayerList playerList = game.getState().getPlayerList().copy(); - while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) { + while (!playerList.get().equals(source.getControllerId()) && controller.canRespond()) { playerList.getNext(); } Player currentPlayer = game.getPlayer(playerList.get()); UUID firstInactivePlayer = null; - while (controller.isInGame()) { + while (controller.canRespond()) { if (firstInactivePlayer == null) { firstInactivePlayer = currentPlayer.getId(); } - if (currentPlayer != null && currentPlayer.isInGame() && controller.getInRange().contains(currentPlayer.getId())) { + if (currentPlayer != null && currentPlayer.canRespond() && controller.getInRange().contains(currentPlayer.getId())) { currentLifePaid = 0; totalPaidLife = 0; if (currentPlayer.chooseUse(Outcome.AIDontUseIt, "Pay life?", source, game)) { diff --git a/Mage.Sets/src/mage/sets/shardsofalara/GiftOfTheGargantuan.java b/Mage.Sets/src/mage/sets/shardsofalara/GiftOfTheGargantuan.java index 68c2b74275f..d9ad98c8b73 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/GiftOfTheGargantuan.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/GiftOfTheGargantuan.java @@ -141,7 +141,7 @@ class GiftOfTheGargantuanEffect extends OneShotEffect { } TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java b/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java index be0377d3d78..803b119ff50 100644 --- a/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java +++ b/Mage.Sets/src/mage/sets/speedvscunning/AquamorphEntity.java @@ -145,7 +145,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl { if (controller != null) { while(!choice.isChosen()) { controller.choose(Outcome.Neutral, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/tempest/Grindstone.java b/Mage.Sets/src/mage/sets/tempest/Grindstone.java index 785046a82be..64654c52cf3 100644 --- a/Mage.Sets/src/mage/sets/tempest/Grindstone.java +++ b/Mage.Sets/src/mage/sets/tempest/Grindstone.java @@ -116,7 +116,7 @@ class GrindstoneEffect extends OneShotEffect { } } targetPlayer.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); - } while (colorShared && targetPlayer.isInGame()); + } while (colorShared && targetPlayer.canRespond()); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/tempest/Intuition.java b/Mage.Sets/src/mage/sets/tempest/Intuition.java index c3434f60978..b53b71eddcb 100644 --- a/Mage.Sets/src/mage/sets/tempest/Intuition.java +++ b/Mage.Sets/src/mage/sets/tempest/Intuition.java @@ -114,7 +114,7 @@ class IntuitionEffect extends SearchEffect { TargetCard targetCard = new TargetCard(Zone.PICK, new FilterCard()); while(!opponent.choose(Outcome.Neutral, cards, targetCard, game)) { - if (!opponent.isInGame()) { + if (!opponent.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/tempest/ScrollRack.java b/Mage.Sets/src/mage/sets/tempest/ScrollRack.java index 50cf767d80e..c675affb015 100644 --- a/Mage.Sets/src/mage/sets/tempest/ScrollRack.java +++ b/Mage.Sets/src/mage/sets/tempest/ScrollRack.java @@ -124,7 +124,7 @@ class ScrollRackEffect extends OneShotEffect { TargetCardInExile target2 = new TargetCardInExile(filter2, source.getSourceId()); ExileZone scrollRackExileZone = game.getExile().getExileZone(source.getSourceId()); if (scrollRackExileZone != null) { - while (controller.isInGame() && scrollRackExileZone.count(filter, game) > 1) { + while (controller.canRespond() && scrollRackExileZone.count(filter, game) > 1) { controller.lookAtCards("exiled cards with " + sourceObject.getName(), scrollRackExileZone, game); controller.choose(Outcome.Neutral, scrollRackExileZone, target2, game); Card card = game.getCard(target2.getFirstTarget()); diff --git a/Mage.Sets/src/mage/sets/tempest/WoodSage.java b/Mage.Sets/src/mage/sets/tempest/WoodSage.java index 867039608a8..3744b716831 100644 --- a/Mage.Sets/src/mage/sets/tempest/WoodSage.java +++ b/Mage.Sets/src/mage/sets/tempest/WoodSage.java @@ -103,7 +103,7 @@ class WoodSageEffect extends OneShotEffect { cardChoice.setChoices(CardRepository.instance.getCreatureNames()); cardChoice.setMessage("Name a creature card"); while (!controller.choose(Outcome.Detriment, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/theros/XenagosTheReveler.java b/Mage.Sets/src/mage/sets/theros/XenagosTheReveler.java index 276a35b4b4a..0166753702c 100644 --- a/Mage.Sets/src/mage/sets/theros/XenagosTheReveler.java +++ b/Mage.Sets/src/mage/sets/theros/XenagosTheReveler.java @@ -127,7 +127,7 @@ class XenagosManaEffect extends OneShotEffect { for (int i = 0; i < x; i++){ Mana mana = new Mana(); while (!player.choose(Outcome.Benefit, manaChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/timespiral/Hypergenesis.java b/Mage.Sets/src/mage/sets/timespiral/Hypergenesis.java index eb88827dd9e..de7538b305a 100644 --- a/Mage.Sets/src/mage/sets/timespiral/Hypergenesis.java +++ b/Mage.Sets/src/mage/sets/timespiral/Hypergenesis.java @@ -102,15 +102,15 @@ class HypergenesisEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { PlayerList playerList = game.getState().getPlayerList().copy(); - while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) { + while (!playerList.get().equals(source.getControllerId()) && controller.canRespond()) { playerList.getNext(); } Player currentPlayer = game.getPlayer(playerList.get()); UUID firstInactivePlayer = null; Target target = new TargetCardInHand(filter); - while (controller.isInGame()) { - if (currentPlayer != null && currentPlayer.isInGame() && controller.getInRange().contains(currentPlayer.getId())) { + while (controller.canRespond()) { + if (currentPlayer != null && currentPlayer.canRespond() && controller.getInRange().contains(currentPlayer.getId())) { if (firstInactivePlayer == null) { firstInactivePlayer = currentPlayer.getId(); } diff --git a/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java b/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java index e1495a01e1c..7927019a7b4 100644 --- a/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java +++ b/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java @@ -173,7 +173,7 @@ class StuffyDollGainLifeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { UUID playerId = (UUID) game.getState().getValue(source.getSourceId() + "_player"); Player player = game.getPlayer(playerId); - if (player != null && player.isInGame()) { + if (player != null && player.canRespond()) { player.damage((Integer) this.getValue("damageAmount"), source.getSourceId(), game, false, true); } return true; diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/HarmonicConvergence.java b/Mage.Sets/src/mage/sets/urzaslegacy/HarmonicConvergence.java index adc6e71cd4d..cf0f508360b 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/HarmonicConvergence.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/HarmonicConvergence.java @@ -116,7 +116,7 @@ class HarmonicConvergenceEffect extends OneShotEffect { for (Permanent permanent : list) { cards.add(permanent); } - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/RavenFamiliar.java b/Mage.Sets/src/mage/sets/urzaslegacy/RavenFamiliar.java index 4ad677fd27d..6f708fa0d38 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/RavenFamiliar.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/RavenFamiliar.java @@ -124,7 +124,7 @@ public class RavenFamiliar extends CardImpl { } target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java b/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java index 7b6794af6d4..8f6e677c103 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java +++ b/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java @@ -168,7 +168,7 @@ class CarpetOfFlowersEffect extends ManaEffect { ChoiceColor choice = new ChoiceColor(); while (!choice.isChosen()) { controller.choose(Outcome.Protect, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/urzassaga/Persecute.java b/Mage.Sets/src/mage/sets/urzassaga/Persecute.java index 82d8dfe6f55..6f24e8c027e 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/Persecute.java +++ b/Mage.Sets/src/mage/sets/urzassaga/Persecute.java @@ -93,7 +93,7 @@ class PersecuteEffect extends OneShotEffect { ChoiceColor choice = new ChoiceColor(); while (!choice.isChosen()) { controller.choose(outcome, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java b/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java index 87b8ade46eb..541c4a31bb5 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java +++ b/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java @@ -100,7 +100,7 @@ class SmokestackEffect extends OneShotEffect { //A spell or ability could have removed the only legal target this player //had, if thats the case this ability should fizzle. if (target.canChoose(activePlayer.getId(), game)) { - while (!target.isChosen() && target.canChoose(activePlayer.getId(), game) && activePlayer.isInGame()) { + while (!target.isChosen() && target.canChoose(activePlayer.getId(), game) && activePlayer.canRespond()) { activePlayer.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } diff --git a/Mage.Sets/src/mage/sets/urzassaga/Turnabout.java b/Mage.Sets/src/mage/sets/urzassaga/Turnabout.java index f3c1c5a1809..40ea435d881 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/Turnabout.java +++ b/Mage.Sets/src/mage/sets/urzassaga/Turnabout.java @@ -112,7 +112,7 @@ class TurnaboutEffect extends OneShotEffect { choiceImpl.setMessage("Choose card type to tap or untap"); choiceImpl.setChoices(choice); while (!controller.choose(Outcome.Neutral, choiceImpl, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } @@ -131,7 +131,7 @@ class TurnaboutEffect extends OneShotEffect { choiceImpl.setMessage("Choose to tap or untap"); choiceImpl.setChoices(choice2); while (!controller.choose(Outcome.Neutral, choiceImpl, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/vintagemasters/Eureka.java b/Mage.Sets/src/mage/sets/vintagemasters/Eureka.java index 1900a95d1fe..c47f7887e12 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/Eureka.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/Eureka.java @@ -89,18 +89,18 @@ class EurekaEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { PlayerList playerList = game.getState().getPlayerList().copy(); - while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) { + while (!playerList.get().equals(source.getControllerId()) && controller.canRespond()) { playerList.getNext(); } Player currentPlayer = game.getPlayer(playerList.get()); UUID firstInactivePlayer = null; Target target = new TargetCardInHand(new FilterPermanentCard()); - while (controller.isInGame()) { + while (controller.canRespond()) { if (firstInactivePlayer == null) { firstInactivePlayer = currentPlayer.getId(); } - if (currentPlayer != null && currentPlayer.isInGame() && controller.getInRange().contains(currentPlayer.getId())) { + if (currentPlayer != null && currentPlayer.canRespond() && controller.getInRange().contains(currentPlayer.getId())) { target.clearChosen(); if (target.canChoose(source.getSourceId(), currentPlayer.getId(), game) diff --git a/Mage.Sets/src/mage/sets/visions/GoblinRecruiter.java b/Mage.Sets/src/mage/sets/visions/GoblinRecruiter.java index b278362bbc4..b2951b39274 100644 --- a/Mage.Sets/src/mage/sets/visions/GoblinRecruiter.java +++ b/Mage.Sets/src/mage/sets/visions/GoblinRecruiter.java @@ -120,7 +120,7 @@ class GoblinRecruiterEffect extends OneShotEffect { if (numberOfGoblins > 0) { if (cards.size() > 1) { TargetCard targetCard = new TargetCard(Zone.LIBRARY, putOnTopOfLibraryFilter); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Benefit, cards, targetCard, game); Card card = cards.get(targetCard.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/visions/TeferisRealm.java b/Mage.Sets/src/mage/sets/visions/TeferisRealm.java index 9664f0e51d0..170ffe82422 100644 --- a/Mage.Sets/src/mage/sets/visions/TeferisRealm.java +++ b/Mage.Sets/src/mage/sets/visions/TeferisRealm.java @@ -109,7 +109,7 @@ class TeferisRealmEffect extends OneShotEffect { choiceImpl.setMessage("Phase out which kind of permanents?"); choiceImpl.setChoices(choices); while(!player.choose(outcome, choiceImpl, game)) { - if (player.isInGame()) { + if (player.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/weatherlight/Doomsday.java b/Mage.Sets/src/mage/sets/weatherlight/Doomsday.java index 518336e86b3..201d7196b68 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/Doomsday.java +++ b/Mage.Sets/src/mage/sets/weatherlight/Doomsday.java @@ -115,7 +115,7 @@ class DoomsdayEffect extends OneShotEffect { } //Put the chosen cards on top of your library in any order target = new TargetCard(Zone.PICK, new FilterCard("Card to put on top")); - while (cards.size() > 1 && player.isInGame()) { + while (cards.size() > 1 && player.canRespond()) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/zendikar/BraveTheElements.java b/Mage.Sets/src/mage/sets/zendikar/BraveTheElements.java index e5da2306596..caf72def1f8 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BraveTheElements.java +++ b/Mage.Sets/src/mage/sets/zendikar/BraveTheElements.java @@ -106,7 +106,7 @@ class BraveTheElementsChooseColorEffect extends OneShotEffect { ChoiceColor choice = new ChoiceColor(); while (!choice.isChosen()) { controller.choose(outcome, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java b/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java index 35c7d52e50c..b2d00f04395 100644 --- a/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java +++ b/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java @@ -118,7 +118,7 @@ class KabiraEvangelChooseColorEffect extends OneShotEffect { ChoiceColor choice = new ChoiceColor(); while (!choice.isChosen()) { controller.choose(outcome, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage.Sets/src/mage/sets/zendikar/MerfolkWayfinder.java b/Mage.Sets/src/mage/sets/zendikar/MerfolkWayfinder.java index 6ecc9dbbdfe..5232704f31f 100644 --- a/Mage.Sets/src/mage/sets/zendikar/MerfolkWayfinder.java +++ b/Mage.Sets/src/mage/sets/zendikar/MerfolkWayfinder.java @@ -116,7 +116,7 @@ class MerfolkWayfinderEffect extends OneShotEffect { player.revealCards("Merfolk Wayfinder", cardsToReveal, game); TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); - while (player.isInGame() && cards.size() > 1) { + while (player.canRespond() && cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/zendikar/WorldQueller.java b/Mage.Sets/src/mage/sets/zendikar/WorldQueller.java index c1c52dd604c..d85879e1ff7 100644 --- a/Mage.Sets/src/mage/sets/zendikar/WorldQueller.java +++ b/Mage.Sets/src/mage/sets/zendikar/WorldQueller.java @@ -120,7 +120,7 @@ class WorldQuellerEffect extends OneShotEffect { if (you != null && sourceCreature != null) { Choice choiceImpl = new ChoiceImpl(); choiceImpl.setChoices(choice); - while (you.isInGame() && !you.choose(Outcome.Neutral, choiceImpl, game)) {} + while (you.canRespond() && !you.choose(Outcome.Neutral, choiceImpl, game)) {} CardType type = null; String choosenType = choiceImpl.getChoice(); @@ -150,7 +150,7 @@ class WorldQuellerEffect extends OneShotEffect { // you always go first if (target.canChoose(you.getId(), game)) { - while (you.isInGame() && !target.isChosen() && target.canChoose(you.getId(), game)) { + while (you.canRespond() && !target.isChosen() && target.canChoose(you.getId(), game)) { you.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } Permanent permanent = game.getPermanent(target.getFirstTarget()); diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 830c7af2a0c..79a7367c1c0 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -1418,6 +1418,11 @@ public class TestPlayer implements Player { return computerPlayer.isInGame(); } + @Override + public boolean canRespond() { + return computerPlayer.canRespond(); + } + @Override public boolean hasWon() { return computerPlayer.hasWon(); diff --git a/Mage/src/mage/abilities/effects/common/AddManaAnyColorAttachedControllerEffect.java b/Mage/src/mage/abilities/effects/common/AddManaAnyColorAttachedControllerEffect.java index b81fd61aab9..d342c91b0c3 100644 --- a/Mage/src/mage/abilities/effects/common/AddManaAnyColorAttachedControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/AddManaAnyColorAttachedControllerEffect.java @@ -60,7 +60,7 @@ public class AddManaAnyColorAttachedControllerEffect extends ManaEffect { if (player != null) { ChoiceColor choice = new ChoiceColor(); while (!player.choose(outcome, choice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage/src/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java b/Mage/src/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java index 19f56cfeb80..4a87a976677 100644 --- a/Mage/src/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java +++ b/Mage/src/mage/abilities/effects/common/AddManaInAnyCombinationEffect.java @@ -96,7 +96,7 @@ public class AddManaInAnyCombinationEffect extends ManaEffect { Mana mana = new Mana(); int amountOfManaLeft = amount.calculate(game, source, this); - while (amountOfManaLeft > 0 && player.isInGame()) { + while (amountOfManaLeft > 0 && player.canRespond()) { for (ColoredManaSymbol coloredManaSymbol: manaSymbols) { int number = player.getAmount(0, amountOfManaLeft, new StringBuilder("How many ").append(coloredManaSymbol.name()).append(" mana?").toString(), game); if (number > 0) { diff --git a/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java b/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java index 76c84fba229..8f22a961ad7 100644 --- a/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java +++ b/Mage/src/mage/abilities/effects/common/ChooseColorEffect.java @@ -60,7 +60,7 @@ public class ChooseColorEffect extends OneShotEffect { ChoiceColor choice = new ChoiceColor(); while (!choice.isChosen()) { controller.choose(outcome, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java b/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java index 16fe68f4b1d..2ebd99cc9d2 100644 --- a/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java +++ b/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java @@ -63,7 +63,7 @@ public class ChooseCreatureTypeEffect extends OneShotEffect { typeChoice.setMessage("Choose creature type"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!controller.choose(outcome, typeChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage/src/mage/abilities/effects/common/ChooseModeEffect.java b/Mage/src/mage/abilities/effects/common/ChooseModeEffect.java index 83fcbb87039..796f3e7fce7 100644 --- a/Mage/src/mage/abilities/effects/common/ChooseModeEffect.java +++ b/Mage/src/mage/abilities/effects/common/ChooseModeEffect.java @@ -74,7 +74,7 @@ public class ChooseModeEffect extends OneShotEffect { choice.setMessage(choiceMessage); choice.getChoices().addAll(modes); while (!choice.isChosen()) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } controller.choose(Outcome.Neutral, choice, game); diff --git a/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java b/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java index 80df2007eb2..d6f5cf01087 100644 --- a/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java +++ b/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java @@ -148,7 +148,7 @@ public class DynamicManaEffect extends BasicManaEffect { for (int i = 0; i < count; i++) { if (!choiceColor.isChosen()) { while (!controller.choose(Outcome.Benefit, choiceColor, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return computedMana; } } diff --git a/Mage/src/mage/abilities/effects/common/NameACardEffect.java b/Mage/src/mage/abilities/effects/common/NameACardEffect.java index 519969bd13c..0123f9fd6f6 100644 --- a/Mage/src/mage/abilities/effects/common/NameACardEffect.java +++ b/Mage/src/mage/abilities/effects/common/NameACardEffect.java @@ -94,7 +94,7 @@ public class NameACardEffect extends OneShotEffect { } cardChoice.clearChoice(); while (!controller.choose(Outcome.Detriment, cardChoice, game)) { - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java b/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java index 12ca8a7485a..f00f0433c0a 100644 --- a/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java @@ -92,7 +92,7 @@ public class SacrificeAllEffect extends OneShotEffect { int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game)); TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, true); if (target.canChoose(player.getId(), game)) { - while (!target.isChosen() && player.isInGame()) { + while (!target.isChosen() && player.canRespond()) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } perms.addAll(target.getTargets()); diff --git a/Mage/src/mage/abilities/effects/common/SacrificeEffect.java b/Mage/src/mage/abilities/effects/common/SacrificeEffect.java index ad24e45819a..a821c35458e 100644 --- a/Mage/src/mage/abilities/effects/common/SacrificeEffect.java +++ b/Mage/src/mage/abilities/effects/common/SacrificeEffect.java @@ -90,7 +90,7 @@ public class SacrificeEffect extends OneShotEffect{ // A spell or ability could have removed the only legal target this player // had, if thats the case this ability should fizzle. if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) { - while (!target.isChosen() && target.canChoose(player.getId(), game) && player.isInGame()) { + while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) { player.chooseTarget(Outcome.Sacrifice, target, source, game); } diff --git a/Mage/src/mage/abilities/effects/common/continuous/BecomesChosenNonWallCreatureTypeTargetEffect.java b/Mage/src/mage/abilities/effects/common/continuous/BecomesChosenNonWallCreatureTypeTargetEffect.java index 3055295f8fd..316ef45e413 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/BecomesChosenNonWallCreatureTypeTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/BecomesChosenNonWallCreatureTypeTargetEffect.java @@ -40,7 +40,7 @@ public class BecomesChosenNonWallCreatureTypeTargetEffect extends OneShotEffect types.remove("Wall"); typeChoice.setChoices(types); while (!player.choose(Outcome.BoostCreature, typeChoice, game)) { - if (!player.isInGame()) { + if (!player.canRespond()) { return false; } } diff --git a/Mage/src/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java b/Mage/src/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java index 87393154748..dcdbe3ef9f2 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/BecomesColorOrColorsTargetEffect.java @@ -78,7 +78,7 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect { } ChoiceColor choiceColor = new ChoiceColor(); controller.choose(Outcome.Benefit, choiceColor, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } if (!game.isSimulation()) diff --git a/Mage/src/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java b/Mage/src/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java index e7205a7b5bf..89f5c58ad6d 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/BecomesColorSourceEffect.java @@ -80,7 +80,7 @@ public class BecomesColorSourceEffect extends ContinuousEffectImpl { ChoiceColor choice = new ChoiceColor(); while(!choice.isChosen()) { controller.choose(Outcome.PutManaInPool, choice, game); - if(!controller.isInGame()) { + if(!controller.canRespond()) { return; } } diff --git a/Mage/src/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java b/Mage/src/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java index 975beaa6e71..f1d1369cdb8 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/BecomesColorTargetEffect.java @@ -83,7 +83,7 @@ public class BecomesColorTargetEffect extends ContinuousEffectImpl { ChoiceColor choice = new ChoiceColor(); while (!choice.isChosen()) { controller.choose(Outcome.PutManaInPool, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return; } } diff --git a/Mage/src/mage/abilities/effects/common/continuous/GainProtectionFromColorSourceEffect.java b/Mage/src/mage/abilities/effects/common/continuous/GainProtectionFromColorSourceEffect.java index 656c7b23fce..1dc0ffe2002 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/GainProtectionFromColorSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/GainProtectionFromColorSourceEffect.java @@ -72,7 +72,7 @@ public class GainProtectionFromColorSourceEffect extends GainAbilitySourceEffect colorChoice.setMessage("Choose color for protection ability"); while (!colorChoice.isChosen()) { controller.choose(outcome, colorChoice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { discard(); return; } diff --git a/Mage/src/mage/abilities/effects/common/continuous/GainProtectionFromColorTargetEffect.java b/Mage/src/mage/abilities/effects/common/continuous/GainProtectionFromColorTargetEffect.java index a6af9b8dcc6..c54a6b44217 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/GainProtectionFromColorTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/GainProtectionFromColorTargetEffect.java @@ -73,7 +73,7 @@ public class GainProtectionFromColorTargetEffect extends GainAbilityTargetEffect choice.clearChoice(); while (!choice.isChosen()) { controller.choose(Outcome.Protect, choice, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return; } } diff --git a/Mage/src/mage/abilities/effects/keyword/FatesealEffect.java b/Mage/src/mage/abilities/effects/keyword/FatesealEffect.java index beb7165fb05..4d19f86b4f4 100644 --- a/Mage/src/mage/abilities/effects/keyword/FatesealEffect.java +++ b/Mage/src/mage/abilities/effects/keyword/FatesealEffect.java @@ -90,7 +90,7 @@ public class FatesealEffect extends OneShotEffect { target1.setRequired(false); // move cards to the bottom of the library while (cards.size() > 0 && controller.choose(Outcome.Detriment, cards, target1, game)) { - if (!controller.isInGame() || !opponent.isInGame()) { + if (!controller.canRespond() || !opponent.canRespond()) { return false; } Card card = cards.get(target1.getFirstTarget(), game); diff --git a/Mage/src/mage/abilities/effects/keyword/ScryEffect.java b/Mage/src/mage/abilities/effects/keyword/ScryEffect.java index 2bcb26468aa..0fc7e4ad760 100644 --- a/Mage/src/mage/abilities/effects/keyword/ScryEffect.java +++ b/Mage/src/mage/abilities/effects/keyword/ScryEffect.java @@ -81,7 +81,7 @@ public class ScryEffect extends OneShotEffect { TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1); target1.setRequired(false); // move cards to the bottom of the library - while (player.isInGame() && cards.size() > 0 && player.choose(Outcome.Detriment, cards, target1, game)) { + while (player.canRespond() && cards.size() > 0 && player.choose(Outcome.Detriment, cards, target1, game)) { Card card = cards.get(target1.getFirstTarget(), game); if (card != null) { cards.remove(card); diff --git a/Mage/src/mage/abilities/keyword/AnnihilatorAbility.java b/Mage/src/mage/abilities/keyword/AnnihilatorAbility.java index 548d64cd76c..ae721fa50cf 100644 --- a/Mage/src/mage/abilities/keyword/AnnihilatorAbility.java +++ b/Mage/src/mage/abilities/keyword/AnnihilatorAbility.java @@ -127,7 +127,7 @@ class AnnihilatorEffect extends OneShotEffect { int amount = Math.min(count, game.getBattlefield().countAll(filter, player.getId(), game)); Target target = new TargetControlledPermanent(amount, amount, filter, false); if (target.canChoose(player.getId(), game)) { - while (!target.isChosen() && target.canChoose(player.getId(), game) && player.isInGame()) { + while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) { player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); } for (int idx = 0; idx < target.getTargets().size(); idx++) { diff --git a/Mage/src/mage/abilities/keyword/ConvokeAbility.java b/Mage/src/mage/abilities/keyword/ConvokeAbility.java index ef920d57d42..aac3ab7ab74 100644 --- a/Mage/src/mage/abilities/keyword/ConvokeAbility.java +++ b/Mage/src/mage/abilities/keyword/ConvokeAbility.java @@ -214,7 +214,7 @@ class ConvokeEffect extends OneShotEffect { chooseManaType.setMessage("Choose mana color to reduce from " + perm.getName()); while (!chooseManaType.isChosen()) { controller.choose(Outcome.Benefit, chooseManaType, game); - if (!controller.isInGame()) { + if (!controller.canRespond()) { return false; } } diff --git a/Mage/src/mage/abilities/keyword/KickerAbility.java b/Mage/src/mage/abilities/keyword/KickerAbility.java index 9056b7bc2e1..9318c39e039 100644 --- a/Mage/src/mage/abilities/keyword/KickerAbility.java +++ b/Mage/src/mage/abilities/keyword/KickerAbility.java @@ -209,7 +209,7 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo this.resetKicker(game, ability); for (OptionalAdditionalCost kickerCost : kickerCosts) { boolean again = true; - while (player.isInGame() && again) { + while (player.canRespond() && again) { String times = ""; if (kickerCost.isRepeatable()) { int activatedCount = getKickedCounter(game, ability); diff --git a/Mage/src/mage/abilities/keyword/ReplicateAbility.java b/Mage/src/mage/abilities/keyword/ReplicateAbility.java index 4607b39af1d..8be57a3997e 100644 --- a/Mage/src/mage/abilities/keyword/ReplicateAbility.java +++ b/Mage/src/mage/abilities/keyword/ReplicateAbility.java @@ -113,7 +113,7 @@ public class ReplicateAbility extends StaticAbility implements OptionalAdditiona this.resetReplicate(); boolean again = true; - while (player.isInGame() && again) { + while (player.canRespond() && again) { String times = ""; if (additionalCost.isRepeatable()) { int numActivations = additionalCost.getActivateCount(); diff --git a/Mage/src/mage/abilities/keyword/RippleAbility.java b/Mage/src/mage/abilities/keyword/RippleAbility.java index 3b2735906be..ad404d5e871 100644 --- a/Mage/src/mage/abilities/keyword/RippleAbility.java +++ b/Mage/src/mage/abilities/keyword/RippleAbility.java @@ -106,7 +106,7 @@ class RippleEffect extends OneShotEffect { target1.setRequired(false); // choose cards to play for free - while (player.isInGame() && cards.count(sameNameFilter, game) > 0 && player.choose(Outcome.PlayForFree, cards, target1, game)) { + while (player.canRespond() && cards.count(sameNameFilter, game) > 0 && player.choose(Outcome.PlayForFree, cards, target1, game)) { Card card = cards.get(target1.getFirstTarget(), game); if (card != null) { player.cast(card.getSpellAbility(), game, true); diff --git a/Mage/src/mage/game/GameImpl.java b/Mage/src/mage/game/GameImpl.java index f3a878d2206..e4c858c6d45 100644 --- a/Mage/src/mage/game/GameImpl.java +++ b/Mage/src/mage/game/GameImpl.java @@ -733,7 +733,7 @@ public abstract class GameImpl implements Game, Serializable { GameEvent event = new GameEvent(GameEvent.EventType.PLAY_TURN, null, null, extraTurn.getPlayerId()); if (!replaceEvent(event)) { Player extraPlayer = this.getPlayer(extraTurn.getPlayerId()); - if (extraPlayer != null && extraPlayer.isInGame()) { + if (extraPlayer != null && extraPlayer.canRespond()) { state.setExtraTurn(true); state.setTurnId(extraTurn.getId()); if (!this.isSimulation()) { @@ -1176,7 +1176,7 @@ public abstract class GameImpl implements Game, Serializable { } player = getPlayer(state.getPlayerList().get()); state.setPriorityPlayerId(player.getId()); - while (!player.isPassed() && player.isInGame() && !isPaused() && !gameOver(null)) { + while (!player.isPassed() && player.canRespond() && !isPaused() && !gameOver(null)) { if (!resuming) { // 603.3. Once an ability has triggered, its controller puts it on the stack as an object thatÂ’s not a card the next time a player would receive priority checkStateAndTriggered(); @@ -1270,7 +1270,7 @@ public abstract class GameImpl implements Game, Serializable { protected boolean allPassed() { for (Player player : state.getPlayers().values()) { - if (!player.isPassed() && player.isInGame()) { + if (!player.isPassed() && player.canRespond()) { return false; } } diff --git a/Mage/src/mage/game/combat/Combat.java b/Mage/src/mage/game/combat/Combat.java index 1ed22dcf96c..8474758049c 100644 --- a/Mage/src/mage/game/combat/Combat.java +++ b/Mage/src/mage/game/combat/Combat.java @@ -236,7 +236,7 @@ public class Combat implements Serializable, Copyable { if (!game.getPlayer(game.getActivePlayerId()).getAvailableAttackers(game).isEmpty()) { player.selectAttackers(game, attackerId); } - if (game.isPaused() || game.gameOver(null)) { + if (game.isPaused() || game.gameOver(null) || game.executingRollback()) { return; } // because of possible undo during declare attackers it's neccassary to call here the methods with "game.getCombat()." to get the valid combat object!!! @@ -393,7 +393,7 @@ public class Combat implements Serializable, Copyable { } while (choose) { controller.selectBlockers(game, defenderId); - if (game.isPaused() || game.gameOver(null)) { + if (game.isPaused() || game.gameOver(null) || game.executingRollback()) { return; } if (!this.checkBlockRestrictions(defender, game)) { diff --git a/Mage/src/mage/game/combat/CombatGroup.java b/Mage/src/mage/game/combat/CombatGroup.java index 1c50ff3d1b0..e7cf83c8a75 100644 --- a/Mage/src/mage/game/combat/CombatGroup.java +++ b/Mage/src/mage/game/combat/CombatGroup.java @@ -434,7 +434,7 @@ public class CombatGroup implements Serializable, Copyable { Player player = game.getPlayer(playerId); List blockerList = new ArrayList<>(blockers); blockerOrder.clear(); - while (true && player.isInGame()) { + while (true && player.canRespond()) { if (blockerList.size() == 1) { blockerOrder.add(blockerList.get(0)); break; diff --git a/Mage/src/mage/game/stack/StackObjImpl.java b/Mage/src/mage/game/stack/StackObjImpl.java index c2a725153ad..8ca3c7a6be5 100644 --- a/Mage/src/mage/game/stack/StackObjImpl.java +++ b/Mage/src/mage/game/stack/StackObjImpl.java @@ -182,7 +182,7 @@ public abstract class StackObjImpl implements StackObject { newTarget.clearChosen(); } } - } while (targetController.isInGame() && (targetId.equals(newTarget.getFirstTarget()) || newTarget.getTargets().size() != 1)); + } while (targetController.canRespond() && (targetId.equals(newTarget.getFirstTarget()) || newTarget.getTargets().size() != 1)); // choose a new target } else { // build a target definition with exactly one possible target to select that replaces old target @@ -235,7 +235,7 @@ public abstract class StackObjImpl implements StackObject { newTarget.addTarget(tempTarget.getFirstTarget(), target.getTargetAmount(targetId), ability, game, false); } } - } while (again && targetController.isInGame()); + } while (again && targetController.canRespond()); } } // keep the target else { diff --git a/Mage/src/mage/game/turn/DeclareBlockersStep.java b/Mage/src/mage/game/turn/DeclareBlockersStep.java index 6343853aa58..02b6d804089 100644 --- a/Mage/src/mage/game/turn/DeclareBlockersStep.java +++ b/Mage/src/mage/game/turn/DeclareBlockersStep.java @@ -25,15 +25,13 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.game.turn; +import java.util.UUID; import mage.constants.PhaseStep; import mage.game.Game; import mage.game.events.GameEvent.EventType; -import java.util.UUID; - /** * * @author BetaSteward_at_googlemail.com @@ -63,7 +61,7 @@ public class DeclareBlockersStep extends Step { public void beginStep(Game game, UUID activePlayerId) { super.beginStep(game, activePlayerId); game.getCombat().selectBlockers(game); - if (!game.isPaused()) { + if (!game.isPaused() && !game.executingRollback()) { game.getCombat().acceptBlockers(game); game.getCombat().damageAssignmentOrder(game); } diff --git a/Mage/src/mage/game/turn/Phase.java b/Mage/src/mage/game/turn/Phase.java index eac4f2308bb..a474976eaae 100644 --- a/Mage/src/mage/game/turn/Phase.java +++ b/Mage/src/mage/game/turn/Phase.java @@ -163,6 +163,9 @@ public abstract class Phase implements Serializable { currentStep = step; if (!game.getState().getTurnMods().skipStep(activePlayerId, currentStep.getType())) { playStep(game); + if (game.executingRollback()) { + return true; + } } } @@ -203,13 +206,13 @@ public abstract class Phase implements Serializable { if (!currentStep.skipStep(game, activePlayerId)) { game.getState().increaseStepNum(); prePriority(game, activePlayerId); - if (!game.isPaused() && !game.gameOver(null)) { + if (!game.isPaused() && !game.gameOver(null) && !game.executingRollback()) { currentStep.priority(game, activePlayerId, false); if (game.executingRollback()) { return; } } - if (!game.isPaused() && !game.gameOver(null)) { + if (!game.isPaused() && !game.gameOver(null) && !game.executingRollback()) { postPriority(game, activePlayerId); } } diff --git a/Mage/src/mage/players/Player.java b/Mage/src/mage/players/Player.java index 60ea5a123af..023d63e04ca 100644 --- a/Mage/src/mage/players/Player.java +++ b/Mage/src/mage/players/Player.java @@ -214,6 +214,14 @@ public interface Player extends MageItem, Copyable { */ boolean isInGame(); + /** + * Player is still active in game (has not left, lost or won the game) and + * no abort state is given. + * + * @return + */ + boolean canRespond(); + /** * Called if other player left the game * diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 2f92485f6ab..fc0e8c1a280 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -1399,7 +1399,7 @@ public abstract class PlayerImpl implements Player, Serializable { filter.add(Predicates.not(new PermanentIdPredicate(permanent.getId()))); } // while targets left and there is still allowed to untap - while (isInGame() && leftForUntap.size() > 0 && numberToUntap > 0) { + while (canRespond() && leftForUntap.size() > 0 && numberToUntap > 0) { // player has to select the permanent he wants to untap for this restriction Ability ability = handledEntry.getKey().getValue().iterator().next(); if (ability != null) { @@ -1449,7 +1449,7 @@ public abstract class PlayerImpl implements Player, Serializable { } } - } while (isInGame() && playerCanceledSelection); + } while (canRespond() && playerCanceledSelection); if (!game.isSimulation()) { // show in log which permanents were selected to untap @@ -2017,6 +2017,11 @@ public abstract class PlayerImpl implements Player, Serializable { return !hasQuit() && !hasLost() && !hasWon() && !hasLeft(); } + @Override + public boolean canRespond() { // abort is checked here to get out of player requests + return !hasQuit() && !hasLost() && !hasWon() && !hasLeft() && !abort; + } + @Override public boolean hasWon() { if (!this.loses) { @@ -3014,7 +3019,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (chooseOrder) { TargetCard target = new TargetCard(fromZone, new FilterCard("card to put on the top of your graveyard (last one chosen will be topmost)")); target.setRequired(true); - while (choosingPlayer.isInGame() && cards.size() > 1) { + while (choosingPlayer.canRespond() && cards.size() > 1) { choosingPlayer.chooseTarget(Outcome.Neutral, cards, target, source, game); UUID targetObjectId = target.getFirstTarget(); Card card = cards.get(targetObjectId, game);