From e9bbefb814d29f2c70390b9c2e68260332708c14 Mon Sep 17 00:00:00 2001 From: Adrian Petrescu Date: Fri, 11 Oct 2019 09:48:26 -0400 Subject: [PATCH 1/3] Adding incorrectly-failing test for SyrKonradTheGrim His ability should only trigger on creatures leaving the controller's graveyard, not any graveyard. --- .../cards/single/SyrKonradTheGrimTest.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/SyrKonradTheGrimTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/SyrKonradTheGrimTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/SyrKonradTheGrimTest.java new file mode 100644 index 0000000000..511ed3a938 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/SyrKonradTheGrimTest.java @@ -0,0 +1,31 @@ +package org.mage.test.cards.single; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +public class SyrKonradTheGrimTest extends CardTestPlayerBase { + + @Test + public void ownGraveyardTriggerTest() { + addCard(Zone.HAND, playerA, "Rest in Peace"); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); + addCard(Zone.BATTLEFIELD, playerA, "Syr Konrad, the Grim"); + addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears", 2); + addCard(Zone.GRAVEYARD, playerB, "Grizzly Bears"); + setStopAt(1, PhaseStep.UNTAP); + execute(); + + assertLife(playerB, 20); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rest in Peace"); + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertGraveyardCount(playerA, 0); + assertGraveyardCount(playerB, 0); + assertLife(playerA, 20); + assertLife(playerB, 18); + } +} From 69cff6c920544316fe265c8c43ee9a6f075b0e23 Mon Sep 17 00:00:00 2001 From: Adrian Petrescu Date: Fri, 11 Oct 2019 09:59:06 -0400 Subject: [PATCH 2/3] Fix buggy login in SyrKonradTheGrimTriggeredAbility.checkTrigger() Basically needed to check that creatures leaving the graveyard belong to the controlling player. --- Mage.Sets/src/mage/cards/s/SyrKonradTheGrim.java | 8 ++++++-- .../org/mage/test/cards/single/SyrKonradTheGrimTest.java | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/cards/s/SyrKonradTheGrim.java b/Mage.Sets/src/mage/cards/s/SyrKonradTheGrim.java index aa61685d40..967fc74452 100644 --- a/Mage.Sets/src/mage/cards/s/SyrKonradTheGrim.java +++ b/Mage.Sets/src/mage/cards/s/SyrKonradTheGrim.java @@ -72,6 +72,7 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + // Whenever another creature dies if (zEvent.isDiesEvent() && zEvent.getTarget() != null && !zEvent.getTargetId().equals(this.getSourceId()) @@ -79,6 +80,7 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl { return true; } Card card = game.getCard(zEvent.getTargetId()); + // Or a creature card is put into a graveyard from anywhere other than the battlefield if (card == null || !card.isCreature()) { return false; } @@ -86,7 +88,9 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl { && zEvent.getFromZone() != Zone.BATTLEFIELD) { return true; } - return zEvent.getFromZone() == Zone.GRAVEYARD; + // Or a creature card leaves your graveyard + return zEvent.getFromZone() == Zone.GRAVEYARD + && zEvent.getPlayerId() == this.getControllerId(); } @Override @@ -95,4 +99,4 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl { "from anywhere other than the battlefield, or a creature card leaves your graveyard, " + "{this} deals 1 damage to each opponent."; } -} \ No newline at end of file +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/SyrKonradTheGrimTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/SyrKonradTheGrimTest.java index 511ed3a938..f24543cf40 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/SyrKonradTheGrimTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/SyrKonradTheGrimTest.java @@ -8,11 +8,13 @@ import org.mage.test.serverside.base.CardTestPlayerBase; public class SyrKonradTheGrimTest extends CardTestPlayerBase { @Test - public void ownGraveyardTriggerTest() { + public void leavesOwnGraveyardTriggerTest() { addCard(Zone.HAND, playerA, "Rest in Peace"); addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); addCard(Zone.BATTLEFIELD, playerA, "Syr Konrad, the Grim"); + // These leaving the graveyard *should* cause loss of life addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears", 2); + // These ones *shouldn't* addCard(Zone.GRAVEYARD, playerB, "Grizzly Bears"); setStopAt(1, PhaseStep.UNTAP); execute(); From 00fd8d18dae845e80e6bb0ab73004d0757a282e3 Mon Sep 17 00:00:00 2001 From: Adrian Petrescu Date: Fri, 11 Oct 2019 09:59:54 -0400 Subject: [PATCH 3/3] Remove unneeded import in an unrelated test, just for kicks --- .../java/org/mage/test/cards/single/ArchfiendOfSpiteTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/ArchfiendOfSpiteTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/ArchfiendOfSpiteTest.java index 00622f1471..4037097d6b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/ArchfiendOfSpiteTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/ArchfiendOfSpiteTest.java @@ -2,7 +2,6 @@ package org.mage.test.cards.single; import mage.constants.PhaseStep; import mage.constants.Zone; -import org.junit.Assert; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase;