@Override public boolean choose(Outcome outcome, UUID playerId, UUID sourceId, Game game) { Player player = game.getPlayer(playerId); while (!isChosen() && !doneChosing()) { chosen = targets.size() >= getNumberOfTargets(); if (!player.choose(outcome, this, sourceId, game)) { return chosen; } chosen = targets.size() >= getNumberOfTargets(); } return chosen = true; }
public boolean choose(Game game, Ability source) { if (this.size() > 0) { Player player = game.getPlayer(source.getControllerId()); while (!isChosen()) { Choice choice = this.getUnchosen().get(0); if (!player.choose(outcome, choice, game)) { return false; } } } return true; }
private void chooseCardForColor(ObjectColor color, Set<Card> chosenCards, Player player, Game game, Ability source) { FilterCard filter = new FilterCard(); filter.add(new ColorPredicate(color)); TargetCardInHand target = new TargetCardInHand(filter); if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { chosenCards.add(card); } } } }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { ChoiceColor choice = new ChoiceColor(); choice.setMessage("Choose a color for devotion of Nykthos"); if (controller.choose(outcome, choice, game)) { return computeMana(choice.getChoice(), game, source); } } return null; }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); ChoiceColor choiceColor = new ChoiceColor(true); if (controller != null && controller.choose(Outcome.Benefit, choiceColor, game)) { Mana condMana = manaBuilder.setMana(choiceColor.getMana(amount), source, game).build(); return condMana; } return null; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { ChoiceColor choice = new ChoiceColor(); if (controller.choose(Outcome.PreventDamage, choice, game)) { game.addEffect(new AvacynGuardianAngelPreventToCreaturePreventionEffect(choice.getColor()), source); return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Choice choice = new ChoiceBasicLandType(); if (player != null && player.choose(Outcome.Neutral, choice, game)) { game.getState().setValue(source.getSourceId().toString() + "_ElsewhereFlask", choice.getChoice()); game.addEffect(new ElsewhereFlaskContinuousEffect(), source); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { ChoiceColor choice = new ChoiceColor(); if (controller.choose(Outcome.PreventDamage, choice, game)) { game.addEffect(new AvacynGuardianAngelPreventToPlayerPreventionEffect(choice.getColor()), source); return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { SeasonsPastTarget target = new SeasonsPastTarget(); controller.choose(outcome, target, source.getSourceId(), game); controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); return true; } return false; } }
@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); TargetCardInHand targetCardInHand = new TargetCardInHand(); targetCardInHand.setRequired(false); Card card; if (targetCardInHand.canChoose(controllerId, game) && controller.choose(Outcome.PreventDamage, targetCardInHand, sourceId, game)) { card = game.getCard(targetCardInHand.getFirstTarget()); paid = card != null && controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.HAND, true, true); } return paid; }
@Override public boolean apply(Game game, Ability source) { Player targetedPlayer = game.getPlayer(source.getFirstTarget()); if (targetedPlayer != null) { TargetCardInHand target = new TargetCardInHand(); if (targetedPlayer.choose(Outcome.Detriment, targetedPlayer.getHand(), target, game)) { Card card = game.getCard(target.getFirstTarget()); return card != null && targetedPlayer.putCardOnTopXOfLibrary(card, game, source, 0); } } return false; } }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { if (netMana) { return null; } UUID playerId = (UUID) game.getState().getValue(source.getSourceId() + "_player"); Player player = game.getPlayer(playerId); ChoiceColor choice = new ChoiceColor(); if (player != null && player.choose(outcome, choice, game)) { return choice.getMana(1); } return new Mana(); }
@Override public void init(Ability source, Game game) { super.init(source, game); //To change body of generated methods, choose Tools | Templates. MageObject sourceObject = game.getObject(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (sourceObject != null && controller != null) { if (controller.choose(Outcome.Protect, choice, game)) { game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen protection from " + choice.getChoice()); return; } } discard(); }
@Override public void init(Ability source, Game game) { super.init(source, game); MageObject sourceObject = game.getObject(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (sourceObject != null && controller != null) { if (!controller.choose(Outcome.Protect, choice, game)) { discard(); return; } game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen protection from " + choice.getChoice()); } }
private void chooseCardInHandAndPutOnTopOfLibrary(Game game, Ability source, Player you, Player targetPlayer) { if (!targetPlayer.getHand().isEmpty()) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to put on the top of library (last chosen will be on top)")); if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) { Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); if (card != null) { targetPlayer.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false); } } } } }
@Override public void adjustTargets(Ability ability, Game game) { Player controller = game.getPlayer(ability.getControllerId()); Choice typeChoice = new ChoiceCreatureType(game.getObject(ability.getSourceId())); if (controller != null && controller.choose(Outcome.PutCreatureInPlay, typeChoice, game)) { String chosenType = typeChoice.getChoice(); FilterCreatureCard filter = new FilterCreatureCard(chosenType + " cards"); filter.add(new SubtypePredicate(SubType.byDescription(chosenType))); ability.addTarget(new TargetCardInYourGraveyard(0, 3, filter)); } } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId())); if (player != null && player.choose(Outcome.BoostCreature, typeChoice, game)) { FilterControlledPermanent filter = new FilterControlledPermanent(); filter.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice()))); return new GainLifeEffect(new PermanentsOnBattlefieldCount(filter, 2)).apply(game, source); } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId())); if (controller != null && controller.choose(Outcome.BoostCreature, typeChoice, game)) { FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(); filter.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice()))); return new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)).apply(game, source); } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject mageObject = game.getObject(source.getSourceId()); Choice typeChoice = new ChoiceCreatureType(mageObject); if (controller != null && mageObject != null && controller.choose(outcome, typeChoice, game)) { if (!game.isSimulation()) { game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice()); } game.getState().setValue(mageObject.getId() + "_type", SubType.byDescription(typeChoice.getChoice())); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId())); if (controller != null && controller.choose(outcome, typeChoice, game)) { game.informPlayers(controller.getLogName() + " has chosen " + typeChoice.getChoice()); FilterCreaturePermanent filter = new FilterCreaturePermanent("All creatures not of the chosen type"); filter.add(Predicates.not(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())))); return new DestroyAllEffect(filter).apply(game, source); } return false; } }