Search in sources :

Example 41 with DamageTargetEffect

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

the class MountVelusManticoreEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    Card card = player.discard(0, 1, false, source, game).getRandom(game);
    if (card == null) {
        return false;
    }
    ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(card.getCardType(game).size()), false, "{this} deals X damage " + "to any target, where X is the number of card types the discarded card has");
    ability.addTarget(new TargetAnyTarget());
    game.fireReflexiveTriggeredAbility(ability, source);
    return true;
}
Also used : Player(mage.players.Player) ReflexiveTriggeredAbility(mage.abilities.common.delayed.ReflexiveTriggeredAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) Card(mage.cards.Card) TargetAnyTarget(mage.target.common.TargetAnyTarget)

Example 42 with DamageTargetEffect

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

the class StompingSlabsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 7));
        if (!cards.isEmpty()) {
            controller.revealCards("Stomping Slabs", cards, game);
            boolean stompingSlabsFound = false;
            for (UUID cardId : cards) {
                Card card = game.getCard(cardId);
                if (card != null && card.getName().equals("Stomping Slabs")) {
                    stompingSlabsFound = true;
                    break;
                }
            }
            controller.putCardsOnBottomOfLibrary(cards, game, source, true);
            if (stompingSlabsFound) {
                Effect effect = new DamageTargetEffect(7);
                effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
                effect.apply(game, source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) UUID(java.util.UUID) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl) Card(mage.cards.Card)

Example 43 with DamageTargetEffect

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

the class TheRoyalScionsCreateReflexiveTriggerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    effect.apply(game, source);
    ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(CardsInControllerHandCount.instance), false, "{this} deals damage to any target equal to the number of cards in your hand");
    ability.addTarget(new TargetAnyTarget());
    game.fireReflexiveTriggeredAbility(ability, source);
    return true;
}
Also used : ReflexiveTriggeredAbility(mage.abilities.common.delayed.ReflexiveTriggeredAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) TargetAnyTarget(mage.target.common.TargetAnyTarget)

Example 44 with DamageTargetEffect

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

the class OutcomesTest method test_FromEffects_Single.

/**
 * Normal outcome from effects
 */
@Test
public void test_FromEffects_Single() {
    Ability abilityGood = new SimpleStaticAbility(new GainLifeEffect(10));
    Assert.assertEquals(1, abilityGood.getEffects().getOutcomeScore(abilityGood));
    Ability abilityBad = new SimpleStaticAbility(new DamageTargetEffect(10));
    Assert.assertEquals(-1, abilityBad.getEffects().getOutcomeScore(abilityBad));
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) LeavesBattlefieldTriggeredAbility(mage.abilities.common.LeavesBattlefieldTriggeredAbility) Ability(mage.abilities.Ability) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect) Test(org.junit.Test)

Example 45 with DamageTargetEffect

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

the class KothOfTheHammerThirdEffect method apply.

@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    switch(layer) {
        case AbilityAddingRemovingEffects_6:
            if (sublayer == SubLayer.NA) {
                for (Permanent permanent : game.getBattlefield().getActivePermanents(mountains, source.getControllerId(), source.getSourceId(), game)) {
                    Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost());
                    ability.addTarget(new TargetAnyTarget());
                    permanent.addAbility(ability, source.getSourceId(), game);
                }
            }
            break;
    }
    return true;
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Ability(mage.abilities.Ability) FilterLandPermanent(mage.filter.common.FilterLandPermanent) Permanent(mage.game.permanent.Permanent) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) TapSourceCost(mage.abilities.costs.common.TapSourceCost) TargetAnyTarget(mage.target.common.TargetAnyTarget)

Aggregations

DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)50 Player (mage.players.Player)22 TargetAnyTarget (mage.target.common.TargetAnyTarget)20 Permanent (mage.game.permanent.Permanent)17 ReflexiveTriggeredAbility (mage.abilities.common.delayed.ReflexiveTriggeredAbility)15 Ability (mage.abilities.Ability)12 Effect (mage.abilities.effects.Effect)11 FixedTarget (mage.target.targetpointer.FixedTarget)9 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)8 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)8 Test (org.junit.Test)8 OneShotEffect (mage.abilities.effects.OneShotEffect)7 Card (mage.cards.Card)7 TargetPermanent (mage.target.TargetPermanent)7 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)6 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)5 LeavesBattlefieldTriggeredAbility (mage.abilities.common.LeavesBattlefieldTriggeredAbility)4 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)4 SimpleManaAbility (mage.abilities.mana.SimpleManaAbility)4 UUID (java.util.UUID)3