Merge remote-tracking branch 'origin/master' into m21_test

This commit is contained in:
Ingmar Goudt 2020-07-25 12:38:33 +02:00
commit 41b7439403
95 changed files with 1935 additions and 1452 deletions

View file

@ -0,0 +1,117 @@
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class PyromancersGauntletTest extends CardTestPlayerBase {
@Test
public void basicTest() {
setStrictChooseMode(true);
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
// If a red instant or sorcery spell you control or a red planeswalker you control
// would deal damage to a permanent or player, it deals that much damage plus 2 to that permanent or player instead.
addCard(Zone.BATTLEFIELD, playerA, "Pyromancer's Gauntlet"); // Artifact {5}
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Pillarfield Ox");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertLife(playerB, 15); // Bolt 3 + 2
assertGraveyardCount(playerA, "Lightning Bolt", 2);
assertGraveyardCount(playerB, "Pillarfield Ox", 1);
}
@Test
public void opponentsPyromancersGauntletAppliedToOwnPlaneswalkerTest() {
setStrictChooseMode(true);
// +1: Elementals you control get +2/+0 until end of turn.
// 1: Add {R}{R}.
// 2: Chandra, Novice Pyromancer deals 2 damage to any target.
addCard(Zone.BATTLEFIELD, playerA, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
// If a red instant or sorcery spell you control or a red planeswalker you control
// would deal damage to a permanent or player, it deals that much damage plus 2 to that permanent or player instead.
addCard(Zone.BATTLEFIELD, playerB, "Pyromancer's Gauntlet"); // Creature 2/4 {1}{R}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
addCard(Zone.BATTLEFIELD, playerB, "Barbarian Horde"); // Creature 3/3 {3}{R}
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", playerB);
attack(2, playerB, "Barbarian Horde");
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "-2:", playerA);
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", "Barbarian Horde");
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertLife(playerA, 13); // Attack from Horde 3 + Dmage 2+2 from planeswalker
assertLife(playerB, 18); // Damage from planeswalker 2
assertPermanentCount(playerB, "Barbarian Horde", 1);
assertCounterCount(playerA, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 1);
assertCounterCount(playerB, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 3);
}
@Test
public void with3PlayersTest() throws GameException {
playerC = createPlayer(currentGame, playerC, "PlayerC");
setStrictChooseMode(true);
// +1: Elementals you control get +2/+0 until end of turn.
// 1: Add {R}{R}.
// 2: Chandra, Novice Pyromancer deals 2 damage to any target.
addCard(Zone.BATTLEFIELD, playerA, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
// If a red instant or sorcery spell you control or a red planeswalker you control
// would deal damage to a permanent or player, it deals that much damage plus 2 to that permanent or player instead.
addCard(Zone.BATTLEFIELD, playerC, "Pyromancer's Gauntlet"); // Creature 2/4 {1}{R}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
addCard(Zone.BATTLEFIELD, playerB, "Barbarian Horde"); // Creature 3/3 {3}{R}
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", playerB);
attack(3, playerB, "Barbarian Horde");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerB, "-2:", playerA);
activateAbility(4, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", "Barbarian Horde");
setStopAt(4, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertLife(playerA, 15); // Attack from Horde 3 + Dmage 2 from planeswalker
assertLife(playerB, 18); // Damage from planeswalker 2
assertLife(playerC, 20);
assertPermanentCount(playerB, "Barbarian Horde", 1);
assertCounterCount(playerA, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 1);
assertCounterCount(playerB, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 3);
}
}

View file

@ -191,7 +191,6 @@ public class BestowTest extends CardTestPlayerBase {
addTarget(playerB, playerA); // Away
addTarget(playerA, "Nyxborn Rollicker");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
@ -463,4 +462,26 @@ public class BestowTest extends CardTestPlayerBase {
Assert.assertFalse("The unattached Nighthowler may not have the aura subtype.", nighthowler.getSubtype(currentGame).contains(SubType.AURA));
}
@Test
public void testCastBestowWithCostReduction() {
// Enchantment Creature Horror
// Bestow {5}{G} (If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature.)
// Trample
// Enchanted creature gets +3/+3 and has trample.
addCard(Zone.HAND, playerA, "Nylea's Emissary"); // Enchantment Creature
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // {1}{W} 2/2 creature
// Aura spells you cast cost {1} less to cast.
addCard(Zone.BATTLEFIELD, playerA, "Transcendent Envoy", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nylea's Emissary using bestow", "Silvercoat Lion");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Nylea's Emissary", 1);
assertPowerToughness(playerA, "Silvercoat Lion", 5, 5);
assertType("Nylea's Emissary", CardType.CREATURE, false);
assertType("Nylea's Emissary", CardType.ENCHANTMENT, SubType.AURA);
}
}

View file

@ -1089,7 +1089,7 @@ public class MorphTest extends CardTestPlayerBase {
}
@Test
public void test_MorphWithCostReductionMustBePlayable_MorphCondition() {
public void test_MorphWithCostReductionMustBePlayable_MorphCondition1() {
// {1}{U} creature
// Morph {1}{U} (You may cast this card face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.)
// When Willbender is turned face up, change the target of target spell or ability with a single target.
@ -1110,4 +1110,36 @@ public class MorphTest extends CardTestPlayerBase {
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
}
@Test
public void test_MorphWithCostReductionMustBePlayable_MorphCondition2() {
// {1}{U} creature
// Morph {1}{U} (You may cast this card face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.)
// When Willbender is turned face up, change the target of target spell or ability with a single target.
addCard(Zone.HAND, playerA, "Willbender", 2);
//addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
//
// The first face-down creature spell you cast each turn costs {3} less to cast.
addCard(Zone.BATTLEFIELD, playerA, "Kadena, Slinking Sorcerer");
// creature one - get cost reduce
checkPlayableAbility("can", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Willbender", true);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Willbender");
setChoice(playerA, "Yes"); // morph
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
// creature two - do not get cost reduce
checkPlayableAbility("can't by no reduce", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Willbender", false);
// on next turn it can cost reduce again
checkPlayableAbility("can't by not your turn", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Willbender", false);
checkPlayableAbility("can", 3, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Willbender", true);
setStrictChooseMode(true);
setStopAt(3, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
}
}

View file

@ -1,4 +1,3 @@
package org.mage.test.cards.abilities.oneshot.damage;
import mage.constants.PhaseStep;
@ -11,12 +10,11 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*
* @author LevelX2
*/
public class SatyrFiredancerTest extends CardTestPlayerBase {
@Test
public void testDamageFromInstantToPlayer() {
// Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls.
// Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls.
addCard(Zone.BATTLEFIELD, playerA, "Satyr Firedancer");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.HAND, playerA, "Lightning Bolt");
@ -31,20 +29,20 @@ public class SatyrFiredancerTest extends CardTestPlayerBase {
assertLife(playerA, 20);
assertLife(playerB, 17);
assertGraveyardCount(playerA, "Lightning Bolt", 1);
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
}
@Test
public void testDamageFromAttackWontTrigger() {
// Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls.
// Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls.
addCard(Zone.BATTLEFIELD, playerA, "Satyr Firedancer");
addCard(Zone.BATTLEFIELD, playerA, "Pillarfield Ox", 1);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
attack(1, playerA, "Pillarfield Ox");
attack(1, playerA, "Pillarfield Ox");
addTarget(playerA, "Silvercoat Lion");
setStopAt(1, PhaseStep.END_TURN);
@ -52,29 +50,28 @@ public class SatyrFiredancerTest extends CardTestPlayerBase {
assertLife(playerA, 20);
assertLife(playerB, 18);
assertGraveyardCount(playerB, "Silvercoat Lion", 0);
assertPermanentCount(playerB, "Silvercoat Lion", 1);
}
@Test
public void testDamageFromOtherCreature() {
// Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls.
// Whenever an instant or sorcery spell you control deals damage to an opponent, Satyr Firedancer deals that much damage to target creature that player controls.
addCard(Zone.BATTLEFIELD, playerA, "Satyr Firedancer");
// {T}: Prodigal Pyromancer deals 1 damage to any target.
addCard(Zone.BATTLEFIELD, playerA, "Prodigal Pyromancer", 1);
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals", playerB);
addTarget(playerA, playerB);
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals", playerB);
addTarget(playerA, playerB);
setStopAt(3, PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 19);
}
@Test
@ -82,6 +79,7 @@ public class SatyrFiredancerTest extends CardTestPlayerBase {
playerC = createPlayer(currentGame, playerC, "PlayerC");
addCard(Zone.BATTLEFIELD, playerA, "Satyr Firedancer", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
// Price of Progress deals damage to each player equal to twice the number of nonbasic lands that player controls.
addCard(Zone.HAND, playerA, "Price of Progress", 1);
addCard(Zone.BATTLEFIELD, playerB, "Taiga", 1);

View file

@ -84,7 +84,7 @@ public class AngelOfJubilationTest extends CardTestPlayerBase {
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{2}, Sacrifice a permanent you control: Return target creature to its owner's hand.");
addTarget(playerB, "Angel of Jubilation"); // return to hand
setChoice(playerB, "Food Chain"); // cacrifice cost
setChoice(playerB, "Food Chain"); // sacrifice cost
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);

View file

@ -240,4 +240,60 @@ public class TappedForManaRelatedTest extends CardTestPlayerBase {
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
assertManaOptions("{Any}", manaOptions);
}
@Test
public void TestEyeOfRamos() {
setStrictChooseMode(true);
// {T}: Add {U}.
// Sacrifice Eye of Ramos: Add {U}.
addCard(Zone.BATTLEFIELD, playerA, "Eye of Ramos", 2);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
assertManaOptions("{U}{U}{U}{U}", manaOptions);
}
@Test
public void TestFarrelitePriest() {
setStrictChooseMode(true);
// {1}: Add {W}. If this ability has been activated four or more times this turn, sacrifice Farrelite Priest at the beginning of the next end step.
addCard(Zone.BATTLEFIELD, playerA, "Farrelite Priest", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 5, manaOptions.size());
assertManaOptions("{W}{W}{W}{W}", manaOptions);
assertManaOptions("{W}{W}{W}{B}", manaOptions);
assertManaOptions("{W}{W}{B}{B}", manaOptions);
assertManaOptions("{W}{B}{B}{B}", manaOptions);
assertManaOptions("{B}{B}{B}{B}", manaOptions);
}
@Test
public void TestMorselhoarder() {
setStrictChooseMode(true);
// Morselhoarder enters the battlefield with two -1/-1 counters on it.
// Remove a -1/-1 counter from Morselhoarder: Add one mana of any color.
addCard(Zone.BATTLEFIELD, playerA, "Morselhoarder", 2);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
assertManaOptions("{B}{B}{Any}{Any}{Any}{Any}", manaOptions);
}
}

View file

@ -0,0 +1,114 @@
package org.mage.test.cards.single.eld;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class TorbranThaneOfRedFellTest extends CardTestPlayerBase {
@Test
public void basicTest() {
setStrictChooseMode(true);
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
// If a red source you control would deal damage to an opponent or a permanent an opponent controls,
// it deals that much damage plus 2 instead.
addCard(Zone.BATTLEFIELD, playerA, "Torbran, Thane of Red Fell"); // Creature 2/4 {1}{R}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox");
attack(1, playerA, "Torbran, Thane of Red Fell");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Pillarfield Ox");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertLife(playerB, 11); // damage from: attack 2 + 2 Bolt 3 + 2
assertGraveyardCount(playerA, "Lightning Bolt", 2);
assertGraveyardCount(playerB, "Pillarfield Ox", 1);
}
@Test
public void opponentsTornbanAppliedToOwnPlaneswalkerTest() {
setStrictChooseMode(true);
// +1: Elementals you control get +2/+0 until end of turn.
// 1: Add {R}{R}.
// 2: Chandra, Novice Pyromancer deals 2 damage to any target.
addCard(Zone.BATTLEFIELD, playerA, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
// If a red source you control would deal damage to an opponent or a permanent an opponent controls,
// it deals that much damage plus 2 instead.
addCard(Zone.BATTLEFIELD, playerB, "Torbran, Thane of Red Fell"); // Creature 2/4 {1}{R}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Barbarian Horde"); // Creature 3/3 {3}{R}
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", playerB);
attack(2, playerB, "Barbarian Horde");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", "Barbarian Horde");
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertLife(playerA, 15); // Attack from Horde 3+2
assertLife(playerB, 18); // Damage from planeswalker 2
assertPermanentCount(playerB, "Barbarian Horde", 1);
assertCounterCount("Chandra, Novice Pyromancer", CounterType.LOYALTY, 1);
}
@Test
public void with3PlayersTest() throws GameException {
playerC = createPlayer(currentGame, playerC, "PlayerC");
setStrictChooseMode(true);
// +1: Elementals you control get +2/+0 until end of turn.
// 1: Add {R}{R}.
// 2: Chandra, Novice Pyromancer deals 2 damage to any target.
addCard(Zone.BATTLEFIELD, playerA, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
// If a red source you control would deal damage to an opponent or a permanent an opponent controls,
// it deals that much damage plus 2 instead.
addCard(Zone.BATTLEFIELD, playerC, "Torbran, Thane of Red Fell"); // Creature 2/4 {1}{R}{R}{R}
addCard(Zone.BATTLEFIELD, playerB, "Barbarian Horde"); // Creature 3/3 {3}{R}
addCard(Zone.BATTLEFIELD, playerB, "Chandra, Novice Pyromancer"); // Planeswalker (5) {3}{R}
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", playerB);
attack(3, playerB, "Barbarian Horde", playerA);
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerB, "-2:", playerA);
activateAbility(4, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:", "Barbarian Horde");
setStopAt(4, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertLife(playerA, 15); // Attack from Horde 3+2
assertLife(playerB, 18); // Damage from planeswalker 2
assertPermanentCount(playerB, "Barbarian Horde", 1);
assertCounterCount(playerA, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 1);
assertCounterCount(playerB, "Chandra, Novice Pyromancer", CounterType.LOYALTY, 3);
}
}