Search in sources :

Example 6 with DestroyTargetEffect

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

the class RancidEarthEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Effect effect1 = new DestroyTargetEffect("destroy that land");
    effect1.apply(game, source);
    return new DamageEverythingEffect(1).apply(game, source);
}
Also used : DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) DamageEverythingEffect(mage.abilities.effects.common.DamageEverythingEffect) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) DamageEverythingEffect(mage.abilities.effects.common.DamageEverythingEffect) Effect(mage.abilities.effects.Effect) ConditionalOneShotEffect(mage.abilities.decorator.ConditionalOneShotEffect)

Example 7 with DestroyTargetEffect

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

the class CruelDeceiverEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    if (controller != null && sourceObject != null) {
        Cards cards = new CardsImpl();
        Card card = controller.getLibrary().getFromTop(game);
        if (card != null) {
            cards.add(card);
            controller.revealCards(sourceObject.getIdName(), cards, game);
            if (card.isLand(game)) {
                game.addEffect(new GainAbilitySourceEffect(new DealsDamageToACreatureTriggeredAbility(new DestroyTargetEffect(true), false, false, true), Duration.EndOfTurn), source);
            }
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) DealsDamageToACreatureTriggeredAbility(mage.abilities.common.DealsDamageToACreatureTriggeredAbility) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) MageObject(mage.MageObject)

Example 8 with DestroyTargetEffect

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

the class NettlingImpDelayedDestroyEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    DestroyTargetEffect effect = new DestroyTargetEffect();
    effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
    AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect, TargetController.ANY, new InvertCondition(TargetAttackedThisTurnCondition.instance));
    delayedAbility.getDuration();
    delayedAbility.getTargets().addAll(source.getTargets());
    game.addDelayedTriggeredAbility(delayedAbility, source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) InvertCondition(mage.abilities.condition.InvertCondition)

Example 9 with DestroyTargetEffect

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

the class ArrogantBloodlordEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (permanent != null) {
        AtTheEndOfCombatDelayedTriggeredAbility delayedAbility = new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect());
        delayedAbility.getEffects().get(0).setTargetPointer(new FixedTarget(permanent, game));
        game.addDelayedTriggeredAbility(delayedAbility, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility)

Example 10 with DestroyTargetEffect

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

the class ConsumingFerocityEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent creature = game.getPermanent(source.getFirstTarget());
    if (creature != null) {
        Effect effect = new AddCountersAttachedEffect(CounterType.P1P0.createInstance(), "enchanted creature");
        effect.apply(game, source);
        if (creature.getCounters(game).getCount(CounterType.P1P0) > 2) {
            Player player = game.getPlayer(creature.getControllerId());
            if (player != null) {
                player.damage(creature.getPower().getValue(), creature.getId(), source, game);
            }
            effect = new DestroyTargetEffect(true);
            effect.setTargetPointer(new FixedTarget(creature, game));
            effect.apply(game, source);
            return true;
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) AddCountersAttachedEffect(mage.abilities.effects.common.counter.AddCountersAttachedEffect) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) AddCountersAttachedEffect(mage.abilities.effects.common.counter.AddCountersAttachedEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) AttachEffect(mage.abilities.effects.common.AttachEffect) BoostEnchantedEffect(mage.abilities.effects.common.continuous.BoostEnchantedEffect)

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