@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && source.getTargets().size() > 0) { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); if (permanent != null) { permanent.addCounters( CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game); game.informPlayers( new StringBuilder(controller.getLogName()) .append(" puts ") .append(multiTarget.getTargetAmount(target)) .append(" ") .append(CounterType.P1P1.getName().toLowerCase()) .append(" counter on ") .append(permanent.getName()) .toString()); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = getPayingPlayer(game, source); MageObject mageObject = game.getObject(source.getSourceId()); if (player != null && mageObject != null) { String message; if (chooseUseText == null) { message = new StringBuilder(getCostText()) .append(" and ") .append(executingEffect.getText(source.getModes().getMode())) .append("?") .toString(); } else { message = chooseUseText; } message = CardUtil.replaceSourceName(message, mageObject.getName()); if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(executingEffect.getOutcome(), message, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { executingEffect.setTargetPointer(this.targetPointer); if (executingEffect instanceof OneShotEffect) { if (!(executingEffect instanceof PostResolveEffect)) { return executingEffect.apply(game, source); } } else { game.addEffect((ContinuousEffect) executingEffect, source); } } } return true; } return false; }
@java.lang.Override public boolean apply(Game game, Ability source) { Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourceObject != null) { // create cost for sacrificing an artifact Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true); // if they can pay the cost, then they must pay if (target.canChoose(source.getSourceId(), controller.getId(), game)) { controller.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent artifactSacrifice = game.getPermanent(target.getFirstTarget()); if (artifactSacrifice != null) { // sacrifice the chosen artifact artifactSacrifice.sacrifice(source.getSourceId(), game); } } else { sourceObject.tap(game); controller.damage(4, source.getSourceId(), game, false, true); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { int x = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game); Mana mana = new Mana(); for (int i = 0; i < x; i++) { ChoiceColor choiceColor = new ChoiceColor(); while (!player.choose(Outcome.Benefit, choiceColor, game)) { if (!player.isInGame()) { return false; } } if (choiceColor.getColor().isBlack()) { mana.addBlack(); } else if (choiceColor.getColor().isBlue()) { mana.addBlue(); } else if (choiceColor.getColor().isRed()) { mana.addRed(); } else if (choiceColor.getColor().isGreen()) { mana.addGreen(); } else if (choiceColor.getColor().isWhite()) { mana.addWhite(); } } player.getManaPool().addMana(mana, game, source); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } Card card = player.getLibrary().getFromTop(game); if (card != null) { Cards cards = new CardsImpl(); cards.add(card); player.lookAtCards("Explorer's Scope", cards, game); if (card.getCardType().contains(CardType.LAND)) { String message = "Put " + card.getName() + " onto the battlefield tapped?"; if (player.chooseUse(Outcome.PutLandInPlay, message, game)) { if (card.putOntoBattlefield( game, Zone.LIBRARY, source.getId(), source.getControllerId())) { Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { permanent.setTapped(true); } } } } } return true; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { MageObject mageObject = source.getSourceObject(game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && mageObject != null && new MageObjectReference(permanent, game).refersTo(mageObject, game)) { if (permanent.sacrifice(source.getSourceId(), game)) { UUID exileId = CardUtil.getExileZoneId( game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); if (exileId != null) { ExileZone exileZone = game.getExile().getExileZone(exileId); Card exiledCard = null; if (exileZone != null) { for (Card card : exileZone.getCards(game)) { exiledCard = card; break; } } if (exiledCard != null) { if (exiledCard.getSpellAbility().canChooseTarget(game)) { controller.cast(exiledCard.getSpellAbility(), game, true); } } } } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost revealCost = null; for (Cost cost : source.getCosts()) { if (cost instanceof RevealTargetFromHandCost) { revealCost = (RevealTargetFromHandCost) cost; } } Player controller = game.getPlayer(source.getControllerId()); Card sourceCard = game.getCard(source.getSourceId()); if (controller != null && sourceCard != null && revealCost != null) { int live = revealCost.getNumberRevealedCards() * 3; if (live > 0) { controller.gainLife(live, game); } game.informPlayers( new StringBuilder(sourceCard.getName()) .append(": ") .append(controller.getName()) .append(" revealed ") .append(revealCost.getNumberRevealedCards()) .append(revealCost.getNumberRevealedCards() == 1 ? "white card" : "white cards") .append(" and gained ") .append(live) .append(" live") .toString()); return true; } return false; }
@Override public boolean apply(Game game, Ability source, Ability abilityToModify) { if (manaCostsToReduce != null) { CardUtil.adjustCost((SpellAbility) abilityToModify, manaCostsToReduce, false); } else { if (upTo) { Mana mana = abilityToModify.getManaCostsToPay().getMana(); int reduceMax = mana.getColorless(); if (reduceMax > 2) { reduceMax = 2; } if (reduceMax > 0) { Player controller = game.getPlayer(abilityToModify.getControllerId()); if (controller == null) { return false; } ChoiceImpl choice = new ChoiceImpl(true); Set<String> set = new LinkedHashSet<>(); for (int i = 0; i <= reduceMax; i++) { set.add(String.valueOf(i)); } choice.setChoices(set); choice.setMessage("Reduce cost of " + filter); if (controller.choose(Outcome.Benefit, choice, game)) { int reduce = Integer.parseInt(choice.getChoice()); CardUtil.reduceCost(abilityToModify, reduce); } } } else { CardUtil.reduceCost(abilityToModify, this.amount); } } return true; }
@Override public boolean apply(Game game, Ability source) { UUID exileId = CardUtil.getCardExileZoneId(game, source); for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { Cards cards = new CardsImpl(); cards.addAll(opponent.getHand()); for (UUID cardId : cards) { Card card = game.getCard(cardId); if (card != null) { card.moveToExile(exileId, "Ashiok, Nightmare Weaver", source.getSourceId(), game); } } cards.clear(); cards.addAll(opponent.getGraveyard()); for (UUID cardId : cards) { Card card = game.getCard(cardId); if (card != null) { card.moveToExile(exileId, "Ashiok, Nightmare Weaver", source.getSourceId(), game); } } } } return true; }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source)); if (spell != null) { ObjectColor color1 = new ObjectColor((String) game.getState().getValue(source.getSourceId() + "_color1")); ObjectColor color2 = new ObjectColor((String) game.getState().getValue(source.getSourceId() + "_color2")); int amount = 0; if (spell.getColor(game).contains(color1)) { ++amount; } if (spell.getColor(game).contains(color2)) { ++amount; } if (amount > 0) { you.gainLife(amount, game); return true; } } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && permanent != null && sourcePermanent != null) { CopyEffect copyEffect = new CopyEffect(Duration.EndOfTurn, permanent, source.getSourceId()); if (controller.moveCardToExileWithInfo( permanent, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { // Copy exiled permanent game.addEffect(copyEffect, source); // Create delayed triggered ability AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility( new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, false)); delayedAbility.setSourceId(source.getSourceId()); delayedAbility.setControllerId(source.getControllerId()); delayedAbility.setSourceObject(source.getSourceObject(game), game); game.addDelayedTriggeredAbility(delayedAbility); return true; } } return false; }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { DamageEvent damageEvent = (DamageEvent) event; Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { // get name of old target Permanent targetPermanent = game.getPermanent(event.getTargetId()); StringBuilder message = new StringBuilder(); message.append(sourcePermanent.getName()).append(": gets "); message.append(damageEvent.getAmount()).append(" damage redirected from "); if (targetPermanent != null) { message.append(targetPermanent.getName()); } else { Player targetPlayer = game.getPlayer(event.getTargetId()); if (targetPlayer != null) { message.append(targetPlayer.getName()); } else { message.append("unknown"); } } game.informPlayers(message.toString()); // redirect damage this.used = true; sourcePermanent.damage( damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isPreventable(), damageEvent.isCombatDamage(), event.getAppliedEffects()); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (player != null) { Choice typeChoice = new ChoiceImpl(true); typeChoice.setMessage("Choose a creature type:"); typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); while (!player.choose(outcome, typeChoice, game)) { if (!player.canRespond()) { return false; } } if (typeChoice.getChoice() != null) { game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice()); } FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent(); filterCreaturePermanent.add(new SubtypePredicate(typeChoice.getChoice())); for (Permanent creature : game.getBattlefield() .getActivePermanents(filterCreaturePermanent, source.getSourceId(), game)) { creature.untap(game); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); if (spell == null) { spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK); } if (spell != null) { Spell copy = spell.copySpell(); copy.setControllerId(source.getControllerId()); copy.setCopiedSpell(true); game.getStack().push(copy); copy.chooseNewTargets(game, source.getControllerId()); Player player = game.getPlayer(source.getControllerId()); String activateMessage = copy.getActivatedMessage(game); if (activateMessage.startsWith(" casts ")) { activateMessage = activateMessage.substring(6); } if (!game.isSimulation()) { game.informPlayers(player.getLogName() + activateMessage); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } Cards cards = new CardsImpl(Zone.LIBRARY); cards.addAll(controller.getLibrary().getTopCards(game, 7)); if (!cards.isEmpty()) { TargetCard target = new TargetCard( Zone.LIBRARY, new FilterCreatureCard("creature card to put on the battlefield")); if (controller.choose(Outcome.PutCreatureInPlay, cards, target, game)) { Card card = cards.get(target.getFirstTarget(), game); if (card != null) { cards.remove(card); controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId()); } } if (cards.size() > 0) { controller.putCardsOnBottomOfLibrary(cards, game, source, true); } } return true; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { int max = amount.calculate(game, source); if (max != 0) { int numberOfCard = 0; while (player.getLibrary().size() > 0) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { if (card.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, false)) { if (card.getCardType().contains(CardType.CREATURE)) { break; } else { numberOfCard++; if (numberOfCard >= max) { break; } } } } else { return false; } } } } return true; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (sourceObject != null && controller != null) { TargetCardInYourGraveyard target = new TargetCardInYourGraveyard( new FilterInstantOrSorceryCard("instant or sorcery card from your graveyard")); if (controller.chooseTarget(outcome, target, source, game)) { UUID exileId = CardUtil.getExileZoneId( game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); Card card = controller.getGraveyard().get(target.getFirstTarget(), game); if (card != null) { controller.moveCardToExileWithInfo( card, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.GRAVEYARD, true); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { controller.shuffleLibrary(source, game); if (controller.getLibrary().size() > 0) { Card card = controller.getLibrary().removeFromTop(game); if (card != null) { controller.moveCardToExileWithInfo( card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true); ContinuousEffect effect = new MindsDesireCastFromExileEffect(); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { Mana mana = new Mana(); for (Permanent permanent : game.getBattlefield().getAllActivePermanents(you.getId())) { if (mana.getBlack() == 0 && permanent.getColor().isBlack()) { mana.addBlack(); } if (mana.getBlue() == 0 && permanent.getColor().isBlue()) { mana.addBlue(); } if (mana.getRed() == 0 && permanent.getColor().isRed()) { mana.addRed(); } if (mana.getGreen() == 0 && permanent.getColor().isGreen()) { mana.addGreen(); } if (mana.getWhite() == 0 && permanent.getColor().isWhite()) { mana.addWhite(); } } you.getManaPool().addMana(mana, game, source); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); UUID exileId = CardUtil.getExileZoneId( game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); if (permanent != null) { return controller.moveCardToExileWithInfo( permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true); } else { Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (card != null) { return controller.moveCardToExileWithInfo( card, exileId, sourceObject.getIdName(), source.getSourceId(), game, game.getState().getZone(card.getId()), true); } } } return false; }
@Override public void assignDamage( int damage, List<UUID> targets, String singleTargetName, UUID sourceId, Game game) { int remainingDamage = damage; UUID targetId; int amount; while (remainingDamage > 0) { if (targets.size() == 1) { targetId = targets.get(0); amount = remainingDamage; } else { targetId = targets.get(rnd.nextInt(targets.size())); amount = rnd.nextInt(damage + 1); } Permanent permanent = game.getPermanent(targetId); if (permanent != null) { permanent.damage(amount, sourceId, game, true, false); remainingDamage -= amount; } else { Player player = game.getPlayer(targetId); if (player != null) { player.damage(amount, sourceId, game, false, true); remainingDamage -= amount; } } targets.remove(targetId); } }
public void assignDamageToBlockers(boolean first, Game game) { if (attackers.size() > 0 && (!first || hasFirstOrDoubleStrike(game))) { if (blockers.isEmpty()) { unblockedDamage(first, game); } else { Permanent attacker = game.getPermanent(attackers.get(0)); if (attacker .getAbilities() .containsKey(DamageAsThoughNotBlockedAbility.getInstance().getId())) { Player player = game.getPlayer(attacker.getControllerId()); if (player.chooseUse( Outcome.Damage, "Do you wish to assign damage for " + attacker.getLogName() + " as though it weren't blocked?", game)) { blocked = false; unblockedDamage(first, game); } } if (blockers.size() == 1) { singleBlockerDamage(first, game); } else { multiBlockerDamage(first, game); } } } }
@Override public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent == null) { sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } if (sourcePermanent == null) { return false; } int damage = sourcePermanent.getPower().getValue(); Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { permanent.damage(damage, sourcePermanent.getId(), game, false, true); return true; } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { player.damage(damage, sourcePermanent.getId(), game, false, true); return true; } return false; }
/** * Damages attacking creatures by a creature that blocked several ones Damages only attackers as * blocker was damage in either {@link #singleBlockerDamage} or {@link #multiBlockerDamage}. * * <p>Handles abilities like "{this} an block any number of creatures.". * * @param first * @param game */ private void multiAttackerDamage(boolean first, Game game) { Permanent blocker = game.getPermanent(blockers.get(0)); if (blocker == null) { return; } Player player = game.getPlayer(blocker.getControllerId()); int damage = getDamageValueFromPermanent(blocker, game); if (canDamage(blocker, first)) { Map<UUID, Integer> assigned = new HashMap<>(); for (UUID attackerId : attackerOrder) { Permanent attacker = game.getPermanent(attackerId); int lethalDamage; if (blocker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) { lethalDamage = 1; } else { lethalDamage = attacker.getToughness().getValue() - attacker.getDamage(); } if (lethalDamage >= damage) { assigned.put(attackerId, damage); break; } int damageAssigned = player.getAmount( lethalDamage, damage, "Assign damage to " + attacker.getLogName(), game); assigned.put(attackerId, damageAssigned); damage -= damageAssigned; } for (Map.Entry<UUID, Integer> entry : assigned.entrySet()) { Permanent attacker = game.getPermanent(entry.getKey()); attacker.markDamage(entry.getValue(), blocker.getId(), game, true, true); } } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int xSum = 0; xSum += playerPaysXGenericMana(controller, source, game); for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { if (playerId != controller.getId()) { Player player = game.getPlayer(playerId); if (player != null) { xSum += playerPaysXGenericMana(player, source, game); } } } if (xSum > 0) { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Effect effect = new PutTopCardOfLibraryIntoGraveTargetEffect(xSum); effect.setTargetPointer(new FixedTarget(playerId)); effect.apply(game, source); } } // prevent undo controller.resetStoredBookmark(game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Card creature = null; Player opponent = game.getPlayer(source.getFirstTarget()); CardsImpl cards = new CardsImpl(); boolean creatureFound = false; while (opponent.getLibrary().size() > 0 && !creatureFound) { Card card = opponent.getLibrary().removeFromTop(game); if (card != null) { if (card.getCardType().contains(CardType.CREATURE)) { creature = card; creatureFound = true; } if (!creatureFound) { cards.add(card); } } } if (!cards.isEmpty()) { opponent.revealCards("Telemin Performance", cards, game); opponent.moveCards(cards, Zone.GRAVEYARD, source, game); } if (creature != null) { return creature.putOntoBattlefield( game, Zone.LIBRARY, source.getSourceId(), source.getControllerId()); } return false; }
@Override public boolean pay( Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.cards.clear(); this.targets.clearChosen(); ; Player player = game.getPlayer(controllerId); if (player == null) { return false; } int amount = this.getTargets().get(0).getNumberOfTargets(); if (randomDiscard) { this.cards.addAll(player.discard(amount, true, ability, game).getCards(game)); } else { if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { for (UUID targetId : targets.get(0).getTargets()) { Card card = player.getHand().get(targetId, game); if (card == null) { return false; } player.discard(card, ability, game); this.cards.add(card); } } } paid = cards.size() >= amount; return paid; }
@Override public boolean pay( Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); MageObject sourceObject = ability.getSourceObject(game); if (controller != null && sourceObject != null) { if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { UUID exileId = CardUtil.getExileZoneId( game, ability.getSourceId(), ability.getSourceObjectZoneChangeCounter()); for (UUID targetId : targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { return false; } paid |= controller.moveCardToExileWithInfo( permanent, exileId, sourceObject.getIdName() + " championed permanents", sourceId, game, Zone.BATTLEFIELD, true); } } } return paid; }
/** * Checks if there are enough {@link Permanent} or {@link Player} that can be chosen. Should only * be used for Ability targets since this checks for protection, shroud etc. * * @param sourceId - the target event source * @param sourceControllerId - controller of the target event source * @param game * @return - true if enough valid {@link Permanent} or {@link Player} exist */ @Override public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) { int count = 0; MageObject targetSource = game.getObject(sourceId); for (UUID playerId : game.getPlayer(sourceControllerId).getInRange()) { Player player = game.getPlayer(playerId); if (player != null && player.canBeTargetedBy(targetSource, game) && filter.match(player, game)) { count++; if (count >= this.minNumberOfTargets) { return true; } } } for (Permanent permanent : game.getBattlefield() .getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) { if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) { count++; if (count >= this.minNumberOfTargets) { return true; } } } return false; }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { ChoiceImpl choices = new ChoiceImpl(true); choices.setMessage("Choose basic land type"); choices.isRequired(); choices.getChoices().add("Forest"); choices.getChoices().add("Plains"); choices.getChoices().add("Mountain"); choices.getChoices().add("Island"); choices.getChoices().add("Swamp"); if (you.choose(Outcome.Neutral, choices, game)) { game.informPlayers( new StringBuilder("Realmwright: ") .append(" Chosen basic land type is ") .append(choices.getChoice()) .toString()); game.getState() .setValue(source.getSourceId().toString() + "_Realmwright", choices.getChoice()); return true; } } return false; }