public void add(String name, Card card) { this.createLookedAt(name).add(card); }
public void add(String name, Card card) { this.get(name).add(card); }
public void setTopHalfCard(Card topHalfCard, Game game) { this.topHalfCard = topHalfCard; this.topLastZoneChangeCounter = topHalfCard.getZoneChangeCounter(game); halves.add(topHalfCard.getId()); }
public void setBottomHalfCard(Card bottomHalfCard, Game game) { this.bottomHalfCard = bottomHalfCard; this.bottomLastZoneChangeCounter = bottomHalfCard.getZoneChangeCounter(game); halves.add(bottomHalfCard.getId()); }
private Permanent chooseOnePermanent(Game game, Player player, List<Permanent> permanents) { Permanent permanent = null; if (permanents.size() == 1) { permanent = permanents.iterator().next(); } else if (permanents.size() > 1) { Cards cards = new CardsImpl(); for (Permanent card : permanents) { cards.add(card); } TargetCard targetCard = new TargetCard(Zone.BATTLEFIELD, new FilterCard()); if (player.choose(Outcome.Benefit, cards, targetCard, game)) { permanent = game.getPermanent(targetCard.getFirstTarget()); } } return permanent; }
@Override public void doOpeningHandAction(Card card, Player player, Game game) { Cards cards = new CardsImpl(); cards.add(card); player.revealCards(card.getName(), cards, game); this.resolve(game); } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } Cards cardsToReturn = new CardsImpl(); cards.getCards(game).stream().filter((card) -> (game.getState().getZone(card.getId()) == Zone.EXILED && card.getZoneChangeCounter(game) == cardMap.getOrDefault(card.getId(), -5) + 1)).forEachOrdered((card) -> { cardsToReturn.add(card); }); return player.moveCards(cardsToReturn, Zone.GRAVEYARD, source, game); } }
@Override public void useDeck(Deck deck, Game game) { library.clear(); library.addAll(deck.getCards(), game); sideboard.clear(); for (Card card : deck.getSideboard()) { sideboard.add(card); } }
@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("Sphinx of Jwar Isle", cards, game); } else { return false; } return true; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null && !player.getHand().isEmpty()) { Cards revealed = new CardsImpl(); revealed.add(player.getHand().getRandom(game)); player.revealCards("Merfolk Spy", revealed, game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null && !player.getHand().isEmpty()) { Cards revealed = new CardsImpl(); revealed.add(player.getHand().getRandom(game)); player.revealCards("Hired Torturer", revealed, game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { List<Permanent> tokenPermanents = (List<Permanent>) game.getState().getValue(source.getSourceId() + "_token"); if (tokenPermanents != null) { Cards cards = new CardsImpl(); for (Permanent permanent : tokenPermanents) { cards.add(permanent); } controller.moveCards(cards, Zone.EXILED, source, game); return true; } } return false; }
@Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.CYCLE_CARD && !game.isSimulation()) { Card card = game.getCard(event.getSourceId()); Player controller = game.getPlayer(event.getPlayerId()); if (card != null && controller != null && card.isOwnedBy(controller.getId())) { Cards c = getCardsCycledThisTurn(event.getPlayerId()); c.add(card); cycledCardsThisTurn.put(event.getPlayerId(), c); } } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Cards cards = new CardsImpl(); for (UUID cardId : this.getTargetPointer().getTargets(game, source)) { Card card = controller.getGraveyard().get(cardId, game); if (card != null) { cards.add(card); } } return controller.putCardsOnBottomOfLibrary(cards, game, source, true); } return false; } }
private void searchCard(Player player, Ability source, Game game, Cards cards, String subtype) { FilterCard filter = new FilterCard(subtype); filter.add(new SubtypePredicate(SubType.byDescription(subtype))); TargetCardInLibrary target = new TargetCardInLibrary(filter); if (player.searchLibrary(target, game)) { Card card = player.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { card.moveToZone(Zone.HAND, source.getSourceId(), game, false); cards.add(card); } } }
private void searchLand(Player player, Ability source, Game game, Cards cards, String subtype) { FilterLandCard filter = new FilterLandCard(subtype); filter.add(new SubtypePredicate(SubType.byDescription(subtype))); TargetCardInLibrary target = new TargetCardInLibrary(filter); if (player.searchLibrary(target, game)) { Card card = player.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { card.moveToZone(Zone.HAND, source.getSourceId(), game, false); cards.add(card); } } }
private void searchLand(Player player, Ability source, Game game, Cards cards, String subtype) { FilterLandCard filter = new FilterLandCard(subtype); filter.add(new SubtypePredicate(SubType.byDescription(subtype))); TargetCardInLibrary target = new TargetCardInLibrary(filter); if (player.searchLibrary(target, game)) { Card card = player.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { card.moveToZone(Zone.HAND, source.getSourceId(), game, false); cards.add(card); } } } }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null && !targetPlayer.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = targetPlayer.getHand().getRandom(game); if (card != null) { revealed.add(card); targetPlayer.revealCards("Singe-Mind Ogre", revealed, game); targetPlayer.loseLife(card.getConvertedManaCost(), game, false); return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(targetPointer.getFirst(game, source)); if (opponent != null && !opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { revealed.add(card); opponent.revealCards("Planeswalker's Fury", revealed, game); opponent.damage(card.getConvertedManaCost(), source.getSourceId(), game, false, true); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(targetPointer.getFirst(game, source)); Player player = game.getPlayer(source.getControllerId()); if (opponent != null && player!= null && !opponent.getHand().isEmpty()) { Cards revealed = new CardsImpl(); Card card = opponent.getHand().getRandom(game); if (card != null) { revealed.add(card); opponent.revealCards("Planeswalker's Mirth", revealed, game); player.gainLife(card.getConvertedManaCost(), game, source); } return true; } return false; }