}
if (opponent == null) {
opponent = game.getPlayer(opponents.iterator().next());
}
TargetCard target = new TargetCard(0, cards.size(), Zone.PICK, 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.getName() +" chose pile" + (pileChoice?"1":"2"));
for (UUID cardUuid : cardsToHand) {
Card card = cardsToHand.get(cardUuid, game);
if (card != null) {
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
}
}
TargetCard targetCard = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library"));
while (player.isInGame() && cardsToLibrary.size() > 1) {
player.choose(Outcome.Neutral, cardsToLibrary, targetCard, game);
Card card = cardsToLibrary.get(targetCard.getFirstTarget(), game);
if (card != null) {
cardsToLibrary.remove(card);
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false);
}
target.clearChosen();