public boolean hasCards() { return size() > 0; }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player player = game.getPlayer(controllerId); return player != null && player.getLibrary().size() >= numberOfCards; }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller == null) { return false; } return controller.getLibrary().size() >= amount; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.getLibrary().size() >= 200) { return true; } return false; } }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { Player controller = game.getPlayer(sourceAbility.getControllerId()); if (controller != null) { return controller.getLibrary().size(); } } return 0; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getPlayerId().equals(source.getControllerId())) { Player controller = game.getPlayer(source.getControllerId()); return controller != null && controller.getLibrary().size() >= amount; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { int amount = (int) Math.ceil(player.getLibrary().size() * .5); return player.moveCards(player.getLibrary().getTopCards(game, amount), Zone.GRAVEYARD, source, game); } return false; }
@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player != null && player.getLibrary().size() >= numberOfCards) { paid = true; this.cardsMovedToGraveyard.addAll(player.getLibrary().getTopCards(game, numberOfCards)); player.moveCards(player.getLibrary().getTopCards(game, numberOfCards), Zone.GRAVEYARD, ability, game); } return paid; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { int amount = player.getLibrary().size() / 2; return player.moveCards(player.getLibrary().getTopCards(game, amount), Zone.GRAVEYARD, source, game); } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { int newValue = player.getLibrary().size(); int oldValue = player.getLife(); if (newValue - oldValue > 0) { player.gainLife(newValue - oldValue, game, source); } if (oldValue - newValue > 0) { player.loseLife(oldValue - newValue, game, false); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player controller = game.getPlayer(source.getControllerId()); if (targetPlayer == null || controller == null) { return false; } return controller.moveCards(targetPlayer.getLibrary().getTopCards(game, targetPlayer.getLibrary().size() - 1), Zone.EXILED, source, game); } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, controller.getLibrary().size())); controller.moveCards(cards, Zone.EXILED, source, game); 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(); Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, count)); controller.moveCards(cards, Zone.EXILED, source, game); return true; } return false; } }
@Override public void lookAtAllLibraries(Ability source, Game game) { for (UUID playerId : game.getState().getPlayersInRange(this.getId(), game)) { Player player = game.getPlayer(playerId); String playerName = this.getName().equals(player.getName()) ? "Your " : player.getName() + "'s "; playerName += "library"; Cards cardsInLibrary = new CardsImpl(player.getLibrary().getTopCards(game, player.getLibrary().size())); lookAtCards(playerName, cardsInLibrary, game); } }
@Override public final boolean apply(Game game, Ability source) { boolean libraryWith20OrFewerCards = false; Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null && ComparisonType.compare(player.getLibrary().size(), type, value)) { libraryWith20OrFewerCards = true; break; } } } return libraryWith20OrFewerCards; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (controller != null && targetPlayer != null) { controller.moveCards(targetPlayer.getLibrary().getTopCards(game, targetPlayer.getLibrary().size()), Zone.EXILED, source, game); targetPlayer.moveCards(targetPlayer.getHand(), Zone.LIBRARY, source, game); targetPlayer.shuffleLibrary(source, game); 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(); Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, count)); controller.moveCards(cards, Zone.EXILED, source, game); for (Card card: controller.getGraveyard().getCards(game)) { controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true); } 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) { 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) { 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 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; }