Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Susucre committed Jun 2, 2024
1 parent f6bcb03 commit afe1b56
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mage.test.cards.watchers;
package org.mage.test.cards.single.aer;

import mage.constants.PhaseStep;
import mage.constants.Zone;
Expand All @@ -7,7 +7,6 @@
import org.mage.test.serverside.base.CardTestPlayerBase;

/**
*
* @author escplan9
*/
public class GontisMachinationsTest extends CardTestPlayerBase {
Expand All @@ -19,57 +18,59 @@ public class GontisMachinationsTest extends CardTestPlayerBase {
Pay {E}{E}, Sacrifice Gonti's Machinations: Each opponent loses 3 life. You gain life equal to the life lost this way.
*/
private final String gMachinations = "Gonti's Machinations";

/*
* Reported bug: [[Gonti's Machinations]] currently triggers and gain 1 energy whenever you lose life instead of only the first life loss of each turn.
* See issue #3499 (test is currently failing due to bug in code)
*/
* See issue #3499 for context
*/
@Test
public void machinations_ThreeCreaturesCombatDamage_OneTrigger() {

setStrictChooseMode(true);

String memnite = "Memnite"; // {0} 1/1
String gBears = "Grizzly Bears"; // {1}{G} 2/2
String hGiant = "Hill Giant"; // {2}{R} 3/3

addCard(Zone.BATTLEFIELD, playerB, gMachinations);
addCard(Zone.BATTLEFIELD, playerA, memnite);
addCard(Zone.BATTLEFIELD, playerA, gBears);
addCard(Zone.BATTLEFIELD, playerA, hGiant);

attack(3, playerA, memnite);
attack(3, playerA, gBears);
attack(3, playerA, hGiant);

setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();

assertTapped(memnite, true);
assertTapped(gBears, true);
assertTapped(hGiant, true);
assertLife(playerB, 14); // 1 + 2 + 3 damage
assertCounterCount(playerB, CounterType.ENERGY, 1);
}

/*
* Reported bug: [[Gonti's Machinations]] currently triggers and gain 1 energy whenever you lose life instead of only the first life loss of each turn.
* See issue #3499 (test is currently failing due to bug in code)
*/
* See issue #3499 for context
*/
@Test
public void machinations_NonCombatDamageThreeTimes_OneTrigger() {

setStrictChooseMode(true);

String bolt = "Lightning Bolt"; // {R} deal 3

addCard(Zone.BATTLEFIELD, playerB, gMachinations);
addCard(Zone.HAND, playerA, bolt, 3);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);

castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, playerB);

setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();

assertTappedCount("Mountain", true, 3);
assertGraveyardCount(playerA, bolt, 3);
assertLife(playerB, 11); // 3 x 3 damage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
public class ExquisiteBloodTest extends CardTestPlayerBase {

@Test
public void BasicCardTest() {
public void basicCardTest() {
setStrictChooseMode(true);

addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);

Expand Down Expand Up @@ -48,6 +50,8 @@ public void BasicCardTest() {
*/
@Test
public void triggerCascadeTest() {
setStrictChooseMode(true);

// +2: You gain 2 life. Put two +1/+1 counters on up to one target creature.
// −3: Exile target creature. Its controller gains 2 life.
// −10: Creatures you control gain flying and double strike until end of turn.
Expand Down Expand Up @@ -90,6 +94,8 @@ public void triggerCascadeTest() {
*/
@Test
public void triggerCascadeAjaniSecondAbilityTest() {
setStrictChooseMode(true);

// +2: You gain 2 life. Put two +1/+1 counters on up to one target creature.
// −3: Exile target creature. Its controller gains 2 life.
// −10: Creatures you control gain flying and double strike until end of turn.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package org.mage.test.cards.single.snc;

import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;

/**
* @author Susucr
*/
public class VampireScrivenerTest extends CardTestPlayerBase {

/**
* {@link mage.cards.v.VampireScrivener Vampire Scrivener} {4}{B}
* Creature — Vampire Warlock
* Flying
* Whenever you gain life during your turn, put a +1/+1 counter on Vampire Scrivener.
* Whenever you lose life during your turn, put a +1/+1 counter on Vampire Scrivener.
* 2/2
*/
private static final String scrivener = "Vampire Scrivener";

@Test
public void test_LoseLife_Twice() {
setStrictChooseMode(true);

addCard(Zone.BATTLEFIELD, playerA, scrivener, 1);
addCard(Zone.BATTLEFIELD, playerA, "Battlefield Forge"); // painland
addCard(Zone.HAND, playerA, "Lightning Bolt");

activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); // cause 1 trigger
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA); // cause 1 trigger

setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();

assertLife(playerA, 20 - 3 - 1);
assertCounterCount(playerA, scrivener, CounterType.P1P1, 2);
}

@Test
public void test_RakdosCharm() {
setStrictChooseMode(true);

addCard(Zone.BATTLEFIELD, playerA, scrivener, 1);
addCard(Zone.BATTLEFIELD, playerA, "Kobolds of Kher Keep", 3);
addCard(Zone.BATTLEFIELD, playerA, "Badlands", 2);
addCard(Zone.HAND, playerA, "Rakdos Charm");

castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rakdos Charm");
setModeChoice(playerA, "3"); // Choose third mode

setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();

assertLife(playerA, 20 - 4);
assertCounterCount(playerA, scrivener, CounterType.P1P1, 1);
}

@Test
public void test_RakdosCharm_NotYourTurn() {
setStrictChooseMode(true);

addCard(Zone.BATTLEFIELD, playerA, scrivener, 1);
addCard(Zone.BATTLEFIELD, playerA, "Kobolds of Kher Keep", 3);
addCard(Zone.BATTLEFIELD, playerA, "Badlands", 2);
addCard(Zone.HAND, playerA, "Rakdos Charm");

castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Rakdos Charm");
setModeChoice(playerA, "3"); // Choose third mode

setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();

assertLife(playerA, 20 - 4);
assertCounterCount(playerA, scrivener, CounterType.P1P1, 0); // No trigger, as not your turn.
}
}

0 comments on commit afe1b56

Please sign in to comment.