mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Fix handling of damage to permanents (WIP) (#7592)
* initial refactor of damage events * cleaned up some instances of classes that need to be removed * removed old damage event classes * removed outdated imports * temporarily refactor Everlasting Torment (this will need to be changed more) * updated damage handling to use new changes * some reworking of lethal/excess damage plus a test * updated damage marking to handle planeswalkers * updated implementation of Phyrexian Unlife * updated implementation of Everlasting Torment * added some more excess damage tests * small change to wither check
This commit is contained in:
parent
39f6b69391
commit
5390963d38
201 changed files with 1132 additions and 1187 deletions
|
|
@ -0,0 +1,139 @@
|
|||
package org.mage.test.cards.damage;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class ExcessDamageTest extends CardTestPlayerBase {
|
||||
|
||||
private static final String spill = "Flame Spill";
|
||||
private static final String bear = "Grizzly Bears";
|
||||
private static final String jab = "Flame Jab";
|
||||
private static final String spirit = "Pestilent Spirit";
|
||||
private static final String myr = "Darksteel Myr";
|
||||
private static final String gideon = "Gideon Jura";
|
||||
private static final String leyline = "Leyline of Punishment";
|
||||
private static final String bolt = "Lightning Bolt";
|
||||
private static final String aegar = "Aegar, the Freezing Flame";
|
||||
|
||||
@Test
|
||||
public void testExcessDamageRegular() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, bear);
|
||||
addCard(Zone.HAND, playerA, spill);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, spill, bear);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, bear, 1);
|
||||
assertPermanentCount(playerA, bear, 0);
|
||||
assertLife(playerA, 20 - 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExcessDamageAlreadyDamaged() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, bear);
|
||||
addCard(Zone.HAND, playerA, spill);
|
||||
addCard(Zone.HAND, playerA, jab);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, jab, bear);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, spill, bear);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, bear, 1);
|
||||
assertPermanentCount(playerA, bear, 0);
|
||||
assertLife(playerA, 20 - 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExcessDamageDeathtouch() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, bear);
|
||||
addCard(Zone.BATTLEFIELD, playerA, spirit);
|
||||
addCard(Zone.HAND, playerA, spill);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, spill, bear);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, bear, 1);
|
||||
assertPermanentCount(playerA, bear, 0);
|
||||
assertLife(playerA, 20 - 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExcessDamageIndestructible() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, myr);
|
||||
addCard(Zone.HAND, playerA, spill);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, spill, myr);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, myr, 0);
|
||||
assertPermanentCount(playerA, myr, 1);
|
||||
assertLife(playerA, 20 - 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExcessDamagePlaneswalker() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, gideon);
|
||||
addCard(Zone.BATTLEFIELD, playerA, leyline);
|
||||
addCard(Zone.HAND, playerA, spill);
|
||||
addCard(Zone.HAND, playerA, bolt);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, gideon);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "0:");
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, spill, gideon);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, gideon, 1);
|
||||
assertPermanentCount(playerA, gideon, 0);
|
||||
assertLife(playerA, 20 - 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAegarTheFreezingFlame() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
||||
addCard(Zone.BATTLEFIELD, playerA, aegar);
|
||||
addCard(Zone.HAND, playerA, bolt);
|
||||
addCard(Zone.BATTLEFIELD, playerB, bear);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, bear);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertHandCount(playerA, 1);
|
||||
assertGraveyardCount(playerA, bolt, 1);
|
||||
assertGraveyardCount(playerB, bear, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,6 @@ import mage.constants.Zone;
|
|||
import mage.counters.CounterType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -142,23 +141,44 @@ public class GideonTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Kytheon, Hero of Akros", 1);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testGideonJura() {
|
||||
// TODO: this test fails because of how damage is currently handled
|
||||
public void testGideonJuraNoPrevention() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Gideon Jura");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Leyline of Punishment");
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "0:");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Gideon Jura");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertType("Gideon Jura", CardType.CREATURE, true);
|
||||
assertDamageReceived(playerA, "Gideon Jura", 3);
|
||||
assertCounterCount(playerA, "Gideon Jura", CounterType.LOYALTY, 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGideonJuraNoPreventionCombat() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Gideon Jura");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Leyline of Punishment");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "0:");
|
||||
attack(1, playerA, "Gideon Jura", playerB);
|
||||
block(1, playerB, "Grizzly Bears", "Gideon Jura");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertType("Gideon Jura", CardType.CREATURE, true);
|
||||
assertDamageReceived(playerA, "Gideon Jura", 2);
|
||||
assertCounterCount(playerA, "Gideon Jura", CounterType.LOYALTY, 4);
|
||||
assertGraveyardCount(playerB, "Grizzly Bears", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ayrat
|
||||
*/
|
||||
public class DamageDistributionTest extends CardTestPlayerBase {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue