Search in sources :

Example 11 with DestroyTargetEffect

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

the class CustomTestCard method addCustomEffect_DestroyTarget.

/**
 * Add target destroy ability that can be called by text "target destroy"
 *
 * @param controller
 */
protected void addCustomEffect_DestroyTarget(TestPlayer controller) {
    Ability ability = new SimpleActivatedAbility(new DestroyTargetEffect().setText("target destroy"), new ManaCostsImpl(""));
    ability.addTarget(new TargetPermanent());
    addCustomCardWithAbility("target destroy for " + controller.getName(), controller, ability);
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SpellAbility(mage.abilities.SpellAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Ability(mage.abilities.Ability) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) TargetPermanent(mage.target.TargetPermanent) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Example 12 with DestroyTargetEffect

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

the class OracleEnVecDestroyEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
    if (watcher != null) {
        for (UUID targetId : chosenCreatures) {
            Permanent permanent = game.getPermanent(targetId);
            if (permanent != null && !watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))) {
                Effect effect = new DestroyTargetEffect();
                effect.setTargetPointer(new FixedTarget(targetId, game));
                effect.apply(game, source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) AttackedThisTurnWatcher(mage.watchers.common.AttackedThisTurnWatcher) RestrictionEffect(mage.abilities.effects.RestrictionEffect) RequirementEffect(mage.abilities.effects.RequirementEffect) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) UUID(java.util.UUID) MageObjectReference(mage.MageObjectReference)

Example 13 with DestroyTargetEffect

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

the class HornetCannonEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Token hornetToken = new HornetToken();
    hornetToken.putOntoBattlefield(1, game, source, source.getControllerId());
    for (UUID tokenId : hornetToken.getLastAddedTokenIds()) {
        Permanent tokenPermanent = game.getPermanent(tokenId);
        if (tokenPermanent != null) {
            DestroyTargetEffect destroyEffect = new DestroyTargetEffect(false);
            destroyEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
            game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(destroyEffect), source);
        }
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) HornetToken(mage.game.permanent.token.HornetToken) HornetToken(mage.game.permanent.token.HornetToken) Token(mage.game.permanent.token.Token) UUID(java.util.UUID)

Example 14 with DestroyTargetEffect

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

the class PufferExtractEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int xValue = source.getManaCostsToPay().getX();
    game.addEffect(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn), source);
    game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new DestroyTargetEffect().setTargetPointer(new FixedTarget(source.getFirstTarget(), game))), source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect)

Example 15 with DestroyTargetEffect

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

the class TsabosAssasinEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent != null) {
        Condition condition = new MostCommonColorCondition(permanent.getColor(game));
        if (condition.apply(game, source)) {
            Effect effect = new DestroyTargetEffect();
            effect.setTargetPointer(new FixedTarget(permanent, game));
            return effect.apply(game, source);
        }
    }
    return false;
}
Also used : MostCommonColorCondition(mage.abilities.condition.common.MostCommonColorCondition) Condition(mage.abilities.condition.Condition) FixedTarget(mage.target.targetpointer.FixedTarget) MostCommonColorCondition(mage.abilities.condition.common.MostCommonColorCondition) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect)

Aggregations

DestroyTargetEffect (mage.abilities.effects.common.DestroyTargetEffect)20 FixedTarget (mage.target.targetpointer.FixedTarget)13 Permanent (mage.game.permanent.Permanent)10 Effect (mage.abilities.effects.Effect)9 OneShotEffect (mage.abilities.effects.OneShotEffect)8 Player (mage.players.Player)6 UUID (java.util.UUID)4 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)4 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)4 FilterPermanent (mage.filter.FilterPermanent)3 TargetPermanent (mage.target.TargetPermanent)3 Ability (mage.abilities.Ability)2 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)2 InvertCondition (mage.abilities.condition.InvertCondition)2 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)2 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)2 ControllerIdPredicate (mage.filter.predicate.permanent.ControllerIdPredicate)2 MageObject (mage.MageObject)1 MageObjectReference (mage.MageObjectReference)1 SpellAbility (mage.abilities.SpellAbility)1