@Override public boolean applies(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(event.getPlayerId()); if (player != null && player.getLibrary().getCards(game).isEmpty()) { return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Cards revealed = new CardsImpl(); Set<Card> creatureCards = new LinkedHashSet<>(); for (Card card : controller.getLibrary().getCards(game)) { revealed.add(card); if (card.isCreature()) { creatureCards.add(card); } if (creatureCards.size() >= numberOfCards) { break; } } controller.revealCards(source, revealed, game); controller.moveCards(creatureCards, Zone.BATTLEFIELD, source, game); controller.shuffleLibrary(source, game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { // Cards creatures = new CardsImpl(); Set<Card> creaturesToExile = new HashSet<>(game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)); int count = creaturesToExile.size(); controller.moveCards(creaturesToExile, Zone.EXILED, source, game); Cards revealed = new CardsImpl(); Set<Card> creatureCards = new LinkedHashSet<>(); for (Card card : controller.getLibrary().getCards(game)) { revealed.add(card); if (card.isCreature()) { creatureCards.add(card); if (creatureCards.size() == count) { break; } } } controller.revealCards(source, revealed, game); controller.moveCards(creatureCards, Zone.BATTLEFIELD, source, game, false, false, true, null); controller.shuffleLibrary(source, game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Set<Card> copyLibrary = new HashSet<>(); List<Card> listCopyLibrary = controller.getLibrary().getCards(game); listCopyLibrary.forEach((card) -> { copyLibrary.add(card); }); Set<Card> copyGraveyard = controller.getGraveyard().getCards(game); controller.getLibrary().clear(); controller.getGraveyard().clear(); controller.moveCards(copyLibrary, Zone.GRAVEYARD, source, game); controller.moveCards(copyGraveyard, Zone.LIBRARY, source, game); controller.shuffleLibrary(source, game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { CardsImpl libraryCards = new CardsImpl(); libraryCards.addAll(player.getLibrary().getCards(game)); player.moveCards(libraryCards, Zone.HAND, source, game); } } return true; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player == null) { return false; } Cards cards = new CardsImpl(); for (Card card : player.getLibrary().getCards(game)) { cards.add(card); if (card.isLand()) { break; } } player.revealCards(source, cards, game); player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } }
@Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); if (opponent != null) { Cards cards = new CardsImpl(); int landsFound = 0; for (Card card : opponent.getLibrary().getCards(game)) { cards.add(card); if (card.isLand() && ++landsFound == 4) { break; } } opponent.revealCards(source, cards, game); opponent.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(getTargetPointer().getFirst(game, source)); if (controller == null) { return false; } CardsImpl toGraveyard = new CardsImpl(); for (Card card : controller.getLibrary().getCards(game)) { if (card != null) { toGraveyard.add(card); if (card.isLand()) { break; } } } controller.revealCards(source, toGraveyard, game); controller.moveCards(toGraveyard, Zone.GRAVEYARD, source, game); return true; } }
@Override public boolean apply(Game game, Ability source) { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(opponentId); if (player == null) { continue; } Cards cards = new CardsImpl(); for (Card card : player.getLibrary().getCards(game)) { if (card != null) { cards.add(card); if (card.isLand()) { break; } } } player.revealCards(source, cards, game); player.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && controller.getLibrary().hasCards()) { CardsImpl cards = new CardsImpl(); for (Card card : controller.getLibrary().getCards(game)) { cards.add(card); if (!card.isLand()) { break; } } controller.revealCards(source, cards, game); controller.moveCards(cards, Zone.HAND, source, game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); if (player == null) { return false; } int landsToReveal = 4; Cards cards = new CardsImpl(); for (Card card : player.getLibrary().getCards(game)) { if (card != null) { cards.add(card); if (card.isLand() && --landsToReveal < 1) { break; } } } player.revealCards(source, "from " + player.getName(), cards, game); player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { Cards cards = new CardsImpl(); for (Card card : controller.getLibrary().getCards(game)) { cards.add(card); if (card.isLand()) { controller.moveCards(card, Zone.GRAVEYARD, source, game); } else { break; } } controller.revealCards(sourcePermanent.getName(), cards, game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Permanent landPermanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (landPermanent != null) { Player player = game.getPlayer(landPermanent.getControllerId()); if (player == null) { return false; } Cards cards = new CardsImpl(); for (Card card : player.getLibrary().getCards(game)) { if (card != null) { cards.add(card); if (card.isLand()) { break; } } } player.revealCards(source, cards, game); player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { CardsImpl cards = new CardsImpl(); for (Card card : controller.getLibrary().getCards(game)) { if (card != null) { cards.add(card); if (!card.isLand()) { if (card.getConvertedManaCost() > 0) { game.addEffect(new BoostSourceEffect(card.getConvertedManaCost(), 0, Duration.EndOfTurn), source); } break; } } } controller.revealCards(source, cards, game); controller.putCardsOnBottomOfLibrary(cards, game, source, true); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int count = controller.getLibrary().size(); if (count > 0) { for (Card cardToExile: controller.getLibrary().getCards(game)) { cardToExile.moveToExile(null, "", source.getSourceId(), game); cardToExile.setFaceDown(true, game); } } for (Card cardToLibrary: controller.getGraveyard().getCards(game)) { controller.moveCardToLibraryWithInfo(cardToLibrary, source.getSourceId(), game, Zone.GRAVEYARD, true, true); } controller.shuffleLibrary(source, game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { int xValue = source.getManaCostsToPay().getX(); if (xValue < 1) { return false; } for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(opponentId); if (player == null) { continue; } int landsToReveal = xValue; Cards cards = new CardsImpl(); for (Card card : player.getLibrary().getCards(game)) { cards.add(card); if (card.isLand() && --landsToReveal == 0) { break; } } player.revealCards(source, "from " + player.getName(), cards, game); player.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { CardsImpl toReveal = new CardsImpl(); Card toBattlefield = null; for (Card card : controller.getLibrary().getCards(game)) { toReveal.add(card); game.fireUpdatePlayersEvent(); if (card.isArtifact()) { toBattlefield = card; break; } } controller.revealCards(source, toReveal, game); controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game); int damage = toReveal.size(); toReveal.remove(toBattlefield); controller.putCardsOnBottomOfLibrary(toReveal, game, source, false); controller.damage(damage, source.getSourceId(), game, false, true); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { CardsImpl toReveal = new CardsImpl(); Card nonLandCard = null; for (Card card : controller.getLibrary().getCards(game)) { toReveal.add(card); if (!card.isLand() && card.getConvertedManaCost() < 4) { nonLandCard = card; break; } } controller.revealCards(source, toReveal, game); if (nonLandCard != null && controller.chooseUse(outcome, "Cast " + nonLandCard.getLogName() + "without paying its mana cost?", source, game)) { controller.cast(nonLandCard.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game)); toReveal.remove(nonLandCard); } controller.putCardsOnBottomOfLibrary(toReveal, game, source, false); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player spellController = game.getPlayer(((Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK)).getControllerId()); if (spellController != null) { Cards cardsToReveal = new CardsImpl(); Card toCast = null; for (Card card : spellController.getLibrary().getCards(game)) { cardsToReveal.add(card); if (card.isSorcery() || card.isInstant()) { toCast = card; break; } } spellController.revealCards(source, cardsToReveal, game); if (toCast != null && spellController.chooseUse(outcome, "Cast " + toCast.getLogName() + " without paying its mana cost?", source, game)) { spellController.cast(toCast.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game)); } spellController.shuffleLibrary(source, game); 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) { Choice choice = new ChoiceCreatureType(sourceObject); if (!controller.choose(Outcome.BoostCreature, choice, game)) { return false; } Cards revealedCards = new CardsImpl(); for (Card card : controller.getLibrary().getCards(game)) { if (card.isCreature() && card.hasSubtype(SubType.byDescription(choice.getChoice()), game)) { controller.moveCards(card, Zone.BATTLEFIELD, source, game); break; } revealedCards.add(card); } controller.revealCards(sourceObject.getIdName(), revealedCards, game); controller.moveCards(revealedCards, Zone.LIBRARY, source, game); controller.shuffleLibrary(source, game); return true; } return false; } }