Search in sources :

Example 1 with ExileSpellEffect

use of mage.abilities.effects.common.ExileSpellEffect in project mage by magefree.

the class OnceAndFutureEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    Card card1 = game.getCard(source.getFirstTarget());
    Card card2 = game.getCard(source.getTargets().get(1).getFirstTarget());
    if (card1 == null) {
        card1 = card2;
        card2 = null;
    }
    if (card1 == null) {
        return false;
    }
    if (card2 == null) {
        player.putInHand(card1, game);
        return new ExileSpellEffect().apply(game, source);
    }
    if (AdamantCondition.GREEN.apply(game, source)) {
        Cards cards = new CardsImpl();
        cards.add(card1);
        cards.add(card2);
        player.moveCards(cards, Zone.HAND, source, game);
        return new ExileSpellEffect().apply(game, source);
    }
    player.putInHand(card1, game);
    player.putCardsOnTopOfLibrary(new CardsImpl(card2), game, source, false);
    return new ExileSpellEffect().apply(game, source);
}
Also used : Player(mage.players.Player) ExileSpellEffect(mage.abilities.effects.common.ExileSpellEffect)

Example 2 with ExileSpellEffect

use of mage.abilities.effects.common.ExileSpellEffect in project mage by magefree.

the class ReapThePastEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    int xValue = source.getManaCostsToPay().getX();
    Cards cards = new CardsImpl(player.getGraveyard());
    while (cards.size() > xValue) {
        cards.remove(cards.getRandom(game));
    }
    player.moveCards(cards, Zone.HAND, source, game);
    return new ExileSpellEffect().apply(game, source);
}
Also used : Player(mage.players.Player) ExileSpellEffect(mage.abilities.effects.common.ExileSpellEffect) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl)

Aggregations

ExileSpellEffect (mage.abilities.effects.common.ExileSpellEffect)2 Player (mage.players.Player)2 Cards (mage.cards.Cards)1 CardsImpl (mage.cards.CardsImpl)1