Search in sources :

Example 1 with ArtifactWallToken

use of mage.game.permanent.token.ArtifactWallToken in project mage by magefree.

the class CommanderAffinityTest method test_Gained_Affinity.

@Test
public void test_Gained_Affinity() {
    // bug: Mycosynth Golem did not allow my commander, Karn, Silver Golem, to cost 0 even though I had 7+ artifacts on the board.
    Ability ability = new SimpleActivatedAbility(Zone.ALL, new CreateTokenEffect(new ArtifactWallToken(), 7), new ManaCostsImpl("R"));
    addCustomCardWithAbility("generate tokens", playerA, ability);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
    // 
    // {5}
    addCard(Zone.COMMAND, playerA, "Karn, Silver Golem", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
    // 
    // Destroy target artifact.
    // {1}{R}
    addCard(Zone.HAND, playerA, "Ancient Grudge", 1);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
    // 
    // Artifact creature spells you cast have affinity for artifacts. (They cost {1} less to cast for each artifact you control.)
    addCard(Zone.BATTLEFIELD, playerA, "Mycosynth Golem", 1);
    // Affinity for artifacts
    // Artifact creature spells you cast have affinity for artifacts.
    // addCard(Zone.BATTLEFIELD, playerA, "Mycosynth Golem");
    // addCard(Zone.HAND, playerA, "Alpha Myr"); // Creature - Myr  2/1
    checkCommandCardCount("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Karn, Silver Golem", 1);
    checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Karn, Silver Golem", true);
    // first cast for 5 and destroy (prepare commander with additional cost)
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Karn, Silver Golem");
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ancient Grudge", "Karn, Silver Golem");
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkCommandCardCount("after destroy ", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Karn, Silver Golem", 1);
    checkPlayableAbility("after destroy", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Karn, Silver Golem", false);
    // move to command zone
    setChoice(playerA, true);
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    // can't do the second cast with additional cost (must pay 2 + 5, but have only R)
    checkPlayableAbility("after move", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Karn, Silver Golem", false);
    // generate artifact tokens
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: Create");
    waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
    checkPermanentCount("after tokens", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wall", 7);
    checkPlayableAbility("after tokens", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Karn, Silver Golem", true);
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) Ability(mage.abilities.Ability) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) ArtifactWallToken(mage.game.permanent.token.ArtifactWallToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) Test(org.junit.Test)

Aggregations

Ability (mage.abilities.Ability)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 ArtifactWallToken (mage.game.permanent.token.ArtifactWallToken)1 Test (org.junit.Test)1