mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
Added additional test for prevent damage effects, improved 3358e2da80 (#6915)
This commit is contained in:
parent
3358e2da80
commit
2eeefd91ef
9 changed files with 137 additions and 64 deletions
|
|
@ -135,7 +135,7 @@ public class ConditionalPreventionTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_PrentableCombatDamage() {
|
||||
public void test_PreventableCombatDamage() {
|
||||
// Prevent all damage that would be dealt to creatures.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Bubble Matrix", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
|
||||
|
|
@ -190,4 +190,77 @@ public class ConditionalPreventionTest extends CardTestPlayerBase {
|
|||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20 - 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_PreventSomeDamage_Normal() {
|
||||
// Kicker-Sacrifice a land.
|
||||
// Prevent the next 3 damage that would be dealt this turn to any number of target creatures and/or players, divided as you choose.
|
||||
// If Pollen Remedy was kicked, prevent the next 6 damage this way instead.
|
||||
addCard(Zone.HAND, playerA, "Pollen Remedy", 1); // {W}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.HAND, playerA, "Swamp", 1); // for kicker
|
||||
//
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
|
||||
//
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
|
||||
// add shield for 3 damage
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pollen Remedy");
|
||||
setChoice(playerA, "No"); // no kicker
|
||||
addTargetAmount(playerA, "Balduvian Bears", 3);
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
checkGraveyardCount("shield", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pollen Remedy", 1);
|
||||
|
||||
// 6 damage to die (if no shield then can cast only 1 bolt)
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Balduvian Bears");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Balduvian Bears");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
checkGraveyardCount("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 2);
|
||||
checkGraveyardCount("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_PreventSomeDamage_Kicked() {
|
||||
// Kicker-Sacrifice a land.
|
||||
// Prevent the next 3 damage that would be dealt this turn to any number of target creatures and/or players, divided as you choose.
|
||||
// If Pollen Remedy was kicked, prevent the next 6 damage this way instead.
|
||||
addCard(Zone.HAND, playerA, "Pollen Remedy", 1); // {W}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); // for kicker
|
||||
//
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
|
||||
//
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
|
||||
// add shield for 6 damage
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pollen Remedy");
|
||||
setChoice(playerA, "Yes"); // use kicker
|
||||
setChoice(playerA, "Swamp"); // kicker cost
|
||||
addTargetAmount(playerA, "Balduvian Bears", 6);
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
checkGraveyardCount("shield", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pollen Remedy", 1);
|
||||
|
||||
// 9 damage to die (if no shield then can cast only 1 bolt)
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Balduvian Bears");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Balduvian Bears");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Balduvian Bears");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||
checkGraveyardCount("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 3);
|
||||
checkGraveyardCount("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -650,4 +650,43 @@ public class AdventureCardsTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_BonecrusherGiant_Stopm() {
|
||||
// bug with non working stopm: https://github.com/magefree/mage/issues/6915
|
||||
|
||||
// If noncombat damage would be dealt to Stormwild Capridor, prevent that damage.
|
||||
// Put a +1/+1 counter on Stormwild Capridor for each 1 damage prevented this way.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Stormwild Capridor@storm", 2); // 1/3
|
||||
//
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
//
|
||||
// Stomp {1}{R}
|
||||
// Damage can’t be prevented this turn. Stomp deals 2 damage to any target.
|
||||
addCard(Zone.HAND, playerA, "Bonecrusher Giant", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
|
||||
// prevent
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "@storm.1");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
checkGraveyardCount("prevent", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 1);
|
||||
checkGraveyardCount("prevent", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "@storm.1", 0);
|
||||
|
||||
// prepare protect by stomp
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Stomp");
|
||||
addTarget(playerA, playerB);
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
|
||||
// can't prevent
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "@storm.2");
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
checkGraveyardCount("can't prevent", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", 2);
|
||||
checkGraveyardCount("can't prevent", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "@storm.2", 1);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2450,7 +2450,7 @@ public class TestPlayer implements Player {
|
|||
//Assert.fail("Wrong target");
|
||||
}
|
||||
|
||||
this.chooseStrictModeFailed("target", game, getInfo(source, game) + "; " + getInfo(target));
|
||||
this.chooseStrictModeFailed("target", game, getInfo(source, game) + "\n" + getInfo(target));
|
||||
return computerPlayer.chooseTarget(outcome, cards, target, source, game);
|
||||
}
|
||||
|
||||
|
|
@ -3760,7 +3760,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
}
|
||||
|
||||
this.chooseStrictModeFailed("target", game, getInfo(source, game) + "; " + getInfo(target));
|
||||
this.chooseStrictModeFailed("target", game, getInfo(source, game) + "\n" + getInfo(target));
|
||||
return computerPlayer.chooseTargetAmount(outcome, target, source, game);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
}
|
||||
Assert.assertFalse("Wrong stop command on " + this.stopOnTurn + " / " + this.stopAtStep + " (" + this.stopAtStep.getIndex() + ")"
|
||||
+ " (found actions after stop on " + maxTurn + " / " + maxPhase + ")",
|
||||
+ " (found actions after stop on " + maxTurn + " / " + maxPhase + ")",
|
||||
(maxTurn > this.stopOnTurn) || (maxTurn == this.stopOnTurn && maxPhase > this.stopAtStep.getIndex()));
|
||||
|
||||
if (!currentGame.isPaused()) {
|
||||
|
|
@ -916,7 +916,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
Assert.assertNotNull("There is no such permanent under player's control, player=" + player.getName()
|
||||
+ ", cardName=" + cardName, found);
|
||||
|
||||
|
||||
Assert.assertEquals(amount, found.getAbilities(currentGame).stream()
|
||||
.filter(a -> searchedAbility.isAssignableFrom(a.getClass())).collect(Collectors.toList()).size());
|
||||
}
|
||||
|
|
@ -1619,9 +1619,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param step
|
||||
* @param player
|
||||
* @param cardName
|
||||
* @param targetName for modes you can add "mode=3" before target name,
|
||||
* multiple targets can be seperated by ^, not target
|
||||
* marks as TestPlayer.NO_TARGET
|
||||
* @param targetName for modes you can add "mode=3" before target name;
|
||||
* multiple targets can be seperated by ^;
|
||||
* no target marks as TestPlayer.NO_TARGET;
|
||||
* warning, do not support cards with target adjusters - use addTarget instead
|
||||
*/
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue