From 46f98a0f8859483e44dba2ab4ae01a8b7168769c Mon Sep 17 00:00:00 2001 From: "Alex W. Jackson" Date: Thu, 31 Mar 2022 21:30:46 -0400 Subject: [PATCH] Fix #8812 and add test --- Mage.Sets/src/mage/cards/e/ErebossTitan.java | 26 +++++++------------ .../src/mage/cards/s/SyrKonradTheGrim.java | 2 +- .../single/eld/SyrKonradTheGrimTest.java | 22 ++++++++++++++++ 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/Mage.Sets/src/mage/cards/e/ErebossTitan.java b/Mage.Sets/src/mage/cards/e/ErebossTitan.java index 7b883e7204..100be729c6 100644 --- a/Mage.Sets/src/mage/cards/e/ErebossTitan.java +++ b/Mage.Sets/src/mage/cards/e/ErebossTitan.java @@ -1,4 +1,3 @@ - package mage.cards.e; import java.util.UUID; @@ -19,9 +18,8 @@ import mage.constants.CardType; import mage.constants.SubType; import mage.constants.ComparisonType; import mage.constants.Duration; -import mage.constants.TargetController; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; @@ -33,25 +31,21 @@ import mage.players.Player; */ public final class ErebossTitan extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); - - static { - filter.add(TargetController.OPPONENT.getControllerPredicate()); - } - public ErebossTitan(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{B}{B}"); this.subtype.add(SubType.GIANT); this.power = new MageInt(5); this.toughness = new MageInt(5); - // Erebos's Titan has indestructible as long as no opponent controls a creature. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield), - new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.EQUAL_TO, 0, false), - "As long as your opponents control no creatures, {this} has indestructible"))); + // As long as your opponents control no creatures, Erebos's Titan has indestructible. + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new GainAbilitySourceEffect( + IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield), + new PermanentsOnTheBattlefieldCondition( + StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, ComparisonType.EQUAL_TO, 0, false), + "As long as your opponents control no creatures, {this} has indestructible"))); - // Whenever a creature leaves an opponent's graveyard, you may discard a card. If you do, return Erebos's Titan from your graveyard to your hand. + // Whenever a creature card leaves an opponent's graveyard, you may discard a card. If you do, return Erebos's Titan from your graveyard to your hand. this.addAbility(new ErebossTitanTriggeredAbility()); } @@ -102,6 +96,6 @@ class ErebossTitanTriggeredAbility extends TriggeredAbilityImpl { @Override public String getTriggerPhrase() { - return "Whenever a creature leaves an opponent's graveyard, " ; + return "Whenever a creature card leaves an opponent's graveyard, " ; } } diff --git a/Mage.Sets/src/mage/cards/s/SyrKonradTheGrim.java b/Mage.Sets/src/mage/cards/s/SyrKonradTheGrim.java index 650293218b..ad96561c21 100644 --- a/Mage.Sets/src/mage/cards/s/SyrKonradTheGrim.java +++ b/Mage.Sets/src/mage/cards/s/SyrKonradTheGrim.java @@ -91,7 +91,7 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl { } // Or a creature card leaves your graveyard return zEvent.getFromZone() == Zone.GRAVEYARD - && zEvent.getPlayerId() == this.getControllerId(); + && card.isOwnedBy(this.getControllerId()); } @Override diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/eld/SyrKonradTheGrimTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/eld/SyrKonradTheGrimTest.java index 56c83b7568..01de677aa4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/eld/SyrKonradTheGrimTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/eld/SyrKonradTheGrimTest.java @@ -30,4 +30,26 @@ public class SyrKonradTheGrimTest extends CardTestPlayerBase { assertLife(playerA, 20); assertLife(playerB, 18); } + + @Test + public void reanimateFromOtherGraveyardTest() { + addCard(Zone.HAND, playerA, "Reanimate"); + addCard(Zone.BATTLEFIELD, playerA, "Swamp"); + addCard(Zone.BATTLEFIELD, playerA, "Syr Konrad, the Grim"); + addCard(Zone.GRAVEYARD, playerB, "Grizzly Bears"); + + setStopAt(1, PhaseStep.UNTAP); + execute(); + + assertLife(playerB, 20); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reanimate", "Grizzly Bears"); + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertGraveyardCount(playerB, 0); + assertPermanentCount(playerA, "Grizzly Bears", 1); + assertLife(playerA, 18); // loss of 2 from reanimate + assertLife(playerB, 20); // card leaving B's graveyard *shouldn't* cause loss of life + } }