Search in sources :

Example 36 with ExileTargetEffect

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

the class FelhideSpiritbinderEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
    if (permanent != null) {
        CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, CardType.ENCHANTMENT, true);
        effect.setTargetPointer(getTargetPointer());
        if (effect.apply(game, source)) {
            for (Permanent tokenPermanent : effect.getAddedPermanents()) {
                ExileTargetEffect exileEffect = new ExileTargetEffect();
                exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
                DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
                game.addDelayedTriggeredAbility(delayedAbility, source);
            }
            return true;
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Example 37 with ExileTargetEffect

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

the class GyrusWakerOfCorpsesPowerLessThanSourcePredicate method apply.

@Override
public boolean apply(Game game, Ability source) {
    Card card = game.getCard(source.getFirstTarget());
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null || card == null) {
        return false;
    }
    controller.moveCards(card, Zone.EXILED, source, game);
    CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, true, 1, true, true);
    effect.setTargetPointer(new FixedTarget(card, game));
    effect.apply(game, source);
    for (Permanent addedToken : effect.getAddedPermanents()) {
        Effect exileEffect = new ExileTargetEffect();
        exileEffect.setTargetPointer(new FixedTarget(addedToken, game));
        new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), false).apply(game, source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) ObjectSourcePlayer(mage.filter.predicate.ObjectSourcePlayer) Permanent(mage.game.permanent.Permanent) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect) AddCountersSourceEffect(mage.abilities.effects.common.counter.AddCountersSourceEffect) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect) Effect(mage.abilities.effects.Effect) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect) FilterCreatureCard(mage.filter.common.FilterCreatureCard) Card(mage.cards.Card) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Example 38 with ExileTargetEffect

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

the class HixusPrisonWardenExileEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
    // the target creature won't be exiled.
    if (permanent != null) {
        Effect effect = new ExileTargetEffect(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), permanent.getIdName());
        effect.setTargetPointer(getTargetPointer());
        return effect.apply(game, source);
    }
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Example 39 with ExileTargetEffect

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

the class KappaTechWreckerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    FilterPermanent filter = new FilterArtifactOrEnchantmentPermanent("artifact or enchantment that player controls");
    filter.add(new ControllerIdPredicate(getTargetPointer().getFirst(game, source)));
    ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new ExileTargetEffect(), false);
    ability.addTarget(new TargetPermanent(filter));
    return new DoWhenCostPaid(ability, new RemoveCountersSourceCost(CounterType.DEATHTOUCH.createInstance()), "Remove a deathtouch counter?").apply(game, source);
}
Also used : FilterPermanent(mage.filter.FilterPermanent) RemoveCountersSourceCost(mage.abilities.costs.common.RemoveCountersSourceCost) DoWhenCostPaid(mage.abilities.effects.common.DoWhenCostPaid) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate) ReflexiveTriggeredAbility(mage.abilities.common.delayed.ReflexiveTriggeredAbility) TargetPermanent(mage.target.TargetPermanent) FilterArtifactOrEnchantmentPermanent(mage.filter.common.FilterArtifactOrEnchantmentPermanent) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Example 40 with ExileTargetEffect

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

the class PatronOfTheVeinExileCreatureEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    MageObject sourceObject = source.getSourceObject(game);
    Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
    if (card != null) {
        Effect effect = new ExileTargetEffect();
        effect.setTargetPointer(new FixedTarget(card.getId(), game));
        effect.apply(game, source);
    }
    for (Permanent permanent : game.getState().getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) {
        permanent.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game);
        game.informPlayers(sourceObject.getName() + ": Put a +1/+1 counter on " + permanent.getLogName());
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) MageObject(mage.MageObject) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) Card(mage.cards.Card) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Aggregations

ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)51 Permanent (mage.game.permanent.Permanent)40 FixedTarget (mage.target.targetpointer.FixedTarget)38 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)31 Player (mage.players.Player)31 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)26 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)20 Card (mage.cards.Card)20 ContinuousEffect (mage.abilities.effects.ContinuousEffect)15 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)13 Effect (mage.abilities.effects.Effect)12 OneShotEffect (mage.abilities.effects.OneShotEffect)12 FixedTargets (mage.target.targetpointer.FixedTargets)10 UUID (java.util.UUID)9 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)9 TargetPermanent (mage.target.TargetPermanent)8 ArrayList (java.util.ArrayList)6 AtTheEndOfCombatDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility)6 FilterCreatureCard (mage.filter.common.FilterCreatureCard)6 FilterCard (mage.filter.FilterCard)5