super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
if (spell != null) {
if (spell.moveToExile(source.getSourceId(), "Possibility Storm Exile", source.getSourceId(), game)) {
Player player = game.getPlayer(spell.getControllerId());
if (player != null && player.getLibrary().size() > 0) {
Library library = player.getLibrary();
Card card;
do {
card = library.removeFromTop(game);
if (card != null) {
card.moveToExile(source.getSourceId(), "Possibility Storm Exile", source.getSourceId(), game);
}
} while (library.size() > 0 && card != null && !sharesType(card, spell.getCardType()));
if (card != null && sharesType(card, spell.getCardType())) {
if(player.chooseUse(Outcome.PlayForFree, new StringBuilder("Cast ").append(card.getName()).append(" without paying cost?").toString(), game)) {
player.cast(card.getSpellAbility(), game, true);
}
}