rewrote party count test to allow for more easily adding additional cases

This commit is contained in:
Evan Kranzler 2020-09-05 16:50:51 -04:00
parent 437b816414
commit 91067e89cb

View file

@ -1,5 +1,9 @@
package org.mage.test.cards.dynamicvalue; package org.mage.test.cards.dynamicvalue;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.PartyCount;
import mage.abilities.effects.common.GainLifeEffect;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.SubType; import mage.constants.SubType;
@ -12,18 +16,61 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*/ */
public class PartyCountTest extends CardTestPlayerBase { public class PartyCountTest extends CardTestPlayerBase {
private static final String shpd = "Shepherd of Heroes"; private void makeTester() {
private static final String skrmshr = "Aven Skirmisher"; addCustomCardWithAbility(
private static final String dncstr = "Dromoka Dunecaster"; "tester", playerA,
private static final String ddgr = "Goldmeadow Dodger"; new SimpleActivatedAbility(
new GainLifeEffect(PartyCount.instance), new ManaCostsImpl<>("{0}")
)
);
}
private void useTester() {
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{0}:");
}
private void makeCreature(String name, SubType... subTypes) {
addCustomCardWithAbility(
name, playerA, null, null,
CardType.CREATURE, "{1}", Zone.BATTLEFIELD, subTypes
);
}
@Test @Test
public void testSingleMember() { public void testSingleMember() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5); makeTester();
addCard(Zone.HAND, playerA, shpd); makeCreature("crt1", SubType.CLERIC);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shpd); useTester();
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertLife(playerA, 21);
}
@Test
public void testSingleMember2() {
makeTester();
makeCreature("crt1", SubType.CLERIC, SubType.WIZARD);
useTester();
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertLife(playerA, 21);
}
@Test
public void testTwoMembers() {
makeTester();
makeCreature("crt1", SubType.CLERIC);
makeCreature("crt2", SubType.WARRIOR);
useTester();
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true); setStrictChooseMode(true);
execute(); execute();
@ -32,96 +79,82 @@ public class PartyCountTest extends CardTestPlayerBase {
assertLife(playerA, 22); assertLife(playerA, 22);
} }
@Test
public void testTwoMembers() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 6);
addCard(Zone.HAND, playerA, skrmshr);
addCard(Zone.HAND, playerA, shpd);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, skrmshr);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shpd);
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertLife(playerA, 24);
}
@Test @Test
public void testTwoMembers2() { public void testTwoMembers2() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 7); makeTester();
addCard(Zone.HAND, playerA, skrmshr, 2); makeCreature("crt1", SubType.CLERIC);
addCard(Zone.HAND, playerA, shpd); makeCreature("crt2", SubType.CLERIC);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, skrmshr);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, skrmshr);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shpd);
useTester();
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true); setStrictChooseMode(true);
execute(); execute();
assertAllCommandsUsed(); assertAllCommandsUsed();
assertLife(playerA, 24); assertLife(playerA, 21);
} }
@Test @Test
public void testThreeMembers() { public void testThreeMembers() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 7); makeTester();
addCard(Zone.HAND, playerA, skrmshr); makeCreature("crt1", SubType.CLERIC);
addCard(Zone.HAND, playerA, dncstr); makeCreature("crt2", SubType.WARRIOR);
addCard(Zone.HAND, playerA, shpd); makeCreature("crt3", SubType.WIZARD);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, skrmshr);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, dncstr);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shpd);
useTester();
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true); setStrictChooseMode(true);
execute(); execute();
assertAllCommandsUsed(); assertAllCommandsUsed();
assertLife(playerA, 26); assertLife(playerA, 23);
} }
private void makeCreature(String name, SubType... subTypes) { @Test
addCustomCardWithAbility(name, playerA, null, null, CardType.CREATURE, "{1}", Zone.BATTLEFIELD, subTypes); public void testThreeMembers2() {
makeTester();
makeCreature("crt1", SubType.CLERIC, SubType.WARRIOR);
makeCreature("crt2", SubType.CLERIC, SubType.WARRIOR);
makeCreature("crt3", SubType.CLERIC, SubType.WARRIOR, SubType.WIZARD);
useTester();
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertLife(playerA, 23);
} }
@Test @Test
public void testOddCombos() { public void testOddCombos() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5); makeTester();
addCard(Zone.HAND, playerA, shpd); makeCreature("crt1", SubType.ROGUE, SubType.WIZARD, SubType.WARRIOR);
makeCreature("crtA", SubType.ROGUE, SubType.WIZARD, SubType.WARRIOR); makeCreature("crt2", SubType.ROGUE, SubType.CLERIC);
makeCreature("crtB", SubType.ROGUE, SubType.CLERIC); makeCreature("crt3", SubType.CLERIC, SubType.WIZARD);
makeCreature("crtC", SubType.CLERIC, SubType.WIZARD); makeCreature("crt4", SubType.WARRIOR, SubType.WIZARD);
makeCreature("crtD", SubType.WARRIOR, SubType.WIZARD);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, shpd);
useTester();
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true); setStrictChooseMode(true);
execute(); execute();
assertAllCommandsUsed(); assertAllCommandsUsed();
assertLife(playerA, 28); assertLife(playerA, 24);
} }
@Test @Test
public void testChangelings() { public void testChangelings() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5); makeTester();
addCard(Zone.BATTLEFIELD, playerA, "Impostor of the Sixth Pride", 4); addCard(Zone.BATTLEFIELD, playerA, "Impostor of the Sixth Pride", 3);
addCard(Zone.HAND, playerA, shpd);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, shpd); useTester();
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true); setStrictChooseMode(true);
execute(); execute();
assertAllCommandsUsed(); assertAllCommandsUsed();
assertLife(playerA, 28); assertLife(playerA, 23);
} }
} }