public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId());
if (you == null) {
return false;
}
Cards cards = new CardsImpl();
int max = Math.min(you.getLibrary().size(), 10);
for (int i = 0; i < max; i++) {
Card card = you.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToExile(source.getSourceId(), "Chandra Pyromaster", source.getSourceId(), game);
cards.add(card);
}
}
if (cards.getCards(new FilterInstantOrSorceryCard(), game).size() > 0) {
TargetCard target = new TargetCard(Zone.EXILED, new FilterInstantOrSorceryCard());
if (you.chooseTarget(Outcome.PlayForFree, cards, target, source, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
Card copy1 = card.copy();
Card copy2 = card.copy();
Card copy3 = card.copy();
if (copy1 != null && you.chooseUse(outcome, "Do you wish to cast copy 1 of " + card.getName(), game)) {