use of mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect in project mage by magefree.
the class ChaosMoonEvenReplacementEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int permanentsInPlay = game.getBattlefield().count(StaticFilters.FILTER_PERMANENT, source.getSourceId(), source.getControllerId(), game);
// Odd
if (permanentsInPlay % 2 == 1) {
game.addEffect(new BoostAllEffect(1, 1, Duration.EndOfTurn, filter, false), source);
new CreateDelayedTriggeredAbilityEffect(new ChaosMoonOddTriggeredAbility()).apply(game, source);
} else // Even
{
game.addEffect(new BoostAllEffect(-1, -1, Duration.EndOfTurn, filter, false), source);
game.addEffect(new ChaosMoonEvenReplacementEffect(), source);
}
return true;
}
use of mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect in project mage by magefree.
the class SakashimaTheImpostorCopyApplier method apply.
@Override
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
blueprint.addSuperType(SuperType.LEGENDARY);
blueprint.setName("Sakashima the Impostor");
// {2}{U}{U}: Return Sakashima the Impostor to its owner's hand at the beginning of the next end step
blueprint.getAbilities().add(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnToHandSourceEffect(true)), false), new ManaCostsImpl("{2}{U}{U}")));
return true;
}
use of mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect in project mage by magefree.
the class ChannelDelayedTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
SpecialAction specialAction = new ChannelSpecialAction();
new CreateSpecialActionEffect(specialAction).apply(game, source);
// Create a hidden delayed triggered ability to remove the special action at end of turn.
new CreateDelayedTriggeredAbilityEffect(new ChannelDelayedTriggeredAbility(specialAction.getId()), false).apply(game, source);
return true;
}
use of mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect in project mage by magefree.
the class FlamerushRiderEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (controller != null && permanent != null) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, true, 1, true, true);
effect.setTargetPointer(new FixedTarget(permanent, 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;
}
return false;
}
use of mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect 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;
}
Aggregations