Search in sources :

Example 1 with PlayFromNotOwnHandZoneAllEffect

use of mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneAllEffect in project mage by magefree.

the class FeatherTheRedeemedTest method test_ExileSpellAndRecastWithoutReturn.

@Test
public void test_ExileSpellAndRecastWithoutReturn() {
    // cast bolt, put to exile, cast from exile with different target, put to graveyard, not return
    addCustomCardWithAbility("cast from exile", playerA, new SimpleStaticAbility(new PlayFromNotOwnHandZoneAllEffect(StaticFilters.FILTER_CARD, Zone.EXILED, false, TargetController.ANY, Duration.WhileOnBattlefield)));
    addCard(Zone.BATTLEFIELD, playerA, "Feather, the Redeemed");
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
    addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 3);
    // cast and put to exile
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Grizzly Bears");
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkPermanentCount("turn 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", 3 - 1);
    checkExileCount("turn 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 1);
    checkHandCardCount("turn 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 0);
    // cast from exile to target player (without trigger) and put to graveyard
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    // no changes
    checkPermanentCount("turn 1 recast", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", 3 - 1);
    checkLife("turn 1 recast", 1, PhaseStep.PRECOMBAT_MAIN, playerB, 20 - 3);
    checkExileCount("turn 1 recast", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 0);
    checkHandCardCount("turn 1 recast", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 0);
    // not return to hand at the next end step
    checkExileCount("turn 1 after", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 0);
    checkHandCardCount("turn 1 after", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 0);
    setStrictChooseMode(true);
    setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
    execute();
    assertAllCommandsUsed();
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) PlayFromNotOwnHandZoneAllEffect(mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneAllEffect) Test(org.junit.Test)

Example 2 with PlayFromNotOwnHandZoneAllEffect

use of mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneAllEffect in project mage by magefree.

the class FeatherTheRedeemedTest method test_ExileSpellAndRecastWithReturnAtTheEnd.

@Test
public void test_ExileSpellAndRecastWithReturnAtTheEnd() {
    // cast bolt, put to exile, cast from exile, put to exile, return to hand
    addCustomCardWithAbility("cast from exile", playerA, new SimpleStaticAbility(new PlayFromNotOwnHandZoneAllEffect(StaticFilters.FILTER_CARD, Zone.EXILED, false, TargetController.ANY, Duration.WhileOnBattlefield)));
    addCard(Zone.BATTLEFIELD, playerA, "Feather, the Redeemed");
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
    addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 3);
    // cast and put to exile
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Grizzly Bears");
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkPermanentCount("turn 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", 3 - 1);
    checkExileCount("turn 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 1);
    checkHandCardCount("turn 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 0);
    // cast from exile and put to exile again
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Grizzly Bears");
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkPermanentCount("turn 1 recast", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", 3 - 2);
    checkExileCount("turn 1 recast", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 1);
    checkHandCardCount("turn 1 recast", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 0);
    // return to hand at the next end step
    // two triggeres from two cast (card's code adds two same effects on each trigger)
    setChoice(playerA, "At the beginning of the next end step");
    checkExileCount("turn 1 after", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 0);
    checkHandCardCount("turn 1 after", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 1);
    setStrictChooseMode(true);
    setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
    execute();
    assertAllCommandsUsed();
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) PlayFromNotOwnHandZoneAllEffect(mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneAllEffect) Test(org.junit.Test)

Example 3 with PlayFromNotOwnHandZoneAllEffect

use of mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneAllEffect in project mage by magefree.

the class ConditionalAsThoughTest method test_PlayFromNotOwnHandZoneAllEffect.

@Test
public void test_PlayFromNotOwnHandZoneAllEffect() {
    removeAllCardsFromLibrary(playerA);
    removeAllCardsFromLibrary(playerB);
    addCustomCardWithAbility("play any library on any creature", playerA, new SimpleStaticAbility(Zone.ALL, new ConditionalAsThoughEffect(new PlayFromNotOwnHandZoneAllEffect(StaticFilters.FILTER_CARD, Zone.LIBRARY, false, TargetController.ANY, Duration.EndOfTurn), new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_PERMANENT_CREATURE, ComparisonType.MORE_THAN, 0))));
    addCard(Zone.HAND, playerA, "Grizzly Bears");
    addCard(Zone.LIBRARY, playerA, "Silvercoat Lion");
    addCard(Zone.LIBRARY, playerB, "Lightning Bolt");
    addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
    addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
    // can't play lib's card before good condition
    checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Grizzly Bears", true);
    checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Silvercoat Lion", false);
    checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", false);
    // make good condition - now we can play any lib's card
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears");
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkPlayableAbility("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Grizzly Bears", false);
    checkPlayableAbility("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Silvercoat Lion", true);
    checkPlayableAbility("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", true);
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
    execute();
    assertAllCommandsUsed();
}
Also used : ConditionalAsThoughEffect(mage.abilities.decorator.ConditionalAsThoughEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) PermanentsOnTheBattlefieldCondition(mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition) PlayFromNotOwnHandZoneAllEffect(mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneAllEffect) Test(org.junit.Test)

Aggregations

SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)3 PlayFromNotOwnHandZoneAllEffect (mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneAllEffect)3 Test (org.junit.Test)3 PermanentsOnTheBattlefieldCondition (mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition)1 ConditionalAsThoughEffect (mage.abilities.decorator.ConditionalAsThoughEffect)1