Search in sources :

Example 1 with CreateDelayedTriggeredAbilityEffect

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;
}
Also used : Player(mage.players.Player) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) BoostAllEffect(mage.abilities.effects.common.continuous.BoostAllEffect)

Example 2 with CreateDelayedTriggeredAbilityEffect

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;
}
Also used : AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) ReturnToHandSourceEffect(mage.abilities.effects.common.ReturnToHandSourceEffect) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Example 3 with CreateDelayedTriggeredAbilityEffect

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;
}
Also used : SpecialAction(mage.abilities.SpecialAction) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) CreateSpecialActionEffect(mage.abilities.effects.common.CreateSpecialActionEffect)

Example 4 with CreateDelayedTriggeredAbilityEffect

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;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect) Effect(mage.abilities.effects.Effect) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect)

Example 5 with CreateDelayedTriggeredAbilityEffect

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

Aggregations

CreateDelayedTriggeredAbilityEffect (mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect)11 Player (mage.players.Player)8 Permanent (mage.game.permanent.Permanent)7 Card (mage.cards.Card)5 LinkedHashSet (java.util.LinkedHashSet)3 OnLeaveReturnExiledToBattlefieldAbility (mage.abilities.common.delayed.OnLeaveReturnExiledToBattlefieldAbility)3 SpecialAction (mage.abilities.SpecialAction)2 AtTheEndOfCombatDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility)2 Effect (mage.abilities.effects.Effect)2 OneShotEffect (mage.abilities.effects.OneShotEffect)2 CreateSpecialActionEffect (mage.abilities.effects.common.CreateSpecialActionEffect)2 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)2 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)2 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)2 TargetPermanent (mage.target.TargetPermanent)2 FixedTarget (mage.target.targetpointer.FixedTarget)2 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)1 AtTheBeginOfNextUpkeepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility)1