Search in sources :

Example 6 with ReturnFromGraveyardToBattlefieldTargetEffect

use of mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect 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)

Example 7 with ReturnFromGraveyardToBattlefieldTargetEffect

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

the class ConcoctEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    player.surveil(3, source, game);
    Target target = new TargetCardInYourGraveyard(filter);
    target.setNotTarget(true);
    if (player.choose(outcome, target, source.getSourceId(), game)) {
        Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
        effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
        effect.apply(game, source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Target(mage.target.Target) FixedTarget(mage.target.targetpointer.FixedTarget) ReturnFromGraveyardToBattlefieldTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) ReturnFromGraveyardToBattlefieldTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect) TargetCardInYourGraveyard(mage.target.common.TargetCardInYourGraveyard)

Aggregations

ReturnFromGraveyardToBattlefieldTargetEffect (mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect)7 Effect (mage.abilities.effects.Effect)6 OneShotEffect (mage.abilities.effects.OneShotEffect)6 FixedTarget (mage.target.targetpointer.FixedTarget)6 Card (mage.cards.Card)5 Player (mage.players.Player)4 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)2 UUID (java.util.UUID)1 MageObject (mage.MageObject)1 MageObjectReference (mage.MageObjectReference)1 PayLifeCost (mage.abilities.costs.common.PayLifeCost)1 ContinuousEffectImpl (mage.abilities.effects.ContinuousEffectImpl)1 DoUnlessAnyPlayerPaysEffect (mage.abilities.effects.common.DoUnlessAnyPlayerPaysEffect)1 ExileSourceEffect (mage.abilities.effects.common.ExileSourceEffect)1 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)1 ReturnToHandSourceEffect (mage.abilities.effects.common.ReturnToHandSourceEffect)1 BecomesColorTargetEffect (mage.abilities.effects.common.continuous.BecomesColorTargetEffect)1 BecomesCreatureTypeTargetEffect (mage.abilities.effects.common.continuous.BecomesCreatureTypeTargetEffect)1 GainControlTargetEffect (mage.abilities.effects.common.continuous.GainControlTargetEffect)1 SearchLibraryPutInPlayEffect (mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect)1