Alternative cost - fixed that it doesn't allow to cast cards that was affected by cost modification effects (example: Prowl ability, see #6698);

This commit is contained in:
Oleg Agafonov 2020-07-05 23:11:47 +04:00
parent f9a9a55f7b
commit 1e744a0aae
12 changed files with 218 additions and 114 deletions

View file

@ -1,75 +1,77 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class ProwlTest extends CardTestPlayerBase {
@Ignore // have not figured out how to have the test API cast a card using Prowl yet
@Test
public void testBasicProwlCasting() {
public void test_ProwlNormal() {
// Auntie's Snitch {2}{B} Creature Goblin Rogue (3/1)
// Auntie's Snitch can't block.
// Prowl {1}{B} (You may cast this for its prowl cost if you dealt combat damage to a player this turn with a Goblin or Rogue.)
// Whenever a Goblin or Rogue you control deals combat damage to a player, if Auntie's Snitch is in your graveyard, you may return Auntie's Snitch to your hand.
addCard(Zone.HAND, playerA, "Auntie's Snitch");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
//
// {1}{R} Creature Goblin Warrior 1/1
// Red creatures you control have first strike.
addCard(Zone.BATTLEFIELD, playerA, "Bloodmark Mentor");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.BATTLEFIELD, playerA, "Bloodmark Mentor");
// prepare prowl condition
checkPlayableAbility("can't", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Auntie's Snitch", false);
attack(1, playerA, "Bloodmark Mentor");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Auntie's Snitch using prowl");
checkPlayableAbility("must play", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cast Auntie's Snitch", true);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Auntie's Snitch");
setChoice(playerA, "Yes"); // choosing to pay prowl cost
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertLife(playerB, 19);
assertPermanentCount(playerA, "Bloodmark Mentor", 1);
assertPermanentCount(playerA, "Auntie's Snitch", 1);
}
/*
* Reported bug: Prowl is not taking into consideration other cost reducing effects. For instance Goblin Warchief
* does not reduce the Prowl cost of other Goblin cards with Prowl ability.
*/
@Ignore // have not figured out how to have the test API cast a card using Prowl yet
*/
@Test
public void testProwlWithCostDiscount() {
public void test_ProwlWithCostReduce() {
// Auntie's Snitch {2}{B} Creature Goblin Rogue (3/1)
// Auntie's Snitch can't block.
// Prowl {1}{B} (You may cast this for its prowl cost if you dealt combat damage to a player this turn with a Goblin or Rogue.)
// Whenever a Goblin or Rogue you control deals combat damage to a player, if Auntie's Snitch is in your graveyard, you may return Auntie's Snitch to your hand.
addCard(Zone.HAND, playerA, "Auntie's Snitch");
addCard(Zone.HAND, playerA, "Auntie's Snitch");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
// Goblin Warchief {1}{R}{R} Creature Goblin Warrior (2/2)
// Goblin spells you cast cost 1 less to cast.
// Goblin creatures you control have haste.
addCard(Zone.BATTLEFIELD, playerA, "Goblin Warchief");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
// prepare prowl condition
checkPlayableAbility("can't", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Auntie's Snitch", false);
attack(1, playerA, "Goblin Warchief");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Auntie's Snitch using prowl"); // should only cost {B} with Warchief discount
checkPlayableAbility("must play", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cast Auntie's Snitch", true);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Auntie's Snitch"); // should only cost {B} with Warchief discount
setChoice(playerA, "Yes"); // choosing to pay prowl cost
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertLife(playerB, 18);
assertPermanentCount(playerA, "Goblin Warchief", 1);
assertPermanentCount(playerA, "Auntie's Snitch", 1);

View file

@ -129,10 +129,15 @@ public class PlayFromNonHandZoneTest extends CardTestPlayerBase {
attack(2, playerB, "Narset, Enlightened Master");
checkPlayableAbility("must play", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Cast Cathartic Reunion", true);
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Cathartic Reunion");
setChoice(playerB, "Swamp^Forest");
setStrictChooseMode(true);
setStopAt(2, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertHandCount(playerB, 3);
assertGraveyardCount(playerB, "Forest", 1);