Search in sources :

Example 1 with DoUnlessAnyPlayerPaysEffect

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

the class AetherRiftEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Card card = controller.discardOne(true, false, source, game);
        if (card != null && card.isCreature(game)) {
            Effect returnEffect = new ReturnFromGraveyardToBattlefieldTargetEffect();
            returnEffect.setTargetPointer(new FixedTarget(card.getId(), game));
            Effect doEffect = new DoUnlessAnyPlayerPaysEffect(returnEffect, new PayLifeCost(5), "Pay 5 life to prevent " + card.getLogName() + " to return from graveyard to battlefield?");
            return doEffect.apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) ReturnFromGraveyardToBattlefieldTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect) PayLifeCost(mage.abilities.costs.common.PayLifeCost) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) ReturnFromGraveyardToBattlefieldTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect) DoUnlessAnyPlayerPaysEffect(mage.abilities.effects.common.DoUnlessAnyPlayerPaysEffect) DoUnlessAnyPlayerPaysEffect(mage.abilities.effects.common.DoUnlessAnyPlayerPaysEffect) Card(mage.cards.Card)

Aggregations

PayLifeCost (mage.abilities.costs.common.PayLifeCost)1 Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 DoUnlessAnyPlayerPaysEffect (mage.abilities.effects.common.DoUnlessAnyPlayerPaysEffect)1 ReturnFromGraveyardToBattlefieldTargetEffect (mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect)1 Card (mage.cards.Card)1 Player (mage.players.Player)1 FixedTarget (mage.target.targetpointer.FixedTarget)1