Search in sources :

Example 16 with DamageTargetEffect

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

the class OutcomesTest method test_FromAbility_Multi.

@Test
public void test_FromAbility_Multi() {
    Ability abilityGood = new SimpleStaticAbility(new GainLifeEffect(10));
    abilityGood.addEffect(new BoostSourceEffect(10, 10, Duration.EndOfTurn));
    abilityGood.addCustomOutcome(Outcome.Detriment);
    Assert.assertEquals(-1 + -1, abilityGood.getEffects().getOutcomeScore(abilityGood));
    Ability abilityBad = new SimpleStaticAbility(new DamageTargetEffect(10));
    abilityBad.addEffect(new ExileTargetEffect());
    abilityBad.addCustomOutcome(Outcome.Neutral);
    Assert.assertEquals(1 + 1, abilityBad.getEffects().getOutcomeScore(abilityBad));
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) LeavesBattlefieldTriggeredAbility(mage.abilities.common.LeavesBattlefieldTriggeredAbility) Ability(mage.abilities.Ability) BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect) ExileTargetEffect(mage.abilities.effects.common.ExileTargetEffect) Test(org.junit.Test)

Example 17 with DamageTargetEffect

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

the class InfernoOfTheStarMountsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    if (permanent != null && permanent.getPower().getValue() == 20) {
        ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(20), false, this.staticText);
        ability.addTarget(new TargetAnyTarget());
        game.fireReflexiveTriggeredAbility(ability, source);
        return true;
    }
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) ReflexiveTriggeredAbility(mage.abilities.common.delayed.ReflexiveTriggeredAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) TargetAnyTarget(mage.target.common.TargetAnyTarget)

Example 18 with DamageTargetEffect

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

the class ManaPoolTest method test_MultipleMana_OneXAbility.

@Test
public void test_MultipleMana_OneXAbility() {
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
    // 
    Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl("{X}"));
    ability.addTarget(new TargetAnyTarget());
    addCustomCardWithAbility("damage X", playerA, ability);
    // make mana
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
    checkManaPool("mana", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "R", 4);
    // use for ability
    // showAvailableAbilities("before ability", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{X}:", playerB);
    setChoice(playerA, "X=3");
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkManaPool("mana", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "R", 4 - 3);
    checkLife("after", 1, PhaseStep.END_TURN, playerB, 20 - 3);
    setStopAt(1, PhaseStep.END_TURN);
    setStrictChooseMode(true);
    execute();
    assertAllCommandsUsed();
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) Ability(mage.abilities.Ability) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) TargetAnyTarget(mage.target.common.TargetAnyTarget) Test(org.junit.Test)

Example 19 with DamageTargetEffect

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

the class ManaPoolTest method test_ConditionalMana_OneXPart.

@Test
public void test_ConditionalMana_OneXPart() {
    // {R}
    addCard(Zone.HAND, playerA, "Lightning Bolt");
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
    // 
    addCustomCardWithAbility("add 10", playerA, new SimpleManaAbility(Zone.ALL, new AddConditionalManaEffect(Mana.RedMana(10), new SimpleActivatedAbilityManaBuilder()), new ManaCostsImpl("")));
    // 
    Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl(""));
    ability.addTarget(new TargetAnyTarget());
    addCustomCardWithAbility("damage X", playerA, ability);
    // 
    // {X}: Counter target spell
    ability = new SimpleActivatedAbility(Zone.ALL, new CounterUnlessPaysEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl("{X}"));
    ability.addTarget(new TargetSpell());
    addCustomCardWithAbility("counter until pay X", playerB, ability);
    addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
    // make mana for spell
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
    checkManaPool("mana spell", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "R", 1);
    // cast spell
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
    // make mana for pay X to prevent
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {R}");
    checkManaPool("mana prevent", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "R", 10);
    // counter by X=3
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{X}: Counter");
    setChoice(playerB, "X=3");
    addTarget(playerB, "Lightning Bolt");
    // pay to prevent
    // pay 3 to prevent counter
    setChoice(playerA, true);
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkManaPool("mana after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "R", 10 + 1 - 1 - 3);
    checkLife("after", 1, PhaseStep.END_TURN, playerB, 20 - 3);
    setStopAt(1, PhaseStep.END_TURN);
    setStrictChooseMode(true);
    execute();
    assertAllCommandsUsed();
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) Ability(mage.abilities.Ability) AddConditionalManaEffect(mage.abilities.effects.mana.AddConditionalManaEffect) CounterUnlessPaysEffect(mage.abilities.effects.common.CounterUnlessPaysEffect) SimpleActivatedAbilityManaBuilder(mage.abilities.mana.builder.common.SimpleActivatedAbilityManaBuilder) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) TargetSpell(mage.target.TargetSpell) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) TargetAnyTarget(mage.target.common.TargetAnyTarget) Test(org.junit.Test)

Example 20 with DamageTargetEffect

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

the class FlameKinWarScourEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
    if (permanent != null) {
        if (permanent.sacrifice(source, game)) {
            Effect effect = new DamageTargetEffect(4).setText("{this} deals 4 damage to it");
            effect.setTargetPointer(this.getTargetPointer());
            return effect.apply(game, source);
        }
    }
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect)

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