@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } Card card = (Card) source.getSourceObjectIfItStillExists(game); if (card != null) { controller.putCardOnTopXOfLibrary(card, game, source, 3); } return true; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { return controller.putCardOnTopXOfLibrary(permanent, game, source, 2); } Spell spell = game.getStack().getSpell(source.getFirstTarget()); if (spell != null) { return controller.putCardOnTopXOfLibrary(spell, game, source, 2); } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { controller.putCardOnTopXOfLibrary(permanent, game, source, 2); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { controller.putCardOnTopXOfLibrary(permanent, game, source, 3); } return true; } return false; } }
@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 boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { controller.putCardOnTopXOfLibrary(permanent, game, source, source.getManaCostsToPay().getX() + 1); return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { Player owner = game.getPlayer(permanent.getOwnerId()); Player controller = game.getPlayer(permanent.getControllerId()); if (owner == null || controller == null) { return false; } owner.putCardOnTopXOfLibrary(permanent, game, source, 2); controller.gainLife(3, game, source); } return true; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { TargetCardInLibrary target = new TargetCardInLibrary(); if (player.searchLibrary(target, game)) { Card card = player.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { player.shuffleLibrary(source, game); player.putCardOnTopXOfLibrary(card, game, source, 3); } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { Player owner = game.getPlayer(permanent.getOwnerId()); if (owner == null) { return false; } int amount = controller.rollDice(game, 6); controller.putCardOnTopXOfLibrary(permanent, game, source, amount); return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null && controller != null) { Player owner = game.getPlayer(permanent.getOwnerId()); if (owner != null) { int plains = game.getBattlefield().countAll(new FilterPermanent(SubType.PLAINS, "Plains you control"), source.getControllerId(), game); controller.putCardOnTopXOfLibrary(permanent, game, source, plains); return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (targetPlayer != null && controller != null) { targetPlayer.revealCards(source, targetPlayer.getHand(), game); if (targetPlayer.getHand().size() > 0) { TargetCard target = new TargetCard(Zone.HAND, new FilterCard(StaticFilters.FILTER_CARD_A_NON_LAND)); if (controller.choose(Outcome.Discard, targetPlayer.getHand(), target, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { targetPlayer.putCardOnTopXOfLibrary(card, game, source, 3); } } } return true; } return false; }
@Override public boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop) { if (card.isOwnedBy(getId())) { if (library.size() + 1 < xFromTheTop) { putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, true); } else { if (card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true) && !(card instanceof PermanentToken) && !card.isCopy()) { card = getLibrary().removeFromTop(game); getLibrary().putCardToTopXPos(card, xFromTheTop, game); game.informPlayers(card.getLogName() + " is put into " + getLogName() + "'s library " + CardUtil.numberToOrdinalText(xFromTheTop) + " from the top"); } else { return false; } } } else { return game.getPlayer(card.getOwnerId()).putCardOnTopXOfLibrary(card, game, source, xFromTheTop); } return true; }
controller.putCardOnTopXOfLibrary(spellCard, game, source, 7);