@Override public boolean apply(Game game, Ability source) { boolean isMountain = false; Card sourceCard = game.getCard(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (player == null || sourceCard == null) { return false; } Cards cards = new CardsImpl(Zone.PICK); while (player.getLibrary().size() > 0) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { cards.add(card); if (card.getCardType().contains(CardType.LAND)) { if (card.getSubtype().contains("Mountain")) { isMountain = true; } break; } } else { break; } } player.revealCards(sourceCard.getName(), cards, game); int damage = cards.size(); if (isMountain == true) { damage *= 2; } Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { permanent.damage(damage, source.getSourceId(), game, true, false); } else { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { targetPlayer.damage(damage, source.getSourceId(), game, false, true); } } TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library")); target.setRequired(true); while (cards.size() > 1) { player.choose(Outcome.Neutral, cards, target, game); Card card = cards.get(target.getFirstTarget(), game); if (card != null) { cards.remove(card); card.moveToZone(Zone.PICK, source.getId(), game, false); } target.clearChosen(); } return true; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { boolean revealed = player .isTopCardRevealed(); // by looking at the cards with scry you have not to reveal the // next card player.setTopCardRevealed(false); Cards cards = new CardsImpl(); int count = Math.min(scryNumber, player.getLibrary().size()); if (count == 0) { return true; } for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); cards.add(card); } TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1); target1.setRequired(false); // move cards to the bottom of the library while (player.isInGame() && cards.size() > 0 && player.choose(Outcome.Detriment, cards, target1, game)) { Card card = cards.get(target1.getFirstTarget(), game); if (card != null) { cards.remove(card); player.moveCardToLibraryWithInfo( card, source.getSourceId(), game, Zone.LIBRARY, false, false); } target1.clearChosen(); } // move cards to the top of the library player.putCardsOnTopOfLibrary(cards, game, source, true); game.fireEvent( new GameEvent( GameEvent.EventType.SCRY, source.getControllerId(), source.getSourceId(), source.getControllerId())); player.setTopCardRevealed(revealed); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), 3); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { cards.add(card); } } player.revealCards("Jace, Architect of Thought", cards, game); Set<UUID> opponents = game.getOpponents(source.getControllerId()); if (!opponents.isEmpty()) { Player opponent = null; if (opponents.size() > 1) { TargetOpponent targetOpponent = new TargetOpponent(); if (player.chooseTarget(Outcome.Neutral, targetOpponent, source, game)) { opponent = game.getPlayer(targetOpponent.getFirstTarget()); } } if (opponent == null) { opponent = game.getPlayer(opponents.iterator().next()); } TargetCard target = new TargetCard( 0, cards.size(), Zone.LIBRARY, new FilterCard("cards to put in the first pile")); target.setRequired(false); Cards pile1 = new CardsImpl(); if (opponent.choose(Outcome.Neutral, cards, target, game)) { for (UUID targetId : (List<UUID>) target.getTargets()) { Card card = cards.get(targetId, game); if (card != null) { pile1.add(card); cards.remove(card); } } } player.revealCards("Pile 1 (Jace, Architect of Thought)", pile1, game); player.revealCards("Pile 2 (Jace, Architect of Thought)", cards, game); postPileToLog("Pile 1", pile1.getCards(game), game); postPileToLog("Pile 2", cards.getCards(game), game); Cards cardsToHand = cards; Cards cardsToLibrary = pile1; List<Card> cardPile1 = new ArrayList<>(); List<Card> cardPile2 = new ArrayList<>(); for (UUID cardId : pile1) { cardPile1.add(game.getCard(cardId)); } for (UUID cardId : cards) { cardPile2.add(game.getCard(cardId)); } boolean pileChoice = player.choosePile( Outcome.Neutral, "Choose a pile to to put into your hand.", cardPile1, cardPile2, game); if (pileChoice) { cardsToHand = pile1; cardsToLibrary = cards; } game.informPlayers(player.getLogName() + " chose pile" + (pileChoice ? "1" : "2")); for (UUID cardUuid : cardsToHand) { Card card = cardsToHand.get(cardUuid, game); if (card != null) { player.moveCards(card, null, Zone.HAND, source, game); } } player.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, true); return true; } return false; }