* Until end of your turn - fixed that effects discarded too early in multiplayer games (#5759, #5676);

Tests: added dozen tests for end of turn effects and related cards.
This commit is contained in:
Oleg Agafonov 2019-04-28 11:27:08 +04:00
parent 4288e45c23
commit 534037e095
22 changed files with 758 additions and 137 deletions

View file

@ -0,0 +1,155 @@
package org.mage.test.cards.continuous;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.constants.Duration;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBaseWithRangeAll;
/**
* @author JayDi85
*/
public class EndOfTurnMultiOpponentsTest extends CardTestMultiPlayerBaseWithRangeAll {
String cardBear2 = EndOfTurnOneOpponentTest.cardBear2;
@Test
public void test_EndOfTurnMulti() {
// Player order: A -> D -> C -> B
addCustomCardWithAbility("boost1", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, Duration.EndOfTurn)));
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 1, playerA, true, PhaseStep.END_TURN);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 2, playerD, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 3, playerC, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 4, playerB, true, null);
//
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 5, playerA, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 6, playerD, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 7, playerC, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 8, playerB, true, null);
//
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 9, playerA, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 10, playerD, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 11, playerC, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.EndOfTurn effect", 12, playerB, true, null);
addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerC, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerD, cardBear2, 1);
attack(1, playerA, cardBear2);
attack(2, playerD, cardBear2);
attack(3, playerC, cardBear2);
attack(4, playerB, cardBear2);
//
attack(5, playerA, cardBear2);
attack(6, playerD, cardBear2);
attack(7, playerC, cardBear2);
attack(8, playerB, cardBear2);
//
attack(9, playerA, cardBear2);
attack(10, playerD, cardBear2);
attack(11, playerC, cardBear2);
attack(12, playerB, cardBear2);
setStopAt(12, PhaseStep.CLEANUP);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
@Test
public void test_UntilYourNextTurnMulti() {
// Player order: A -> D -> C -> B
addCustomCardWithAbility("boost1", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, Duration.UntilYourNextTurn)));
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 1, playerA, true, PhaseStep.END_TURN);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 2, playerD, true, PhaseStep.END_TURN);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 3, playerC, true, PhaseStep.END_TURN);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 4, playerB, true, PhaseStep.END_TURN);
//
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 5, playerA, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 6, playerD, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 7, playerC, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 8, playerB, true, null);
//
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 9, playerA, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 10, playerD, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 11, playerC, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 12, playerB, true, null);
addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerC, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerD, cardBear2, 1);
attack(1, playerA, cardBear2);
attack(2, playerD, cardBear2);
attack(3, playerC, cardBear2);
attack(4, playerB, cardBear2);
//
attack(5, playerA, cardBear2);
attack(6, playerD, cardBear2);
attack(7, playerC, cardBear2);
attack(8, playerB, cardBear2);
//
attack(9, playerA, cardBear2);
attack(10, playerD, cardBear2);
attack(11, playerC, cardBear2);
attack(12, playerB, cardBear2);
setStopAt(12, PhaseStep.CLEANUP);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
@Test
public void test_UntilEndOfYourNextTurnMulti() {
// Player order: A -> D -> C -> B
addCustomCardWithAbility("boost1", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, Duration.UntilEndOfYourNextTurn)));
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 1, playerA, true, PhaseStep.END_TURN);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 2, playerD, true, PhaseStep.END_TURN);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 3, playerC, true, PhaseStep.END_TURN);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 4, playerB, true, PhaseStep.END_TURN);
//
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 5, playerA, true, PhaseStep.END_TURN);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 6, playerD, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 7, playerC, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 8, playerB, true, null);
//
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 9, playerA, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 10, playerD, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 11, playerC, true, null);
EndOfTurnOneOpponentTest.prepareStepChecks(this, "Duration.UntilEndOfYourNextTurn effect", 12, playerB, true, null);
addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerC, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerD, cardBear2, 1);
attack(1, playerA, cardBear2);
attack(2, playerD, cardBear2);
attack(3, playerC, cardBear2);
attack(4, playerB, cardBear2);
//
attack(5, playerA, cardBear2);
attack(6, playerD, cardBear2);
attack(7, playerC, cardBear2);
attack(8, playerB, cardBear2);
//
attack(9, playerA, cardBear2);
attack(10, playerD, cardBear2);
attack(11, playerC, cardBear2);
attack(12, playerB, cardBear2);
setStopAt(12, PhaseStep.CLEANUP);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
}

View file

@ -0,0 +1,124 @@
package org.mage.test.cards.continuous;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.constants.Duration;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.player.TestPlayer;
import org.mage.test.serverside.base.CardTestPlayerBase;
import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl;
/**
* @author JayDi85
*/
public class EndOfTurnOneOpponentTest extends CardTestPlayerBase {
public static String cardBear2 = "Balduvian Bears"; // 2/2
public static void prepareStepChecks(CardTestPlayerAPIImpl testEngine, String testName, int turnNum, TestPlayer player, boolean willBeBattle, PhaseStep mustExistUntilStep) {
for (PhaseStep step : PhaseStep.values()) {
// skip auto-steps without priority/checks
switch (step) {
case UNTAP:
case DRAW:
case UPKEEP:
case FIRST_COMBAT_DAMAGE:
case CLEANUP:
continue; // auto-skip steps without priority
case PRECOMBAT_MAIN:
case POSTCOMBAT_MAIN:
case END_TURN:
break; // always use
case BEGIN_COMBAT:
case DECLARE_ATTACKERS:
case DECLARE_BLOCKERS:
case COMBAT_DAMAGE:
case END_COMBAT:
if (!willBeBattle) continue; // combat skip
break;
default:
throw new IllegalStateException("Unknown phase step " + step);
}
int permP = 2;
int permT = 2;
String existsStr = "must NOT EXISTS";
if (mustExistUntilStep != null && step.getIndex() <= mustExistUntilStep.getIndex()) {
permP++;
permT++;
existsStr = "must EXISTS";
}
testEngine.checkPT(testName + " " + existsStr + " on turn " + turnNum + " - " + step.toString() + " for " + player.getName(),
turnNum, step, player, cardBear2, permP, permT);
}
}
@Test
public void test_EndOfTurnSingle() {
addCustomCardWithAbility("boost1", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, Duration.EndOfTurn)));
prepareStepChecks(this, "Duration.EndOfTurn effect", 1, playerA, true, PhaseStep.END_TURN);
prepareStepChecks(this, "Duration.EndOfTurn effect", 2, playerA, true, null);
prepareStepChecks(this, "Duration.EndOfTurn effect", 3, playerA, true, null);
prepareStepChecks(this, "Duration.EndOfTurn effect", 4, playerA, true, null);
addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
attack(1, playerA, cardBear2);
attack(2, playerB, cardBear2);
attack(3, playerA, cardBear2);
attack(4, playerB, cardBear2);
setStopAt(4, PhaseStep.CLEANUP);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
@Test
public void test_UntilYourNextTurnSingle() {
addCustomCardWithAbility("boost1", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, Duration.UntilYourNextTurn)));
prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 1, playerA, true, PhaseStep.END_TURN);
prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 2, playerA, true, PhaseStep.END_TURN);
prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 3, playerA, true, null);
prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 4, playerA, true, null);
addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
attack(1, playerA, cardBear2);
attack(2, playerB, cardBear2);
attack(3, playerA, cardBear2);
attack(4, playerB, cardBear2);
setStopAt(4, PhaseStep.CLEANUP);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
@Test
public void test_UntilEndOfYourNextTurnSingle() {
addCustomCardWithAbility("boost1", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, Duration.UntilEndOfYourNextTurn)));
prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 1, playerA, true, PhaseStep.END_TURN);
prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 2, playerA, true, PhaseStep.END_TURN);
prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 3, playerA, true, PhaseStep.END_TURN);
prepareStepChecks(this, "Duration.UntilYourNextTurn effect", 4, playerA, true, null);
addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
attack(1, playerA, cardBear2);
attack(2, playerB, cardBear2);
attack(3, playerA, cardBear2);
attack(4, playerB, cardBear2);
setStopAt(4, PhaseStep.CLEANUP);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
}

View file

@ -0,0 +1,52 @@
package org.mage.test.cards.continuous;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class GideonJuraAndRowanKenrithNextTurnTest extends CardTestPlayerBase {
@Test
public void test_SingleOpponentMustAttackGideonJura() {
// +2: During target opponent's next turn, creatures that player controls attack Gideon Jura if able.
addCard(Zone.BATTLEFIELD, playerA, "Gideon Jura");
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1); // 2/2
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+2:", playerB);
checkPermanentCounters("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Gideon Jura", CounterType.LOYALTY, 6 + 2);
checkPermanentCounters("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerA, "Gideon Jura", CounterType.LOYALTY, 6 + 2 - 2);
checkPermanentCounters("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Gideon Jura", CounterType.LOYALTY, 6 + 2 - 2);
checkPermanentCounters("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerA, "Gideon Jura", CounterType.LOYALTY, 6 + 2 - 2);
setStopAt(4, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
@Test
public void test_SingleOpponentMustAttackRowanKenrith() {
// +2: During target player's next turn, each creature that player controls attacks if able.
addCard(Zone.BATTLEFIELD, playerA, "Rowan Kenrith");
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1); // 2/2
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+2:", playerB);
addTarget(playerB, playerA);
checkLife("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, 20);
checkLife("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2);
checkLife("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2);
checkLife("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2);
setStopAt(4, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
}

View file

@ -0,0 +1,56 @@
package org.mage.test.cards.continuous;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class OracleEnVecNextTurnTest extends CardTestPlayerBase {
@Test
public void test_SingleOpponentMustAttack() {
// {T}: Target opponent chooses any number of creatures they control. During that players next turn, the chosen
// creatures attack if able, and other creatures cant attack. At the beginning of that turns end step,
// destroy each of the chosen creatures that didnt attack this turn. Activate this ability only during your turn.
addCard(Zone.BATTLEFIELD, playerA, "Oracle en-Vec");
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1); // 2/2
addCard(Zone.BATTLEFIELD, playerB, "Angelic Wall", 1); // wall, can't attack
addCard(Zone.BATTLEFIELD, playerB, "Ashcoat Bear", 1); // 2/2
// 1 - activate
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Target opponent", playerB);
setChoice(playerB, "Balduvian Bears^Angelic Wall");
//
checkLife("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, 20);
checkPermanentCount("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Angelic Wall", 1);
checkPermanentCount("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
// 2 - attack and destroy at the end
checkLife("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2);
checkPermanentCount("turn 2a", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 2a", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Angelic Wall", 1);
checkPermanentCount("turn 2a", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
// 3 - nothing
// after destroy at the end
checkLife("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2);
checkPermanentCount("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Angelic Wall", 0);
checkPermanentCount("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
// 4 - nothing
checkLife("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2);
checkPermanentCount("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerB, "Angelic Wall", 0);
checkPermanentCount("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
setStopAt(4, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
}

View file

@ -0,0 +1,28 @@
package org.mage.test.cards.continuous;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class ShinenOfLifesRoarTest extends CardTestPlayerBase {
@Test
public void test_SingleOpponentMustBlock() {
// All creatures able to block Shinen of Lifes Roar do so.
addCard(Zone.BATTLEFIELD, playerA, "Shinen of Life's Roar");
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1); // 2/2
attack(1, playerA, "Shinen of Life's Roar", playerB);
setStopAt(2, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerA, "Shinen of Life's Roar", 1);
}
}

View file

@ -0,0 +1,44 @@
package org.mage.test.cards.continuous;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class VraskaTheUnseenNextTurnTest extends CardTestPlayerBase {
@Test
public void test_SingleOpponentMustAttack() {
// +1: Until your next turn, whenever a creature deals combat damage to Vraska the Unseen, destroy that creature.
addCard(Zone.BATTLEFIELD, playerA, "Vraska the Unseen");
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 3); // 2/2
// 1 - activate
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1:");
checkPermanentCounters("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Vraska the Unseen", CounterType.LOYALTY, 5 + 1);
checkPermanentCount("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 3);
// 2 - attack and destroy
attack(2, playerB, "Balduvian Bears", "Vraska the Unseen");
checkPermanentCounters("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerA, "Vraska the Unseen", CounterType.LOYALTY, 5 + 1 - 2);
checkPermanentCount("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 3 - 1);
// 3 - nothing
checkPermanentCounters("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Vraska the Unseen", CounterType.LOYALTY, 5 + 1 - 2);
checkPermanentCount("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 3 - 1);
// 4 - attack and DO NOT destroy
checkPermanentCounters("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerA, "Vraska the Unseen", CounterType.LOYALTY, 5 + 1 - 2 * 2);
attack(4, playerB, "Balduvian Bears", "Vraska the Unseen");
checkPermanentCount("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 3 - 1);
setStopAt(4, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
}

View file

@ -0,0 +1,66 @@
package org.mage.test.cards.continuous;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect;
import mage.constants.Duration;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.watchers.common.AttackedThisTurnWatcher;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class WallOfDustNextTurnTest extends CardTestPlayerBase {
@Test
public void test_SingleOpponentMustAttack() {
// Whenever Wall of Dust blocks a creature, that creature can't attack during its controller's next turn.
addCard(Zone.BATTLEFIELD, playerA, "Wall of Dust");
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1); // 2/2
addCard(Zone.BATTLEFIELD, playerB, "Ashcoat Bear", 1); // 2/2
//
Ability ability = new SimpleStaticAbility(new AttacksIfAbleAllEffect(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, Duration.EndOfGame));
ability.addWatcher(new AttackedThisTurnWatcher());
addCustomCardWithAbility("all attacks", playerA, ability);
// 1 - nothing
checkPermanentCount("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, 20);
// 2 - auto-attack B -> A, 1 attacked, 1 blocked (by wall)
block(2, playerA, "Wall of Dust", "Balduvian Bears");
checkPermanentCount("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 2", 2, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2);
// 3 - nothing
checkPermanentCount("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 3", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2);
// 4 - auto-attack, B -> A, 1 attacked, 1 can't attacked (by wall's abilitiy during next turn)
checkPermanentCount("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 4", 4, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2 * 2);
// 5 - nothing
checkPermanentCount("turn 5", 5, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 5", 5, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 5", 5, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2 * 2);
// 6 - auto-attack, B -> A, 2 attacked
checkPermanentCount("turn 6", 6, PhaseStep.POSTCOMBAT_MAIN, playerB, "Balduvian Bears", 1);
checkPermanentCount("turn 6", 6, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ashcoat Bear", 1);
checkLife("turn 6", 6, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 - 2 * 2 - 2 * 2);
setStopAt(6, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
}
}