ChooseName now uses ICardFaces for selecting a CardName.

that now makes it working for naming an alternate state of a card.
This commit is contained in:
Hanmac
2016-08-18 08:29:11 +00:00
parent 157c20a82b
commit b65a16acf2
8 changed files with 463 additions and 350 deletions

View File

@@ -22,6 +22,7 @@ import forge.ai.ability.ChangeZoneAi;
import forge.ai.ability.DrawAi;
import forge.ai.ability.GameWinAi;
import forge.card.ColorSet;
import forge.card.ICardFace;
import forge.card.MagicColor;
import forge.card.mana.ManaCost;
import forge.card.mana.ManaCostShard;
@@ -82,117 +83,117 @@ import forge.util.MyRandom;
* Test cases that need to override the default behaviour of this class should make sure to do so in a way that does not invalidate their correctness.
*/
public class PlayerControllerForTests extends PlayerController {
private PlayerActions playerActions;
private PlayerActions playerActions;
public PlayerControllerForTests(Game game, Player player, LobbyPlayer lobbyPlayer) {
super(game, player, lobbyPlayer);
}
public PlayerControllerForTests(Game game, Player player, LobbyPlayer lobbyPlayer) {
super(game, player, lobbyPlayer);
}
public void setPlayerActions(PlayerActions playerActions) {
this.playerActions = playerActions;
}
public void setPlayerActions(PlayerActions playerActions) {
this.playerActions = playerActions;
}
public PlayerActions getPlayerActions() {
return playerActions;
}
public PlayerActions getPlayerActions() {
return playerActions;
}
public Player getPlayer() {
return player;
}
public Player getPlayer() {
return player;
}
public Game getGame() {
return game;
}
public Game getGame() {
return game;
}
@Override
public void playSpellAbilityForFree(SpellAbility copySA, boolean mayChoseNewTargets) {
throw new IllegalStateException("Callers of this method currently assume that it performs extra functionality!");
}
@Override
public void playSpellAbilityForFree(SpellAbility copySA, boolean mayChoseNewTargets) {
throw new IllegalStateException("Callers of this method currently assume that it performs extra functionality!");
}
@Override
public void playSpellAbilityNoStack(SpellAbility effectSA, boolean mayChoseNewTargets) {
//TODO: eventually (when the real code is refactored) this should be handled normally...
if (effectSA.getDescription().equals("At the beginning of your upkeep, if you have exactly 1 life, you win the game.")) {//test_104_2b_effect_may_state_that_player_wins_the_game
HumanPlay.playSpellAbilityNoStack(null, player, effectSA, !mayChoseNewTargets);
return;
}
SpellAbilityAi sai = SpellApiToAi.Converter.get(effectSA.getApi());
if (
(effectSA.getHostCard().getName().equals("Nefarious Lich") && sai instanceof DrawAi) ||
(effectSA.getHostCard().getName().equals("Laboratory Maniac") && sai instanceof GameWinAi) ||
(effectSA.getHostCard().getName().equals("Nefarious Lich") && sai instanceof ChangeZoneAi)
) {//test_104_3f_if_a_player_would_win_and_lose_simultaneously_he_loses
HumanPlay.playSpellAbilityNoStack(null, player, effectSA, !mayChoseNewTargets);
return;
}
throw new IllegalStateException("Callers of this method currently assume that it performs extra functionality!");
}
@Override
public void playSpellAbilityNoStack(SpellAbility effectSA, boolean mayChoseNewTargets) {
//TODO: eventually (when the real code is refactored) this should be handled normally...
if (effectSA.getDescription().equals("At the beginning of your upkeep, if you have exactly 1 life, you win the game.")) {//test_104_2b_effect_may_state_that_player_wins_the_game
HumanPlay.playSpellAbilityNoStack(null, player, effectSA, !mayChoseNewTargets);
return;
}
SpellAbilityAi sai = SpellApiToAi.Converter.get(effectSA.getApi());
if (
(effectSA.getHostCard().getName().equals("Nefarious Lich") && sai instanceof DrawAi) ||
(effectSA.getHostCard().getName().equals("Laboratory Maniac") && sai instanceof GameWinAi) ||
(effectSA.getHostCard().getName().equals("Nefarious Lich") && sai instanceof ChangeZoneAi)
) {//test_104_3f_if_a_player_would_win_and_lose_simultaneously_he_loses
HumanPlay.playSpellAbilityNoStack(null, player, effectSA, !mayChoseNewTargets);
return;
}
throw new IllegalStateException("Callers of this method currently assume that it performs extra functionality!");
}
@Override
public List<PaperCard> sideboard(Deck deck, GameType gameType) {
return null; // refused to side
}
@Override
public List<PaperCard> sideboard(Deck deck, GameType gameType) {
return null; // refused to side
}
@Override
public Map<Card, Integer> assignCombatDamage(Card attacker, CardCollectionView blockers, int damageDealt, GameEntity defender, boolean overrideOrder) {
if (blockers.size() == 1 && damageDealt == 2 && (
(attacker.getName().equals("Grizzly Bears") && blockers.get(0).getName().equals("Ajani's Sunstriker")) ||
(attacker.getName().equals("Ajani's Sunstriker") && blockers.get(0).getName().equals("Grizzly Bears"))
)) {//test_104_3b_player_with_less_than_zero_life_loses_the_game_only_when_a_player_receives_priority_variant_with_combat
Map<Card, Integer> result = new HashMap<Card, Integer>();
result.put(blockers.get(0), damageDealt);
return result;
}
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public Map<Card, Integer> assignCombatDamage(Card attacker, CardCollectionView blockers, int damageDealt, GameEntity defender, boolean overrideOrder) {
if (blockers.size() == 1 && damageDealt == 2 && (
(attacker.getName().equals("Grizzly Bears") && blockers.get(0).getName().equals("Ajani's Sunstriker")) ||
(attacker.getName().equals("Ajani's Sunstriker") && blockers.get(0).getName().equals("Grizzly Bears"))
)) {//test_104_3b_player_with_less_than_zero_life_loses_the_game_only_when_a_player_receives_priority_variant_with_combat
Map<Card, Integer> result = new HashMap<Card, Integer>();
result.put(blockers.get(0), damageDealt);
return result;
}
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public Integer announceRequirements(SpellAbility ability, String announce, boolean allowZero) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public Integer announceRequirements(SpellAbility ability, String announce, boolean allowZero) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public CardCollectionView choosePermanentsToSacrifice(SpellAbility sa, int min, int max, CardCollectionView validTargets, String message) {
return chooseItems(validTargets, min);
}
@Override
public CardCollectionView choosePermanentsToSacrifice(SpellAbility sa, int min, int max, CardCollectionView validTargets, String message) {
return chooseItems(validTargets, min);
}
@Override
public CardCollectionView choosePermanentsToDestroy(SpellAbility sa, int min, int max, CardCollectionView validTargets, String message) {
return chooseItems(validTargets, min);
}
@Override
public CardCollectionView choosePermanentsToDestroy(SpellAbility sa, int min, int max, CardCollectionView validTargets, String message) {
return chooseItems(validTargets, min);
}
@Override
public TargetChoices chooseNewTargetsFor(SpellAbility ability) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public TargetChoices chooseNewTargetsFor(SpellAbility ability) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public Pair<SpellAbilityStackInstance, GameObject> chooseTarget(SpellAbility sa, List<Pair<SpellAbilityStackInstance, GameObject>> allTargets) {
return chooseItem(allTargets);
}
@Override
public Pair<SpellAbilityStackInstance, GameObject> chooseTarget(SpellAbility sa, List<Pair<SpellAbilityStackInstance, GameObject>> allTargets) {
return chooseItem(allTargets);
}
@Override
public CardCollectionView chooseCardsForEffect(CardCollectionView sourceList, SpellAbility sa, String title, int min, int max, boolean isOptional) {
return chooseItems(sourceList, max);
}
@Override
public CardCollectionView chooseCardsForEffect(CardCollectionView sourceList, SpellAbility sa, String title, int min, int max, boolean isOptional) {
return chooseItems(sourceList, max);
}
@Override
public <T extends GameEntity> T chooseSingleEntityForEffect(FCollectionView<T> optionList, DelayedReveal delayedReveal, SpellAbility sa, String title, boolean isOptional, Player targetedPlayer) {
@Override
public <T extends GameEntity> T chooseSingleEntityForEffect(FCollectionView<T> optionList, DelayedReveal delayedReveal, SpellAbility sa, String title, boolean isOptional, Player targetedPlayer) {
if (delayedReveal != null) {
reveal(delayedReveal.getCards(), delayedReveal.getZone(), delayedReveal.getOwner(), delayedReveal.getMessagePrefix());
}
return chooseItem(optionList);
}
return chooseItem(optionList);
}
@Override
public SpellAbility chooseSingleSpellForEffect(List<SpellAbility> spells, SpellAbility sa, String title) {
return chooseItem(spells);
}
@Override
public SpellAbility chooseSingleSpellForEffect(List<SpellAbility> spells, SpellAbility sa, String title) {
return chooseItem(spells);
}
@Override
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message) {
return true;
}
@Override
public boolean confirmAction(SpellAbility sa, PlayerActionConfirmMode mode, String message) {
return true;
}
@Override
public boolean confirmBidAction(SpellAbility sa,
@@ -200,12 +201,12 @@ public class PlayerControllerForTests extends PlayerController {
return false;
}
@Override
public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) {
return true;
}
@Override
public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) {
return true;
}
@Override
@Override
public boolean confirmTrigger(SpellAbility sa, Trigger regtrig, Map<String, String> triggerParams, boolean isMandatory) {
return true;
}
@@ -215,244 +216,244 @@ public class PlayerControllerForTests extends PlayerController {
return this.player;
}
@Override
public CardCollection orderBlockers(Card attacker, CardCollection blockers) {
return blockers;
}
@Override
public CardCollection orderBlockers(Card attacker, CardCollection blockers) {
return blockers;
}
@Override
public CardCollection orderBlocker(final Card attacker, final Card blocker, final CardCollection oldBlockers) {
final CardCollection allBlockers = new CardCollection(oldBlockers);
allBlockers.add(blocker);
return allBlockers;
}
@Override
public CardCollection orderBlocker(final Card attacker, final Card blocker, final CardCollection oldBlockers) {
final CardCollection allBlockers = new CardCollection(oldBlockers);
allBlockers.add(blocker);
return allBlockers;
}
@Override
public CardCollection orderAttackers(Card blocker, CardCollection attackers) {
return attackers;
}
@Override
public CardCollection orderAttackers(Card blocker, CardCollection attackers) {
return attackers;
}
@Override
public void reveal(CardCollectionView cards, ZoneType zone, Player owner, String messagePrefix) {
//nothing needs to be done here
}
@Override
public void reveal(CardCollectionView cards, ZoneType zone, Player owner, String messagePrefix) {
//nothing needs to be done here
}
@Override
public void reveal(List<CardView> cards, ZoneType zone, PlayerView owner, String messagePrefix) {
//nothing needs to be done here
}
@Override
public void reveal(List<CardView> cards, ZoneType zone, PlayerView owner, String messagePrefix) {
//nothing needs to be done here
}
@Override
public void notifyOfValue(SpellAbility saSource, GameObject realtedTarget, String value) {
//nothing needs to be done here
}
@Override
public void notifyOfValue(SpellAbility saSource, GameObject realtedTarget, String value) {
//nothing needs to be done here
}
@Override
public ImmutablePair<CardCollection, CardCollection> arrangeForScry(CardCollection topN) {
return ImmutablePair.of(topN, null);
}
@Override
public ImmutablePair<CardCollection, CardCollection> arrangeForScry(CardCollection topN) {
return ImmutablePair.of(topN, null);
}
@Override
public boolean willPutCardOnTop(Card c) {
return false;
}
@Override
public boolean willPutCardOnTop(Card c) {
return false;
}
@Override
public CardCollectionView orderMoveToZoneList(CardCollectionView cards, ZoneType destinationZone) {
return cards;
}
@Override
public CardCollectionView orderMoveToZoneList(CardCollectionView cards, ZoneType destinationZone) {
return cards;
}
@Override
public CardCollection chooseCardsToDiscardFrom(Player playerDiscard, SpellAbility sa, CardCollection validCards, int min, int max) {
return chooseItems(validCards, min);
}
@Override
public CardCollection chooseCardsToDiscardFrom(Player playerDiscard, SpellAbility sa, CardCollection validCards, int min, int max) {
return chooseItems(validCards, min);
}
@Override
public void playMiracle(SpellAbility miracle, Card card) {
throw new IllegalStateException("Callers of this method currently assume that it performs extra functionality!");
}
@Override
public void playMiracle(SpellAbility miracle, Card card) {
throw new IllegalStateException("Callers of this method currently assume that it performs extra functionality!");
}
@Override
public CardCollectionView chooseCardsToDelve(int genericAmount, CardCollection grave) {
return CardCollection.EMPTY;
}
@Override
public CardCollectionView chooseCardsToDelve(int genericAmount, CardCollection grave) {
return CardCollection.EMPTY;
}
@Override
public CardCollectionView chooseCardsToRevealFromHand(int min, int max, CardCollectionView valid) {
return chooseItems(valid, min);
}
@Override
public CardCollectionView chooseCardsToRevealFromHand(int min, int max, CardCollectionView valid) {
return chooseItems(valid, min);
}
@Override
public CardCollectionView chooseCardsToDiscardUnlessType(int min, CardCollectionView hand, String param, SpellAbility sa) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public CardCollectionView chooseCardsToDiscardUnlessType(int min, CardCollectionView hand, String param, SpellAbility sa) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public List<SpellAbility> chooseSaToActivateFromOpeningHand(List<SpellAbility> usableFromOpeningHand) {
return usableFromOpeningHand;
}
@Override
public List<SpellAbility> chooseSaToActivateFromOpeningHand(List<SpellAbility> usableFromOpeningHand) {
return usableFromOpeningHand;
}
@Override
public Mana chooseManaFromPool(List<Mana> manaChoices) {
return chooseItem(manaChoices);
}
@Override
public Mana chooseManaFromPool(List<Mana> manaChoices) {
return chooseItem(manaChoices);
}
@Override
public Pair<CounterType, String> chooseAndRemoveOrPutCounter(Card cardWithCounter) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public Pair<CounterType, String> chooseAndRemoveOrPutCounter(Card cardWithCounter) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, String question) {
return true;
}
@Override
public boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, String question) {
return true;
}
@Override
public CardCollectionView getCardsToMulligan(Player firstPlayer) {
return null;
}
@Override
public CardCollectionView getCardsToMulligan(Player firstPlayer) {
return null;
}
@Override
public void declareAttackers(Player attacker, Combat combat) {
//Doing nothing is safe in most cases, but not all (creatures that must attack etc). TODO: introduce checks?
if (playerActions == null) {
return;
}
DeclareAttackersAction declareAttackers = playerActions.getNextActionIfApplicable(player, game, DeclareAttackersAction.class);
if (declareAttackers == null) {
return;
}
@Override
public void declareAttackers(Player attacker, Combat combat) {
//Doing nothing is safe in most cases, but not all (creatures that must attack etc). TODO: introduce checks?
if (playerActions == null) {
return;
}
DeclareAttackersAction declareAttackers = playerActions.getNextActionIfApplicable(player, game, DeclareAttackersAction.class);
if (declareAttackers == null) {
return;
}
//TODO: check that the chosen attack configuration is legal? (Including creatures that did not attack but should)
//TODO: check that the chosen attack configuration was a complete match to what was requested?
//TODO: banding (don't really care at the moment...)
//TODO: check that the chosen attack configuration is legal? (Including creatures that did not attack but should)
//TODO: check that the chosen attack configuration was a complete match to what was requested?
//TODO: banding (don't really care at the moment...)
for (Map.Entry<CardSpecification, PlayerSpecification> playerAttackAssignment : declareAttackers.getPlayerAttackAssignments().entrySet()) {
Player defender = getPlayerBeingAttacked(game, player, playerAttackAssignment.getValue());
attack(combat, playerAttackAssignment.getKey(), defender);
}
for (Map.Entry<CardSpecification, CardSpecification> planeswalkerAttackAssignment: declareAttackers.getPlaneswalkerAttackAssignments().entrySet()) {
Card defender = CardSpecificationHandler.INSTANCE.find(game.getCardsInGame(), planeswalkerAttackAssignment.getKey());
attack(combat, planeswalkerAttackAssignment.getKey(), defender);
}
for (Map.Entry<CardSpecification, PlayerSpecification> playerAttackAssignment : declareAttackers.getPlayerAttackAssignments().entrySet()) {
Player defender = getPlayerBeingAttacked(game, player, playerAttackAssignment.getValue());
attack(combat, playerAttackAssignment.getKey(), defender);
}
for (Map.Entry<CardSpecification, CardSpecification> planeswalkerAttackAssignment: declareAttackers.getPlaneswalkerAttackAssignments().entrySet()) {
Card defender = CardSpecificationHandler.INSTANCE.find(game.getCardsInGame(), planeswalkerAttackAssignment.getKey());
attack(combat, planeswalkerAttackAssignment.getKey(), defender);
}
if (!CombatUtil.validateAttackers(combat)) {
throw new IllegalStateException("Illegal attack declaration!");
}
}
if (!CombatUtil.validateAttackers(combat)) {
throw new IllegalStateException("Illegal attack declaration!");
}
}
private Player getPlayerBeingAttacked(Game game, Player attacker, PlayerSpecification defenderSpecification) {
if (defenderSpecification != null) {
return PlayerSpecificationHandler.INSTANCE.find(game.getPlayers(), defenderSpecification);
}
if (game.getPlayers().size() != 2) {
throw new IllegalStateException("Can't use implicit defender specification in this situation!");
}
for (Player player : game.getPlayers()) {
if (!attacker.equals(player)) {
return player;
}
}
throw new IllegalStateException("Couldn't find implicit defender!");
}
private Player getPlayerBeingAttacked(Game game, Player attacker, PlayerSpecification defenderSpecification) {
if (defenderSpecification != null) {
return PlayerSpecificationHandler.INSTANCE.find(game.getPlayers(), defenderSpecification);
}
if (game.getPlayers().size() != 2) {
throw new IllegalStateException("Can't use implicit defender specification in this situation!");
}
for (Player player : game.getPlayers()) {
if (!attacker.equals(player)) {
return player;
}
}
throw new IllegalStateException("Couldn't find implicit defender!");
}
private void attack(Combat combat, CardSpecification attackerSpecification, GameEntity defender) {
Card attacker = CardSpecificationHandler.INSTANCE.find(combat.getAttackingPlayer().getCreaturesInPlay(), attackerSpecification);
if (!CombatUtil.canAttack(attacker, defender)) {
throw new IllegalStateException(attacker + " can't attack " + defender);
}
combat.addAttacker(attacker, defender);
}
private void attack(Combat combat, CardSpecification attackerSpecification, GameEntity defender) {
Card attacker = CardSpecificationHandler.INSTANCE.find(combat.getAttackingPlayer().getCreaturesInPlay(), attackerSpecification);
if (!CombatUtil.canAttack(attacker, defender)) {
throw new IllegalStateException(attacker + " can't attack " + defender);
}
combat.addAttacker(attacker, defender);
}
@Override
public void declareBlockers(Player defender, Combat combat) {
//Doing nothing is safe in most cases, but not all (creatures that must block, attackers that must be blocked etc). TODO: legality checks?
if (playerActions == null) {
return;
}
DeclareBlockersAction declareBlockers = playerActions.getNextActionIfApplicable(player, game, DeclareBlockersAction.class);
if (declareBlockers == null) {
return;
}
@Override
public void declareBlockers(Player defender, Combat combat) {
//Doing nothing is safe in most cases, but not all (creatures that must block, attackers that must be blocked etc). TODO: legality checks?
if (playerActions == null) {
return;
}
DeclareBlockersAction declareBlockers = playerActions.getNextActionIfApplicable(player, game, DeclareBlockersAction.class);
if (declareBlockers == null) {
return;
}
//TODO: check that the chosen block configuration is 100% legal?
//TODO: check that the chosen block configuration was a 100% match to what was requested?
//TODO: where do damage assignment orders get handled?
//TODO: check that the chosen block configuration is 100% legal?
//TODO: check that the chosen block configuration was a 100% match to what was requested?
//TODO: where do damage assignment orders get handled?
for (Map.Entry<CardSpecification, Collection<CardSpecification>> blockingAssignment : declareBlockers.getBlockingAssignments().asMap().entrySet()) {
Card attacker = CardSpecificationHandler.INSTANCE.find(combat.getAttackers(), blockingAssignment.getKey());
for (CardSpecification blockerSpecification : blockingAssignment.getValue()) {
Card blocker = CardSpecificationHandler.INSTANCE.find(game, blockerSpecification);
if (!CombatUtil.canBlock(attacker, blocker)) {
throw new IllegalStateException(blocker + " can't block " + blocker);
}
combat.addBlocker(attacker, blocker);
}
}
String blockValidation = CombatUtil.validateBlocks(combat, player);
if (blockValidation != null) {
throw new IllegalStateException(blockValidation);
}
}
for (Map.Entry<CardSpecification, Collection<CardSpecification>> blockingAssignment : declareBlockers.getBlockingAssignments().asMap().entrySet()) {
Card attacker = CardSpecificationHandler.INSTANCE.find(combat.getAttackers(), blockingAssignment.getKey());
for (CardSpecification blockerSpecification : blockingAssignment.getValue()) {
Card blocker = CardSpecificationHandler.INSTANCE.find(game, blockerSpecification);
if (!CombatUtil.canBlock(attacker, blocker)) {
throw new IllegalStateException(blocker + " can't block " + blocker);
}
combat.addBlocker(attacker, blocker);
}
}
String blockValidation = CombatUtil.validateBlocks(combat, player);
if (blockValidation != null) {
throw new IllegalStateException(blockValidation);
}
}
@Override
public List<SpellAbility> chooseSpellAbilityToPlay() {
//TODO: This method has to return the spellability chosen by player
// It should not play the sa right from here. The code has been left as it is to quickly adapt to changed playercontroller interface
if (playerActions != null) {
CastSpellFromHandAction castSpellFromHand = playerActions.getNextActionIfApplicable(player, game, CastSpellFromHandAction.class);
if (castSpellFromHand != null) {
castSpellFromHand.castSpellFromHand(player, game);
}
@Override
public List<SpellAbility> chooseSpellAbilityToPlay() {
//TODO: This method has to return the spellability chosen by player
// It should not play the sa right from here. The code has been left as it is to quickly adapt to changed playercontroller interface
if (playerActions != null) {
CastSpellFromHandAction castSpellFromHand = playerActions.getNextActionIfApplicable(player, game, CastSpellFromHandAction.class);
if (castSpellFromHand != null) {
castSpellFromHand.castSpellFromHand(player, game);
}
ActivateAbilityAction activateAbilityAction = playerActions.getNextActionIfApplicable(player, game, ActivateAbilityAction.class);
if (activateAbilityAction != null) {
activateAbilityAction.activateAbility(player, game);
}
}
return null;
}
ActivateAbilityAction activateAbilityAction = playerActions.getNextActionIfApplicable(player, game, ActivateAbilityAction.class);
if (activateAbilityAction != null) {
activateAbilityAction.activateAbility(player, game);
}
}
return null;
}
@Override
public CardCollection chooseCardsToDiscardToMaximumHandSize(int numDiscard) {
return chooseItems(player.getZone(ZoneType.Hand).getCards(), numDiscard);
}
@Override
public CardCollection chooseCardsToDiscardToMaximumHandSize(int numDiscard) {
return chooseItems(player.getZone(ZoneType.Hand).getCards(), numDiscard);
}
@Override
public boolean payManaOptional(Card card, Cost cost, SpellAbility sa, String prompt, ManaPaymentPurpose purpose) {
throw new IllegalStateException("Callers of this method currently assume that it performs extra functionality!");
}
@Override
public boolean payManaOptional(Card card, Cost cost, SpellAbility sa, String prompt, ManaPaymentPurpose purpose) {
throw new IllegalStateException("Callers of this method currently assume that it performs extra functionality!");
}
@Override
public int chooseNumber(SpellAbility sa, String title, int min, int max) {
return min;
}
@Override
public int chooseNumber(SpellAbility sa, String title, int min, int max) {
return min;
}
@Override
public boolean chooseBinary(SpellAbility sa, String question, BinaryChoiceType kindOfChoice, Boolean defaultVal) {
return true;
}
@Override
public boolean chooseBinary(SpellAbility sa, String question, BinaryChoiceType kindOfChoice, Boolean defaultVal) {
return true;
}
@Override
public boolean chooseFlipResult(SpellAbility sa, Player flipper, boolean[] results, boolean call) {
return true;
}
@Override
public boolean chooseFlipResult(SpellAbility sa, Player flipper, boolean[] results, boolean call) {
return true;
}
@Override
public Card chooseProtectionShield(GameEntity entityBeingDamaged, List<String> options, Map<String, Card> choiceMap) {
return choiceMap.get(options.get(0));
}
@Override
public Card chooseProtectionShield(GameEntity entityBeingDamaged, List<String> options, Map<String, Card> choiceMap) {
return choiceMap.get(options.get(0));
}
@Override
public List<AbilitySub> chooseModeForAbility(SpellAbility sa, int min, int num, boolean allowRepeat) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public List<AbilitySub> chooseModeForAbility(SpellAbility sa, int min, int num, boolean allowRepeat) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public byte chooseColor(String message, SpellAbility sa, ColorSet colors) {
return Iterables.getFirst(colors, MagicColor.WHITE);
}
@Override
public byte chooseColor(String message, SpellAbility sa, ColorSet colors) {
return Iterables.getFirst(colors, MagicColor.WHITE);
}
@Override
public byte chooseColorAllowColorless(String message, Card card, ColorSet colors) {
return Iterables.getFirst(colors, (byte)0);
@@ -488,11 +489,6 @@ public class PlayerControllerForTests extends PlayerController {
return chooseItem(options);
}
@Override
public PaperCard chooseSinglePaperCard(SpellAbility sa, String message, Predicate<PaperCard> cpp, String name) {
throw new IllegalStateException("Erring on the side of caution here...");
}
@Override
public List<String> chooseColors(String message, SpellAbility sa, int min, int max, List<String> options) {
throw new UnsupportedOperationException("No idea how a test player controller would choose colors");
@@ -594,10 +590,10 @@ public class PlayerControllerForTests extends PlayerController {
// test this!
}
@Override
public CardShields chooseRegenerationShield(Card c) {
return Iterables.getFirst(c.getShields(), null);
}
@Override
public CardShields chooseRegenerationShield(Card c) {
return Iterables.getFirst(c.getShields(), null);
}
@Override
public List<PaperCard> chooseCardsYouWonToAddToDeck(List<PaperCard> losses) {
@@ -632,13 +628,6 @@ public class PlayerControllerForTests extends PlayerController {
}
@Override
public String chooseCardName(SpellAbility sa, Predicate<PaperCard> cpp,
String valid, String message) {
return null;
}
@Override
public Card chooseSingleCardForZoneChange(ZoneType destination,
List<ZoneType> origin, SpellAbility sa, CardCollection fetchList, DelayedReveal delayedReveal,
@@ -668,4 +657,23 @@ public class PlayerControllerForTests extends PlayerController {
public void cancelAwaitNextInput() {
// Not used by the controller for tests
}
@Override
public ICardFace chooseSingleCardFace(SpellAbility sa, String message, Predicate<ICardFace> cpp, String name) {
// TODO Auto-generated method stub
return null;
}
@Override
public String chooseCardName(SpellAbility sa, Predicate<ICardFace> cpp, String valid, String message) {
// TODO Auto-generated method stub
return null;
}
@Override
public String chooseCardName(SpellAbility sa, List<ICardFace> faces, String message) {
// TODO Auto-generated method stub
return null;
}
}