Search in sources :

Example 36 with SimpleStaticAbility

use of mage.abilities.common.SimpleStaticAbility 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 37 with SimpleStaticAbility

use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.

the class ConditionalPreventionTest method test_PreventDamageNormal.

@Test
public void test_PreventDamageNormal() {
    addCustomCardWithAbility("prevent", playerA, new SimpleStaticAbility(new PreventAllDamageToAllEffect(Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT)));
    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) PreventAllDamageToAllEffect(mage.abilities.effects.common.PreventAllDamageToAllEffect) Test(org.junit.Test)

Example 38 with SimpleStaticAbility

use of mage.abilities.common.SimpleStaticAbility 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)

Example 39 with SimpleStaticAbility

use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.

the class EndOfTurnMultiOpponentsTest method test_UntilYourNextTurnMulti.

@Test
public void test_UntilYourNextTurnMulti() {
    // Player order: A -> D -> C -> B
    addCustomCardWithAbility("boost1", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, Duration.UntilYourNextTurn)));
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 1, playerA, true, PhaseStep.END_TURN);
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 2, playerD, true, PhaseStep.END_TURN);
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 3, playerC, true, PhaseStep.END_TURN);
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 4, playerB, true, PhaseStep.END_TURN);
    // 
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 5, playerA, true, null);
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 6, playerD, true, null);
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 7, playerC, true, null);
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 8, playerB, true, null);
    // 
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 9, playerA, true, null);
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 10, playerD, true, null);
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 11, playerC, true, null);
    EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 12, playerB, true, null);
    addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
    addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
    addCard(Zone.BATTLEFIELD, playerC, cardBear2, 1);
    addCard(Zone.BATTLEFIELD, playerD, cardBear2, 1);
    attack(1, playerA, cardBear2);
    attack(2, playerD, cardBear2);
    attack(3, playerC, cardBear2);
    attack(4, playerB, cardBear2);
    // 
    attack(5, playerA, cardBear2);
    attack(6, playerD, cardBear2);
    attack(7, playerC, cardBear2);
    attack(8, playerB, cardBear2);
    // 
    attack(9, playerA, cardBear2);
    attack(10, playerD, cardBear2);
    attack(11, playerC, cardBear2);
    attack(12, playerB, cardBear2);
    setStopAt(12, PhaseStep.CLEANUP);
    setStrictChooseMode(true);
    execute();
    assertAllCommandsUsed();
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) BoostAllEffect(mage.abilities.effects.common.continuous.BoostAllEffect) Test(org.junit.Test)

Example 40 with SimpleStaticAbility

use of mage.abilities.common.SimpleStaticAbility in project mage by magefree.

the class ConditionalCostModificationTest method test_ModificationConditionalNotActiveWithOtherEffect.

@Test
public void test_ModificationConditionalNotActiveWithOtherEffect() {
    addCustomCardWithAbility("mod", playerA, new SimpleStaticAbility(new ConditionalCostModificationEffect(new AbilitiesCostReductionControllerEffect(EquipAbility.class, "equip"), NotMyTurnCondition.instance, new SpellsCostIncreasingAllEffect(1, new FilterCard(), TargetController.ANY), "")));
    addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Dagger of the Worthy", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
    addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
    // no mod, 2 cost
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", "Balduvian Bears");
    // +1 for spell, 2 cost
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
    assertTappedCount("Mountain", true, 4);
    assertTappedCount("Mountain", false, 0);
    assertLife(playerB, 20 - 3);
}
Also used : FilterCard(mage.filter.FilterCard) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) ConditionalCostModificationEffect(mage.abilities.decorator.ConditionalCostModificationEffect) AbilitiesCostReductionControllerEffect(mage.abilities.effects.common.cost.AbilitiesCostReductionControllerEffect) EquipAbility(mage.abilities.keyword.EquipAbility) SpellsCostIncreasingAllEffect(mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect) Test(org.junit.Test)

Aggregations

SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)61 Test (org.junit.Test)27 Ability (mage.abilities.Ability)21 Player (mage.players.Player)14 Permanent (mage.game.permanent.Permanent)11 InfoEffect (mage.abilities.effects.common.InfoEffect)10 BoostAllEffect (mage.abilities.effects.common.continuous.BoostAllEffect)10 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)9 Card (mage.cards.Card)9 FixedTarget (mage.target.targetpointer.FixedTarget)9 UUID (java.util.UUID)8 LeavesBattlefieldTriggeredAbility (mage.abilities.common.LeavesBattlefieldTriggeredAbility)6 ContinuousEffect (mage.abilities.effects.ContinuousEffect)6 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)6 FilterCard (mage.filter.FilterCard)5 MageObject (mage.MageObject)4 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)4 PreventAllDamageToAllEffect (mage.abilities.effects.common.PreventAllDamageToAllEffect)4 BoostSourceEffect (mage.abilities.effects.common.continuous.BoostSourceEffect)4 AbilitiesCostReductionControllerEffect (mage.abilities.effects.common.cost.AbilitiesCostReductionControllerEffect)4