rework more Prevention Effects involving counters. Implement [PIP] Bloatfly Swarm (#12205)

This commit is contained in:
Susucre 2024-05-23 19:48:44 +02:00 committed by GitHub
parent e3e34dae33
commit bcff245a31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 545 additions and 189 deletions

View file

@ -2,14 +2,13 @@ package org.mage.test.cards.prevention;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class PreventDamageRemoveCountersTest extends CardTestPlayerBase {
@Test
public void testCounterRemoval() {
public void test_OathswornKnight_CounterRemoval() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
@ -32,7 +31,7 @@ public class PreventDamageRemoveCountersTest extends CardTestPlayerBase {
}
@Test
public void testMagmaPummeler() {
public void test_MagmaPummeler() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
@ -50,11 +49,117 @@ public class PreventDamageRemoveCountersTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Magma Pummeler", 1);
assertPowerToughness(playerA, "Magma Pummeler", 3, 3); // 2 counters removed
assertLife(playerB, 18); // 2 damage dealt
}
@Test
public void testProteanHydraBoosted() {
public void test_MagmaPummeler_DoubleBlocked() {
// The part of this one that is weird is that there should be only a single trigger, that sums
// all the counter removed by multiple prevention effects occuring at the same time.
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
addCard(Zone.HAND, playerA, "Magma Pummeler", 1);
addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1);
addCard(Zone.BATTLEFIELD, playerB, "Goblin Piker", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Magma Pummeler");
setChoice(playerA, "X=5");
attack(3, playerA, "Magma Pummeler", playerB);
block(3, playerB, "Memnite", "Magma Pummeler");
block(3, playerB, "Goblin Piker", "Magma Pummeler");
setChoice(playerA, "X=5"); // damage for Pummeler, does not really matter for this test.
addTarget(playerA, playerB); // For the one trigger
setStopAt(3, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Magma Pummeler", 1);
assertPowerToughness(playerA, "Magma Pummeler", 2, 2); // 3 counters removed
assertLife(playerB, 20 - 3); // 3 damage dealt by the 1 trigger.
}
@Test
public void test_MagmaPummeler_KilledByMore() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 7 + 5);
addCard(Zone.HAND, playerA, "Magma Pummeler", 1);
addCard(Zone.HAND, playerA, "Shivan Meteor", 1); // 13 damage to target creature
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Magma Pummeler");
setChoice(playerA, "X=5");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shivan Meteor", "Magma Pummeler");
addTarget(playerA, playerB); // For the reflective trigger
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Magma Pummeler", 1);
assertGraveyardCount(playerA, "Shivan Meteor", 1);
assertLife(playerB, 20 - 5); // 5 counters removed in total.
}
@Test
public void test_MagmaPummeler_DoubleBlocked_And_Die() {
// The part of this one that is weird is that there should be only a single trigger, that sums
// all the counter removed by multiple prevention effects occuring at the same time.
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
addCard(Zone.HAND, playerA, "Magma Pummeler", 1);
addCard(Zone.BATTLEFIELD, playerB, "Centaur Courser", 1); // 3/3
addCard(Zone.BATTLEFIELD, playerB, "Air Elemental", 1); // 4/4
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Magma Pummeler");
setChoice(playerA, "X=5");
attack(3, playerA, "Magma Pummeler", playerB);
block(3, playerB, "Centaur Courser", "Magma Pummeler");
block(3, playerB, "Air Elemental", "Magma Pummeler");
setChoice(playerA, "X=5"); // damage for Pummeler, does not really matter for this test.
addTarget(playerA, playerB); // For the one trigger
setStopAt(3, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, "Magma Pummeler", 1);
assertLife(playerB, 20 - 5); // 5 counters prevented, Pummeler's trigger dealt 5.
}
@Test
public void test_UndergrowthChampion_DoubleBlocked() {
setStrictChooseMode(true);
// Undergrowth Champion {1}{G}{G}
// Creature Elemental
// If damage would be dealt to Undergrowth Champion while it has a +1/+1 counter on it, prevent that damage and remove a +1/+1 counter from Undergrowth Champion.
// Landfall Whenever a land enters the battlefield under your control, put a +1/+1 counter on Undergrowth Champion.
// 2/2
addCard(Zone.BATTLEFIELD, playerA, "Undergrowth Champion");
addCard(Zone.HAND, playerA, "Plains");
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears");
addCard(Zone.BATTLEFIELD, playerB, "Elite Vanguard");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plains");
// Champion now has a +1/+1 counter
attack(1, playerA, "Undergrowth Champion", playerB);
block(1, playerB, "Grizzly Bears", "Undergrowth Champion");
block(1, playerB, "Elite Vanguard", "Undergrowth Champion");
setChoice(playerA, "X=2"); // damage attribution
setStopAt(1, PhaseStep.END_COMBAT);
execute();
assertGraveyardCount(playerB, 2);
assertDamageReceived(playerA, "Undergrowth Champion", 0); // All the damage should be prevented.
assertPowerToughness(playerA, "Undergrowth Champion", 2, 2);
}
@Test
public void test_ProteanHydra_Boosted() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);

View file

@ -0,0 +1,91 @@
package org.mage.test.cards.single.pip;
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 BloatflySwarmTest extends CardTestPlayerBase {
/**
* {@link mage.cards.b.BloatflySwarm Bloatfly Swarm} {3}{B}
* Creature Insect Mutant
* Flying
* Bloatfly Swarm enters the battlefield with five +1/+1 counters on it.
* If damage would be dealt to Bloatfly Swarm while it has a +1/+1 counter on it, prevent that damage, remove that many +1/+1 counters from it, then give each player a rad counter for each +1/+1 counter removed this way.
* 0/0
*/
private static final String swarm = "Bloatfly Swarm";
@Test
public void test_Bolt() {
setStrictChooseMode(true);
addCard(Zone.HAND, playerA, swarm);
addCard(Zone.BATTLEFIELD, playerA, "Badlands", 6);
addCard(Zone.HAND, playerA, "Lightning Bolt");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, swarm, true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", swarm);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, swarm, 2, 2);
assertCounterCount(playerA, CounterType.RAD, 3);
assertCounterCount(playerB, CounterType.RAD, 3);
}
@Test
public void test_Combat() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Concordant Crossroads"); // For haste
addCard(Zone.HAND, playerA, swarm);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.BATTLEFIELD, playerB, "Brimstone Dragon"); // 6/6 Flying Haste
addCard(Zone.BATTLEFIELD, playerB, "Giant Spider"); // 2/4 Reach
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, swarm);
attack(1, playerA, swarm);
block(1, playerB, "Brimstone Dragon", swarm);
block(1, playerB, "Giant Spider", swarm);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, swarm, 1);
assertCounterCount(playerA, CounterType.RAD, 5);
assertCounterCount(playerB, CounterType.RAD, 5);
}
@Test
public void test_Combat_Small() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Concordant Crossroads"); // For haste
addCard(Zone.HAND, playerA, swarm);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.BATTLEFIELD, playerB, "Wind Drake"); // 2/2 Flying
addCard(Zone.BATTLEFIELD, playerB, "Giant Spider"); // 2/4 Reach
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, swarm);
attack(1, playerA, swarm);
block(1, playerB, "Wind Drake", swarm);
block(1, playerB, "Giant Spider", swarm);
setChoice(playerA, "X=5"); // damage attribution
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPowerToughness(playerA, swarm, 1, 1);
assertCounterCount(playerA, CounterType.RAD, 4);
assertCounterCount(playerB, CounterType.RAD, 4);
}
}