use of mage.abilities.effects.common.ExileTargetForSourceEffect in project mage by magefree.
the class CosmicInterventionReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null) {
Card card = game.getCard(event.getTargetId());
if (card != null) {
ExileTargetForSourceEffect exileEffect = new ExileTargetForSourceEffect();
exileEffect.setTargetPointer(new FixedTarget(card.getId(), game));
exileEffect.apply(game, source);
Effect returnEffect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false);
returnEffect.setTargetPointer(new FixedTarget(card.getId(), game));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}
}
return false;
}
use of mage.abilities.effects.common.ExileTargetForSourceEffect in project mage by magefree.
the class HoardingDragonEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller == null || sourceObject == null) {
return false;
}
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_ARTIFACT);
controller.searchLibrary(target, source, game);
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
ExileTargetForSourceEffect effect = new ExileTargetForSourceEffect();
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
effect.apply(game, source);
}
controller.shuffleLibrary(source, game);
return true;
}
use of mage.abilities.effects.common.ExileTargetForSourceEffect in project mage by magefree.
the class JusticiarsPortalEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
UUID targetId = source.getFirstTarget();
new ExileTargetForSourceEffect().apply(game, source);
new ReturnToBattlefieldUnderYourControlTargetEffect().apply(game, source);
ContinuousEffect effect = new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(targetId, game));
game.addEffect(effect, source);
return true;
}
Aggregations