added tests for sagas

This commit is contained in:
Evan Kranzler 2021-06-13 21:38:54 -04:00
parent dfc2624d32
commit 67a5ca5f89

View file

@ -0,0 +1,157 @@
package org.mage.test.cards.enchantments;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author TheElk801
*/
public class SagaTest extends CardTestPlayerBase {
private static final String rite = "Rite of Belzenlok";
private static final String boomerang = "Boomerang";
private static final String saga = "Urza's Saga";
private static final String moon = "Blood Moon";
@Test
public void testRiteOfBelzenlok() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
addCard(Zone.HAND, playerA, rite);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, rite);
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
assertCounterCount(rite, CounterType.LORE, 1);
assertPermanentCount(playerA, "Cleric", 2);
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute();
assertCounterCount(rite, CounterType.LORE, 2);
assertPermanentCount(playerA, "Cleric", 4);
setStopAt(5, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerA, rite, 1);
assertPermanentCount(playerA, rite, 0);
assertPermanentCount(playerA, "Cleric", 4);
assertPermanentCount(playerA, "Demon", 1);
}
@Test
public void testRiteOfBelzenlokBounced() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
addCard(Zone.HAND, playerA, rite);
addCard(Zone.HAND, playerA, boomerang);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, rite);
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
assertCounterCount(rite, CounterType.LORE, 1);
assertPermanentCount(playerA, "Cleric", 2);
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute();
assertCounterCount(rite, CounterType.LORE, 2);
assertPermanentCount(playerA, "Cleric", 4);
castSpell(5, PhaseStep.PRECOMBAT_MAIN, playerA, boomerang, rite);
setStopAt(5, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertHandCount(playerA, rite, 1);
assertPermanentCount(playerA, rite, 0);
assertGraveyardCount(playerA, boomerang, 1);
assertPermanentCount(playerA, "Cleric", 4);
assertPermanentCount(playerA, "Demon", 1);
}
@Test
public void testUrzasSagaThenBloodMoon() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.HAND, playerA, saga);
addCard(Zone.HAND, playerA, moon);
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, saga);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, saga, 1);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, moon);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, saga, 0);
assertGraveyardCount(playerA, saga, 1);
assertPermanentCount(playerA, moon, 1);
}
@Test
public void testBloodMoonThenUrzasSaga() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.HAND, playerA, saga);
addCard(Zone.HAND, playerA, moon);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, moon);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, moon, 1);
playLand(1, PhaseStep.POSTCOMBAT_MAIN, playerA, saga);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, saga, 0);
assertGraveyardCount(playerA, saga, 1);
assertPermanentCount(playerA, moon, 1);
}
@Ignore // TODO: fix this
@Test
public void testBloodMoonThenUrzasSagaThenBounce() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
addCard(Zone.HAND, playerA, saga);
addCard(Zone.HAND, playerA, moon);
addCard(Zone.HAND, playerA, boomerang);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, moon);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, moon, 1);
playLand(1, PhaseStep.POSTCOMBAT_MAIN, playerA, saga);
// currently fails here, saga should immediately die from SBA but ability triggers anyway
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, boomerang, saga);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, saga, 0);
assertGraveyardCount(playerA, saga, 1);
assertHandCount(playerA, saga, 1);
assertHandCount(playerA, boomerang, 1);
assertPermanentCount(playerA, moon, 1);
}
}