use of mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility 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.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility in project mage by magefree.
the class FeldonOfTheThirdPathEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), CardType.ARTIFACT, true);
effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));
effect.apply(game, source);
for (Permanent addedToken : effect.getAddedPermanents()) {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("Sacrifice the token at the beginning of the next end step", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(addedToken, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}
return false;
}
use of mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility in project mage by magefree.
the class FatalFrenzyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (targetCreature != null) {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice this", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(targetCreature, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}
use of mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility in project mage by magefree.
the class FarrelitePriestEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
activationInfo.addActivation(game);
if (activationInfo.getActivationCounter() == 4) {
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect());
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}
use of mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility in project mage by magefree.
the class FlickerwispEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && permanent != null && sourcePermanent != null) {
if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source, game, Zone.BATTLEFIELD, true)) {
// create delayed triggered ability
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false);
effect.setText("Return that card to the battlefield under its owner's control at the beginning of the next end step");
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
return true;
}
}
return false;
}
Aggregations