@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); Permanent sourcePermanent = game.getPermanent(sourceId); if (player != null && sourcePermanent != null) { paid = true; player.putCardsOnBottomOfLibrary(new CardsImpl(sourcePermanent), game, ability, false); } return paid; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Card card = controller.getLibrary().getFromTop(game); if (card != null) { controller.putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, true); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { int count = you.getHand().size(); you.putCardsOnBottomOfLibrary(you.getHand(), game, source, true); you.drawCards(count, game); } return true; }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { int count = you.getHand().size(); you.putCardsOnBottomOfLibrary(you.getHand(), game, source, true); you.drawCards(count, game); } return true; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { int count = player.getHand().size(); player.putCardsOnBottomOfLibrary(player.getHand(), game, source, true); player.drawCards(count, game); } return true; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getFirstTarget()); if (player == null) { return false; } player.putCardsOnBottomOfLibrary( new CardsImpl(player.getGraveyard().getCards(game)), game, source, false ); player.shuffleLibrary(source, game); return true; } }
@Override public boolean apply(Game game, Ability source) { Card card = game.getCard(source.getFirstTarget()); Player player = game.getPlayer(source.getControllerId()); if (card == null || player == null || game.getState().getZone(card.getId()) != Zone.GRAVEYARD) { return false; } return player.putCardsOnBottomOfLibrary(card, game, source, false); } }
@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; } }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { Card card = game.getCard(event.getTargetId()); if (card != null) { Cards cards = new CardsImpl(card); controller.revealCards(sourceObject.getIdName(), cards, game); controller.putCardsOnBottomOfLibrary(cards, game, source, false); return true; } } return false; }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(event.getPlayerId()); if (player != null) { Cards revealedCards = new CardsImpl(player.getLibrary().getTopCards(game, 3)); player.revealCards(source, revealedCards, game); Cards creatures = new CardsImpl(revealedCards.getCards(StaticFilters.FILTER_CARD_CREATURE, game)); player.moveCards(creatures, Zone.HAND, source, game); revealedCards.removeAll(creatures); player.putCardsOnBottomOfLibrary(revealedCards, game, source, true); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { controller.drawCards(2, game); TargetCardInHand target = new TargetCardInHand(2, 2, new FilterCard()); controller.chooseTarget(Outcome.Detriment, target, source, game); Cards cardsToLibrary = new CardsImpl(target.getTargets()); if (!cardsToLibrary.isEmpty()) { controller.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, false); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getFirstTarget()); if (player == null || permanent == null) { return false; } if (permanent.getColor(game).isRed() && player.chooseUse(outcome, "Put " + permanent.getLogName() + " on the bottom of its owner's library?", source, game )) { player.putCardsOnBottomOfLibrary(permanent, game, source, true); return true; } player.putCardsOnTopOfLibrary(new CardsImpl(permanent), game, source, true); return true; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { controller.drawCards(3, game); boolean putOnTop = controller.chooseUse(Outcome.Neutral, "Put cards on top?", source, game); TargetCardInHand target = new TargetCardInHand(2, 2, new FilterCard()); controller.chooseTarget(Outcome.Detriment, target, source, game); Cards cardsToLibrary = new CardsImpl(target.getTargets()); if (!cardsToLibrary.isEmpty()) { if (putOnTop) { controller.putCardsOnTopOfLibrary(cardsToLibrary, game, source, false); } else { controller.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, false); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller == null || sourceObject == null) { return false; } Cards revealed = new CardsImpl(); revealed.addAll(controller.getLibrary().getTopCards(game, 10)); controller.revealCards(sourceObject.getIdName(), revealed, game); Player targetOpponent = game.getPlayer(source.getFirstTarget()); if (targetOpponent != null) { targetOpponent.moveCards(targetOpponent.getLibrary().getTopCards(game, new ChromaSanityGrindingCount(revealed).calculate(game, source, this)), Zone.GRAVEYARD, source, game); } return controller.putCardsOnBottomOfLibrary(revealed, game, source, true); }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getFirstTarget()); FilterCard filter = new FilterCard("cards to put on the bottom of your library"); if (player != null) { int number = min(player.getLibrary().size(), 5); Set<Card> cards = player.getLibrary().getTopCards(game, number); Cards cardsRemaining = new CardsImpl(); cardsRemaining.addAll(cards); TargetCard target = new TargetCard(0, number, Zone.LIBRARY, filter); if (player.choose(Outcome.DrawCard, cardsRemaining, target, game)) { Cards pickedCards = new CardsImpl(target.getTargets()); cardsRemaining.removeAll(pickedCards); player.putCardsOnBottomOfLibrary(pickedCards, game, source, true); player.putCardsOnTopOfLibrary(cardsRemaining, game, source, true); return true; } } return false; } }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, source.getManaCostsToPay().getX())); controller.lookAtCards(source, null, cards, game); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to stay at the top of library")); if (controller.choose(outcome, cards, target, game)) { cards.remove(target.getFirstTarget()); } controller.putCardsOnBottomOfLibrary(cards, game, source, false); game.applyEffects(); controller.drawCards(1, game, event.getAppliedEffects()); discard(); return true; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Set<Card> cardsSet = controller.getLibrary().getTopCards(game, 6); Cards cards = new CardsImpl(); for (Card card : cardsSet) { cards.add(card); } TargetCard target = new TargetCardInLibrary(0, 1, new FilterNonlandCard("card to cast without paying its mana cost")); if (controller.choose(Outcome.PlayForFree, cards, target, game)) { Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); if (card != null && controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game))) { cards.remove(card); } } controller.putCardsOnBottomOfLibrary(cards, game, source, false); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (player != null && controller != null && sourceObject != null) { TargetCard targetCard = new TargetCard(Zone.ALL, new FilterNonlandCard()); targetCard.setRequired(false); if (controller.choose(Outcome.Discard, player.getHand(), targetCard, game)) { Card card = game.getCard(targetCard.getFirstTarget()); if (card != null) { CardsImpl cards = new CardsImpl(); cards.add(card); player.revealCards(sourceObject.getIdName(), cards, game); player.putCardsOnBottomOfLibrary(cards, game, source, true); player.drawCards(1, game); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, 5)); controller.lookAtCards(sourceObject.getIdName(), cards, game); TargetCard target = new TargetCard(0, 1, Zone.LIBRARY, StaticFilters.FILTER_CARD_BASIC_LAND); controller.chooseTarget(outcome, cards, target, source, game); Cards cardsRevealed = new CardsImpl(target.getTargets()); if (!cardsRevealed.isEmpty()) { controller.revealCards(sourceObject.getIdName(), cardsRevealed, game); cards.removeAll(cardsRevealed); controller.putCardsOnTopOfLibrary(cardsRevealed, game, source, true); } controller.putCardsOnBottomOfLibrary(cards, game, source, true); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game); if (controller != null && permanent != null) { Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, permanent.getPower().getValue())); if (!cards.isEmpty()) { TargetCard target = new TargetCardInHand(new FilterCard("card to put on top of your library")); controller.choose(Outcome.Benefit, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { cards.remove(card); controller.putCardsOnTopOfLibrary(new CardsImpl(card), game, source, true); } controller.putCardsOnBottomOfLibrary(cards, game, source, true); } return true; } return false; } }