Search in sources :

Example 1 with ExileSourceEffect

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

the class InameAsOneEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = game.getObject(source.getSourceId());
    Card targetCard = game.getCard(getTargetPointer().getFirst(game, source));
    if (controller != null && sourceObject != null && targetCard != null) {
        if (controller.chooseUse(outcome, "Exile " + sourceObject.getLogName() + " to return Spirit card?", source, game)) {
            // In a Commander game, you may send Iname to the Command Zone instead of exiling it during the resolution
            // of its ability. If you do, its ability still works. Iname's ability only requires that you attempted to
            // exile it, not that it actually gets to the exile zone. This is similar to how destroying a creature
            // (with, for example, Rest in Peace) doesn't necessarily ensure that creature will end up in the graveyard;
            // it just so happens that the action of exiling something and the exile zone both use the same word: "exile".
            Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
            effect.setTargetPointer(new FixedTarget(targetCard.getId(), targetCard.getZoneChangeCounter(game)));
            new ExileSourceEffect().apply(game, source);
            return effect.apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) ExileSourceEffect(mage.abilities.effects.common.ExileSourceEffect) Player(mage.players.Player) ReturnFromGraveyardToBattlefieldTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect) MageObject(mage.MageObject) ExileSourceEffect(mage.abilities.effects.common.ExileSourceEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) SearchLibraryPutInPlayEffect(mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect) Effect(mage.abilities.effects.Effect) ReturnFromGraveyardToBattlefieldTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect) Card(mage.cards.Card) FilterPermanentCard(mage.filter.common.FilterPermanentCard)

Example 2 with ExileSourceEffect

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

the class InameLifeAspectEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = game.getObject(source.getSourceId());
    if (controller != null && sourceObject != null) {
        if (controller.chooseUse(outcome, "Exile " + sourceObject.getLogName() + " to return Spirit cards?", source, game)) {
            Effect effect = new ReturnToHandTargetEffect();
            effect.setTargetPointer(getTargetPointer());
            effect.getTargetPointer().init(game, source);
            new ExileSourceEffect().apply(game, source);
            return effect.apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : ExileSourceEffect(mage.abilities.effects.common.ExileSourceEffect) Player(mage.players.Player) MageObject(mage.MageObject) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) ExileSourceEffect(mage.abilities.effects.common.ExileSourceEffect) ReturnToHandTargetEffect(mage.abilities.effects.common.ReturnToHandTargetEffect) ReturnToHandTargetEffect(mage.abilities.effects.common.ReturnToHandTargetEffect)

Example 3 with ExileSourceEffect

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

the class RecoverEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Card sourceCard = game.getCard(source.getSourceId());
    if (controller != null && sourceCard != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
        if (controller.chooseUse(Outcome.Damage, "Pay " + cost.getText() + " to recover " + sourceCard.getLogName() + "? (Otherwise the card will be exiled)", source, game)) {
            cost.clearPaid();
            if (cost.pay(source, game, source, controller.getId(), false, null)) {
                return new ReturnToHandSourceEffect().apply(game, source);
            }
        }
        return new ExileSourceEffect().apply(game, source);
    }
    return false;
}
Also used : ExileSourceEffect(mage.abilities.effects.common.ExileSourceEffect) Player(mage.players.Player) ReturnToHandSourceEffect(mage.abilities.effects.common.ReturnToHandSourceEffect) Card(mage.cards.Card)

Example 4 with ExileSourceEffect

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

the class AjaniStrengthOfThePrideEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null || player.getLife() < game.getStartingLife() + 15) {
        return false;
    }
    new ExileSourceEffect().apply(game, source);
    return new ExileAllEffect(filter).apply(game, source);
}
Also used : ExileSourceEffect(mage.abilities.effects.common.ExileSourceEffect) Player(mage.players.Player) ExileAllEffect(mage.abilities.effects.common.ExileAllEffect)

Example 5 with ExileSourceEffect

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

the class ExquisiteArchangelEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    Player player = game.getPlayer(event.getPlayerId());
    Permanent sourcePermanent = game.getPermanent(source.getSourceId());
    if (player != null && sourcePermanent != null) {
        new ExileSourceEffect().apply(game, source);
        player.setLife(game.getStartingLife(), game, source);
        return true;
    }
    return false;
}
Also used : ExileSourceEffect(mage.abilities.effects.common.ExileSourceEffect) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent)

Aggregations

ExileSourceEffect (mage.abilities.effects.common.ExileSourceEffect)7 Player (mage.players.Player)7 MageObject (mage.MageObject)2 Effect (mage.abilities.effects.Effect)2 OneShotEffect (mage.abilities.effects.OneShotEffect)2 Card (mage.cards.Card)2 EndOfCombatTriggeredAbility (mage.abilities.common.EndOfCombatTriggeredAbility)1 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)1 ExileAllEffect (mage.abilities.effects.common.ExileAllEffect)1 ReturnFromGraveyardToBattlefieldTargetEffect (mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect)1 ReturnToHandSourceEffect (mage.abilities.effects.common.ReturnToHandSourceEffect)1 ReturnToHandTargetEffect (mage.abilities.effects.common.ReturnToHandTargetEffect)1 SearchLibraryPutInPlayEffect (mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect)1 Cards (mage.cards.Cards)1 CardsImpl (mage.cards.CardsImpl)1 FilterPermanentCard (mage.filter.common.FilterPermanentCard)1 Permanent (mage.game.permanent.Permanent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1