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