add tests for new common classes and modified logic

This commit is contained in:
xenohedron 2024-06-02 19:08:47 -04:00
parent d8be015c65
commit a90f226053
4 changed files with 211 additions and 0 deletions

View file

@ -0,0 +1,56 @@
package org.mage.test.cards.single.roe;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author xenohedron
*/
public class ChampionsDrakeTest extends CardTestPlayerBase {
private static final String drake = "Champion's Drake"; // 1/1 Flying
// Champions Drake gets +3/+3 as long as you control a creature with three or more level counters on it.
private static final String wavewatch = "Halimar Wavewatch"; // 0/3, Level up {2}
@Test
public void testCondition() {
addCard(Zone.BATTLEFIELD, playerA, drake, 1);
addCard(Zone.BATTLEFIELD, playerA, wavewatch, 1);
addCard(Zone.BATTLEFIELD, playerA, "Wastes", 4);
checkPermanentCounters("0 level counters", 1, PhaseStep.UPKEEP, playerA, wavewatch, CounterType.LEVEL, 0);
checkPT("0 level counters", 1, PhaseStep.UPKEEP, playerA, drake, 1, 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Level up");
checkPermanentCounters("1 level counter", 1, PhaseStep.BEGIN_COMBAT, playerA, wavewatch, CounterType.LEVEL, 1);
checkPT("1 level counter", 1, PhaseStep.BEGIN_COMBAT, playerA, drake, 1, 1);
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Level up");
checkPermanentCounters("2 level counters", 1, PhaseStep.END_TURN, playerA, wavewatch, CounterType.LEVEL, 2);
checkPT("2 level counters", 1, PhaseStep.END_TURN, playerA, drake, 1, 1);
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Level up");
checkPermanentCounters("3 level counters", 3, PhaseStep.BEGIN_COMBAT, playerA, wavewatch, CounterType.LEVEL, 3);
checkPT("3 level counters", 3, PhaseStep.BEGIN_COMBAT, playerA, drake, 4, 4);
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Level up");
checkPermanentCounters("4 level counters", 3, PhaseStep.END_TURN, playerA, wavewatch, CounterType.LEVEL, 4);
checkPT("4 level counters", 3, PhaseStep.END_TURN, playerA, drake, 4, 4);
setStrictChooseMode(true);
setStopAt(4, PhaseStep.END_TURN);
execute();
assertPowerToughness(playerA, wavewatch, 0, 6);
}
}

View file

@ -0,0 +1,37 @@
package org.mage.test.cards.single.som;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author xenohedron
*/
public class DissipationFieldTest extends CardTestPlayerBase {
private static final String dissipation = "Dissipation Field";
// Whenever a permanent deals damage to you, return it to its owners hand.
private static final String rod = "Rod of Ruin";
@Test
public void testDamageTrigger() {
addCard(Zone.BATTLEFIELD, playerB, dissipation);
addCard(Zone.BATTLEFIELD, playerA, rod);
addCard(Zone.BATTLEFIELD, playerA, "Wastes", 3);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3}, {T}:", playerB);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 19);
assertPermanentCount(playerA, rod, 0);
assertHandCount(playerA, rod, 1);
}
}

View file

@ -0,0 +1,34 @@
package org.mage.test.cards.single.ulg;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author xenohedron
*/
public class NoMercyTest extends CardTestPlayerBase {
private static final String noMercy = "No Mercy";
// Whenever a creature deals damage to you, destroy it.
private static final String spider = "Grappler Spider"; // 2/1
@Test
public void testDamageTrigger() {
addCard(Zone.BATTLEFIELD, playerB, noMercy);
addCard(Zone.BATTLEFIELD, playerA, spider);
attack(1, playerA, spider, playerB);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 18);
assertPermanentCount(playerA, spider, 0);
assertGraveyardCount(playerA, spider, 1);
}
}

View file

@ -0,0 +1,84 @@
package org.mage.test.cards.single.usg;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author xenohedron
*/
public class SporogenesisTest extends CardTestPlayerBase {
@Test
public void sporogenesisTest() {
String sporogenesis = "Sporogenesis";
// At the beginning of your upkeep, you may put a fungus counter on target nontoken creature.
// Whenever a creature with a fungus counter on it dies, create a 1/1 green Saproling creature token for each fungus counter on that creature.
// When Sporogenesis leaves the battlefield, remove all fungus counters from all creatures.
String warleader = "Skophos Warleader";
// {R}, Sacrifice another creature or an enchantment: Skophos Warleader gets +1/+0 and gains menace until end of turn.
String vampire = "Barony Vampire";
String ghoul = "Warpath Ghoul";
String douser = "Douser of Lights";
addCard(Zone.BATTLEFIELD, playerA, sporogenesis);
addCard(Zone.BATTLEFIELD, playerA, warleader);
addCard(Zone.BATTLEFIELD, playerA, vampire);
addCard(Zone.BATTLEFIELD, playerA, ghoul);
addCard(Zone.BATTLEFIELD, playerA, douser);
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
// turn 1 - upkeep does happen with all on battlefield
setChoice(playerA, true);
addTarget(playerA, warleader); // fungus counter
checkPermanentCounters("no fungus", 1, PhaseStep.END_TURN, playerA, warleader, CounterType.FUNGUS, 1);
// turn 3
setChoice(playerA, true);
addTarget(playerA, warleader); // second fungus counter
checkPermanentCounters("fungus", 3, PhaseStep.END_TURN, playerA, warleader, CounterType.FUNGUS, 2);
// turn 5
setChoice(playerA, true);
addTarget(playerA, vampire); // fungus counter
checkPermanentCounters("fungus", 5, PhaseStep.END_TURN, playerA, vampire, CounterType.FUNGUS, 1);
// turn 7
setChoice(playerA, true);
addTarget(playerA, ghoul); // fungus counter
checkPermanentCounters("fungus", 7, PhaseStep.END_TURN, playerA, ghoul, CounterType.FUNGUS, 1);
// turn 9
setChoice(playerA, true);
addTarget(playerA, ghoul); // second fungus counter
checkPermanentCounters("fungus", 9, PhaseStep.PRECOMBAT_MAIN, playerA, ghoul, CounterType.FUNGUS, 2);
activateAbility(9, PhaseStep.POSTCOMBAT_MAIN, playerA, "{R}, Sacrifice");
setChoice(playerA, ghoul);
checkPT("boost", 9, PhaseStep.END_TURN, playerA, warleader, 5, 5);
// turn 11
setChoice(playerA, true);
addTarget(playerA, douser); // fungus counter
checkPermanentCounters("fungus", 11, PhaseStep.END_TURN, playerA, douser, CounterType.FUNGUS, 1);
// turn 12
activateAbility(12, PhaseStep.POSTCOMBAT_MAIN, playerA, "{R}, Sacrifice");
setChoice(playerA, sporogenesis);
checkPermanentCounters("fungus", 12, PhaseStep.END_TURN, playerA, warleader, CounterType.FUNGUS, 0);
checkPermanentCounters("fungus", 12, PhaseStep.END_TURN, playerA, vampire, CounterType.FUNGUS, 0);
checkPermanentCounters("fungus", 12, PhaseStep.END_TURN, playerA, douser, CounterType.FUNGUS, 0);
checkPT("boost", 12, PhaseStep.END_TURN, playerA, warleader, 5, 5);
setStrictChooseMode(true);
setStopAt(13, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, ghoul, 1);
assertGraveyardCount(playerA, sporogenesis, 1);
}
}