public void putCardToTopXPos(Card card, int pos, Game game) { if (card != null && pos > -1) { LinkedList<Card> save = new LinkedList<>(); int idx = 1; while (hasCards() && idx < pos) { idx++; save.add(removeFromTop(game)); } putOnTop(card, game); while (!save.isEmpty()) { putOnTop(save.removeLast(), game); } } }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { return controller.getLibrary().hasCards(); } return false; }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); return controller != null && controller.getLibrary().hasCards(); }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { return controller.getLibrary().hasCards(); } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { // move cards from library to exile for (int i = 0; i < 5; i++) { if (player.getLibrary().hasCards()) { Card topCard = player.getLibrary().getFromTop(game); topCard.moveToExile(source.getSourceId(), "Cards exiled by Search the City", source.getSourceId(), game); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && controller.getLibrary().hasCards()) { Card card = controller.getLibrary().getFromTop(game); controller.moveCards(card, Zone.GRAVEYARD, source, game); if (card.isInstant() || card.isSorcery()) { new TransformSourceEffect(true).apply(game, source); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null) { if (targetPlayer.getLibrary().hasCards()) { Card card = targetPlayer.getLibrary().getFromTop(game); if (card != null) { targetPlayer.moveCards(card, Zone.GRAVEYARD, source, game); int amount = card.getConvertedManaCost(); if (amount > 0) { game.addEffect(new BoostSourceEffect(amount, amount, Duration.EndOfTurn), source); } } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.getLibrary().hasCards()) { Card card = controller.getLibrary().getFromTop(game); if (card != null) { Cards cards = new CardsImpl(card); controller.revealCards(source, cards, game); controller.moveCards(card, Zone.HAND, source, game); controller.loseLife(card.getConvertedManaCost(), game, false); } return true; } } return false; }
@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 controller = game.getPlayer(source.getControllerId()); if (controller != null && controller.getLibrary().hasCards()) { Card card = controller.getLibrary().getFromTop(game); if (card != null) { CardsImpl cards = new CardsImpl(); cards.add(card); controller.lookAtCards("Etherwrought Page", cards, game); if (controller.chooseUse(Outcome.Neutral, "Do you wish to put the card into your graveyard?", source, game)) { return controller.moveCards(card, Zone.GRAVEYARD, source, game); } return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null && targetPlayer.getLibrary().hasCards()) { Card card = targetPlayer.getLibrary().getFromTop(game); card.moveToExile(id, "Scrib Nibblers Exile", source.getSourceId(), game); if (card.isLand() && you != null) { you.gainLife(1, game, source); return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getFirstTarget()); if (player != null && player.getLibrary().hasCards()) { Card card = player.getLibrary().removeFromBottom(game); if (card != null) { player.moveCards(card, Zone.GRAVEYARD, source, game); if (card.isCreature()) { ZombieToken token = new ZombieToken(); token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { while (controller.getLibrary().hasCards() && controller.isInGame()) { Card card = controller.getLibrary().getFromTop(game); if (card != null) { controller.moveCards(card, Zone.EXILED, source, game); if (!card.isLand()) { new DamageTargetEffect(card.getConvertedManaCost()).apply(game, source); break; } } } 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) { if (controller.getLibrary().hasCards()) { UUID exileId = source.getSourceId(); Set<Card> cardsToExile = controller.getLibrary().getTopCards(game, 5); for (Card card : cardsToExile) { controller.moveCardsToExile(card, source, game, true, exileId, sourceObject.getName()); card.setFaceDown(true, 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 && controller.getLibrary().hasCards()) { Library library = controller.getLibrary(); Card card = library.getFromTop(game); if (card != null) { controller.moveCardsToExile(card, source, game, true, source.getSourceId(), CardUtil.createObjectRealtedWindowTitle(source, game, " <this card may be played the turn it was exiled>")); game.addEffect(new OraclesVaultPlayForFreeEffect(new MageObjectReference(card, game)), source); } return true; } return false; } }
@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) { if (controller.getLibrary().hasCards()) { Card card = controller.getLibrary().getFromTop(game); if (card != null) { Cards cards = new CardsImpl(card); controller.revealCards(sourcePermanent.getIdName(), cards, game); controller.moveCards(card, Zone.HAND, source, game); controller.loseLife(card.getConvertedManaCost(), game, false); } return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield((source.getSourceId())); if (player == null || sourcePermanent == null) { return false; } if (player.getLibrary().hasCards()) { Card card = player.getLibrary().getFromTop(game); Cards cards = new CardsImpl(card); player.revealCards(sourcePermanent.getName(), cards, game); if (card != null) { game.addEffect(new BoostSourceEffect(card.getConvertedManaCost(), 0, Duration.EndOfTurn), source); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) { Card card = controller.getLibrary().getFromTop(game); if (card != null) { String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled>"; controller.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName); ContinuousEffect effect = new IreShamanCastFromExileEffect(); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); } 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 && controller.getLibrary().hasCards()) { Card card = controller.getLibrary().getFromTop(game); Cards cards = new CardsImpl(card); controller.revealCards(sourceObject.getIdName(), cards, game); if (!controller.chooseUse(Outcome.PlayForFree, "Play " + card.getName() + " without paying its mana cost?", source, game) || !controller.playCard(card, game, true, true, new MageObjectReference(source.getSourceObject(game), game))) { controller.moveCards(card, Zone.EXILED, source, game); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) { Library library = controller.getLibrary(); Card card = library.getFromTop(game); if (card != null) { String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled>"; controller.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName); ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game))); game.addEffect(effect, source); } return true; } return false; } }