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;
}
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;
}
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;
}
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);
}
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;
}
Aggregations