Search in sources :

Example 1 with CreateSpecialActionEffect

use of mage.abilities.effects.common.CreateSpecialActionEffect 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 2 with CreateSpecialActionEffect

use of mage.abilities.effects.common.CreateSpecialActionEffect in project mage by magefree.

the class LicidSpecialActionEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent licid = (Permanent) source.getSourceObjectIfItStillExists(game);
    if (licid != null) {
        UUID messageId = UUID.randomUUID();
        LicidContinuousEffect effect = new LicidContinuousEffect(messageId);
        effect.setTargetPointer(new FixedTarget(licid, game));
        game.addEffect(effect, source);
        new AttachEffect(Outcome.Neutral).apply(game, source);
        SpecialAction specialAction = new LicidSpecialAction(this.specialActionCost, messageId, licid.getIdName());
        new CreateSpecialActionEffect(specialAction).apply(game, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) SpecialAction(mage.abilities.SpecialAction) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) UUID(java.util.UUID) CreateSpecialActionEffect(mage.abilities.effects.common.CreateSpecialActionEffect) AttachEffect(mage.abilities.effects.common.AttachEffect)

Example 3 with CreateSpecialActionEffect

use of mage.abilities.effects.common.CreateSpecialActionEffect in project mage by magefree.

the class GuardianAngelDelayedTriggeredAbility method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        String targetName = "";
        Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
        if (targetPlayer == null) {
            Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
            if (targetPermanent == null) {
                return true;
            }
            targetName = targetPermanent.getIdName();
        } else {
            targetName = "player " + targetPlayer.getName();
        }
        ContinuousEffect effect = new PreventDamageToTargetEffect(Duration.EndOfTurn, source.getManaCostsToPay().getX(), false);
        effect.setTargetPointer(getTargetPointer());
        game.addEffect(effect, source);
        SpecialAction specialAction = new GuardianAngelAction();
        specialAction.getEffects().get(0).setTargetPointer(getTargetPointer());
        specialAction.getEffects().get(0).setText("Prevent the next 1 damage that would be dealt to any target this turn (" + targetName + ").");
        new CreateSpecialActionEffect(specialAction).apply(game, source);
        // Create a hidden delayed triggered ability to remove the special action at end of turn.
        new CreateDelayedTriggeredAbilityEffect(new GuardianAngelDelayedTriggeredAbility(specialAction.getId()), false).apply(game, source);
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) SpecialAction(mage.abilities.SpecialAction) Permanent(mage.game.permanent.Permanent) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) CreateSpecialActionEffect(mage.abilities.effects.common.CreateSpecialActionEffect) PreventDamageToTargetEffect(mage.abilities.effects.common.PreventDamageToTargetEffect)

Aggregations

SpecialAction (mage.abilities.SpecialAction)3 CreateSpecialActionEffect (mage.abilities.effects.common.CreateSpecialActionEffect)3 CreateDelayedTriggeredAbilityEffect (mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect)2 Permanent (mage.game.permanent.Permanent)2 UUID (java.util.UUID)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 AttachEffect (mage.abilities.effects.common.AttachEffect)1 PreventDamageToTargetEffect (mage.abilities.effects.common.PreventDamageToTargetEffect)1 Player (mage.players.Player)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1