From 2839681b72059407b7dde4de7af451bed4e5a929 Mon Sep 17 00:00:00 2001 From: Jeff Wadsworth Date: Wed, 10 Nov 2021 11:21:26 -0600 Subject: [PATCH] - Fixed #8442 --- .../mage/cards/s/SefrisOfTheHiddenWays.java | 64 ++++++++++++++++--- 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/Mage.Sets/src/mage/cards/s/SefrisOfTheHiddenWays.java b/Mage.Sets/src/mage/cards/s/SefrisOfTheHiddenWays.java index 6ddb6ca649..ae760b847e 100644 --- a/Mage.Sets/src/mage/cards/s/SefrisOfTheHiddenWays.java +++ b/Mage.Sets/src/mage/cards/s/SefrisOfTheHiddenWays.java @@ -1,9 +1,9 @@ package mage.cards.s; +import java.util.Set; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.CompletedDungeonTriggeredAbility; -import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility; import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; import mage.abilities.effects.keyword.VentureIntoTheDungeonEffect; import mage.cards.CardImpl; @@ -11,21 +11,23 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.SuperType; -import mage.constants.TargetController; -import mage.filter.FilterCard; import mage.filter.StaticFilters; -import mage.filter.common.FilterCreatureCard; import mage.target.common.TargetCardInYourGraveyard; import java.util.UUID; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.cards.Card; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeGroupEvent; /** * @author TheElk801 */ public final class SefrisOfTheHiddenWays extends CardImpl { - private static final FilterCard filter = new FilterCreatureCard("one or more creature cards"); - public SefrisOfTheHiddenWays(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}"); @@ -36,8 +38,8 @@ public final class SefrisOfTheHiddenWays extends CardImpl { this.toughness = new MageInt(3); // Whenever one or more creature cards are put into your graveyard from anywhere, venture into the dungeon. This ability triggers only once each turn. - this.addAbility(new PutCardIntoGraveFromAnywhereAllTriggeredAbility( - new VentureIntoTheDungeonEffect(), false, filter, TargetController.YOU + this.addAbility(new SefrisOfTheHiddenWaysTriggeredAbility( + new VentureIntoTheDungeonEffect().setText("") ).setTriggersOnce(true)); // Create Undead — Whenever you complete a dungeon, return target creature card from your graveyard to the battlefield. @@ -55,3 +57,49 @@ public final class SefrisOfTheHiddenWays extends CardImpl { return new SefrisOfTheHiddenWays(this); } } + +class SefrisOfTheHiddenWaysTriggeredAbility extends TriggeredAbilityImpl { + + public SefrisOfTheHiddenWaysTriggeredAbility(Effect effect) { + super(Zone.ALL, effect, false); + } + + public SefrisOfTheHiddenWaysTriggeredAbility(final SefrisOfTheHiddenWaysTriggeredAbility ability) { + super(ability); + } + + @Override + public SefrisOfTheHiddenWaysTriggeredAbility copy() { + return new SefrisOfTheHiddenWaysTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE_GROUP; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Boolean applies = false; + Card sourceCard = game.getCard(sourceId); + if (((ZoneChangeGroupEvent) event).getToZone() != Zone.GRAVEYARD + || sourceCard == null) { + return false; + } + ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; + Set cards = zEvent.getCards(); + for (Card card : cards) { + if (card.isCreature(game) + && sourceCard != card // 603.6c, 603.10a, and 603.10. + && !card.isCopy()) { + applies = true; + } + } + return applies; + } + + @Override + public String getTriggerPhrase() { + return "Whenever one or more creature cards are put into your graveyard from anywhere, venture into the dungeon."; + } +}