Search in sources :

Example 1 with ConditionalPreventionEffect

use of mage.abilities.decorator.ConditionalPreventionEffect in project mage by magefree.

the class ConditionalPreventionTest method test_PreventDamageConditionalNotActiveWithOtherEffect.

@Test
public void test_PreventDamageConditionalNotActiveWithOtherEffect() {
    addCustomCardWithAbility("prevent", playerA, new SimpleStaticAbility(new ConditionalPreventionEffect(new PreventAllDamageToAllEffect(Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT), new PreventAllDamageToPlayersEffect(Duration.WhileOnBattlefield, false), NotMyTurnCondition.instance, "")));
    addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
    addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
    // will prevent
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Balduvian Bears");
    // will not prevent
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
    // not prevented, dies
    assertPermanentCount(playerA, "Balduvian Bears", 0);
    // prevented, no damage
    assertLife(playerA, 20);
    assertHandCount(playerA, "Lightning Bolt", 0);
}
Also used : PreventAllDamageToPlayersEffect(mage.abilities.effects.common.PreventAllDamageToPlayersEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) ConditionalPreventionEffect(mage.abilities.decorator.ConditionalPreventionEffect) PreventAllDamageToAllEffect(mage.abilities.effects.common.PreventAllDamageToAllEffect) Test(org.junit.Test)

Example 2 with ConditionalPreventionEffect

use of mage.abilities.decorator.ConditionalPreventionEffect in project mage by magefree.

the class ConditionalPreventionTest method test_PreventDamageConditionalActive.

@Test
public void test_PreventDamageConditionalActive() {
    addCustomCardWithAbility("prevent", playerA, new SimpleStaticAbility(new ConditionalPreventionEffect(new PreventAllDamageToAllEffect(Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT), MyTurnCondition.instance, "")));
    addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
    addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Balduvian Bears");
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
    assertPermanentCount(playerA, "Balduvian Bears", 1);
    assertHandCount(playerA, "Lightning Bolt", 0);
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) ConditionalPreventionEffect(mage.abilities.decorator.ConditionalPreventionEffect) PreventAllDamageToAllEffect(mage.abilities.effects.common.PreventAllDamageToAllEffect) Test(org.junit.Test)

Example 3 with ConditionalPreventionEffect

use of mage.abilities.decorator.ConditionalPreventionEffect in project mage by magefree.

the class ConditionalPreventionTest method test_PreventDamageConditionalNotActive.

@Test
public void test_PreventDamageConditionalNotActive() {
    addCustomCardWithAbility("prevent", playerA, new SimpleStaticAbility(new ConditionalPreventionEffect(new PreventAllDamageToAllEffect(Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT), NotMyTurnCondition.instance, "")));
    addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
    addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Balduvian Bears");
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
    assertPermanentCount(playerA, "Balduvian Bears", 0);
    assertHandCount(playerA, "Lightning Bolt", 0);
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) ConditionalPreventionEffect(mage.abilities.decorator.ConditionalPreventionEffect) PreventAllDamageToAllEffect(mage.abilities.effects.common.PreventAllDamageToAllEffect) Test(org.junit.Test)

Aggregations

SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)3 ConditionalPreventionEffect (mage.abilities.decorator.ConditionalPreventionEffect)3 PreventAllDamageToAllEffect (mage.abilities.effects.common.PreventAllDamageToAllEffect)3 Test (org.junit.Test)3 PreventAllDamageToPlayersEffect (mage.abilities.effects.common.PreventAllDamageToPlayersEffect)1