Search in sources :

Example 6 with SpecialAction

use of mage.abilities.SpecialAction 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 7 with SpecialAction

use of mage.abilities.SpecialAction 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 8 with SpecialAction

use of mage.abilities.SpecialAction 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)8 Player (mage.players.Player)5 CreateSpecialActionEffect (mage.abilities.effects.common.CreateSpecialActionEffect)3 Target (mage.target.Target)3 CreateDelayedTriggeredAbilityEffect (mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect)2 ValueHint (mage.abilities.hint.ValueHint)2 Permanent (mage.game.permanent.Permanent)2 ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 ExileFromGraveCost (mage.abilities.costs.common.ExileFromGraveCost)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 AttachEffect (mage.abilities.effects.common.AttachEffect)1 PreventDamageToTargetEffect (mage.abilities.effects.common.PreventDamageToTargetEffect)1 FilterCard (mage.filter.FilterCard)1 FilterPlayer (mage.filter.FilterPlayer)1 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)1 ColorPredicate (mage.filter.predicate.mageobject.ColorPredicate)1 TargetPlayer (mage.target.TargetPlayer)1 TargetCardInYourGraveyard (mage.target.common.TargetCardInYourGraveyard)1 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)1