forked from External/mage
test The Phasing of Zhalfir ; small tweak to TestPlayer to not count phased out permanents
This commit is contained in:
parent
ed2cbb5a80
commit
09d01d43f6
2 changed files with 67 additions and 5 deletions
|
|
@ -0,0 +1,63 @@
|
|||
package org.mage.test.cards.single.dmu;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class ThePhasingOfZhalfirTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.t.ThePhasingOfZhalfir The Phasing of Zhalfir} {2}{U}{U}
|
||||
* Enchantment — Saga
|
||||
* Read ahead (Choose a chapter and start with that many lore counters. Add one after your draw step. Skipped chapters don’t trigger. Sacrifice after III.)
|
||||
* I, II — Another target nonland permanent phases out. It can’t phase in for as long as you control this Saga.
|
||||
* III — Destroy all creatures. For each creature destroyed this way, its controller creates a 2/2 black Phyrexian creature token.
|
||||
*/
|
||||
private static final String phasing = "The Phasing of Zhalfir";
|
||||
|
||||
@Test
|
||||
public void test_SimplePlay() {
|
||||
addCard(Zone.HAND, playerA, phasing, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Memnite", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Ornithopter", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Elite Vanguard", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, phasing);
|
||||
setChoiceAmount(playerA, 1); // chosing to start at I with Read ahead
|
||||
addTarget(playerA, "Memnite");
|
||||
|
||||
checkPermanentCount("1: Memnite is phased out", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Memnite", 0);
|
||||
checkPermanentCount("1: Ornithopter not phased out", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ornithopter", 1);
|
||||
|
||||
// turn 3
|
||||
addTarget(playerA, "Ornithopter");
|
||||
|
||||
checkPermanentCount("3: Memnite is phased out", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Memnite", 0);
|
||||
checkPermanentCount("3: Ornithopter is phased out", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ornithopter", 0);
|
||||
|
||||
// turn 5
|
||||
checkPermanentCount("5: Memnite is phased out", 5, PhaseStep.POSTCOMBAT_MAIN, playerA, "Memnite", 0);
|
||||
checkPermanentCount("5: Ornithopter is phased out", 5, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ornithopter", 0);
|
||||
checkPermanentCount("5: Vanguard got destroyed", 5, PhaseStep.POSTCOMBAT_MAIN, playerA, "Elite Vanguard", 0);
|
||||
checkPermanentCount("5: phasing done after III", 5, PhaseStep.POSTCOMBAT_MAIN, playerA, phasing, 0);
|
||||
checkPermanentCount("5: has a Phyrexian creature token", 5, PhaseStep.POSTCOMBAT_MAIN, playerA, "Phyrexian Token", 1);
|
||||
|
||||
// T6: Ornithopter phases in
|
||||
checkPermanentCount("6: Memnite is phased out", 6, PhaseStep.POSTCOMBAT_MAIN, playerA, "Memnite", 0);
|
||||
checkPermanentCount("6: Ornithopter not phased out", 6, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ornithopter", 1);
|
||||
|
||||
// T7: Memnite phases in
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(7, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Memnite", 1);
|
||||
assertPermanentCount(playerB, "Ornithopter", 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -51,6 +51,7 @@ import mage.util.RandomUtil;
|
|||
import mage.watchers.common.AttackedOrBlockedThisCombatWatcher;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Assert;
|
||||
import static org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
|
@ -58,8 +59,6 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl.*;
|
||||
|
||||
/**
|
||||
* Basic implementation of testable player
|
||||
*
|
||||
|
|
@ -1512,7 +1511,7 @@ public class TestPlayer implements Player {
|
|||
|
||||
private void assertPermanentCount(PlayerAction action, Game game, Player player, String permanentName, int count) {
|
||||
int foundCount = 0;
|
||||
for (Permanent perm : game.getBattlefield().getAllPermanents()) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents()) {
|
||||
if (hasObjectTargetNameOrAlias(perm, permanentName) && perm.getControllerId().equals(player.getId())) {
|
||||
foundCount++;
|
||||
}
|
||||
|
|
@ -1528,7 +1527,7 @@ public class TestPlayer implements Player {
|
|||
|
||||
private void assertPermanentTapped(PlayerAction action, Game game, Player player, String permanentName, boolean tapped, int count) {
|
||||
int foundCount = 0;
|
||||
for (Permanent perm : game.getBattlefield().getAllPermanents()) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents()) {
|
||||
if (hasObjectTargetNameOrAlias(perm, permanentName)
|
||||
&& perm.getControllerId().equals(player.getId())
|
||||
&& perm.isTapped() == tapped) {
|
||||
|
|
@ -1547,7 +1546,7 @@ public class TestPlayer implements Player {
|
|||
|
||||
private void assertPermanentCounters(PlayerAction action, Game game, Player player, String permanentName, CounterType counterType, int count) {
|
||||
int foundCount = 0;
|
||||
for (Permanent perm : game.getBattlefield().getAllPermanents()) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents()) {
|
||||
if (hasObjectTargetNameOrAlias(perm, permanentName) && perm.getControllerId().equals(player.getId())) {
|
||||
foundCount = perm.getCounters(game).getCount(counterType);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue