From 8d2723729bf8c4ff25bb8834fe842afe5a456c5e Mon Sep 17 00:00:00 2001 From: "Alex W. Jackson" Date: Tue, 5 Apr 2022 17:51:02 -0400 Subject: [PATCH] [NEO] Use correct class for Tameshi's triggered ability and remove unneeded custom code --- .../mage/cards/t/TameshiRealityArchitect.java | 47 +++++-------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/Mage.Sets/src/mage/cards/t/TameshiRealityArchitect.java b/Mage.Sets/src/mage/cards/t/TameshiRealityArchitect.java index 4e804b0c9a..394c4b77c5 100644 --- a/Mage.Sets/src/mage/cards/t/TameshiRealityArchitect.java +++ b/Mage.Sets/src/mage/cards/t/TameshiRealityArchitect.java @@ -3,7 +3,7 @@ package mage.cards.t; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.ActivateAsSorceryActivatedAbility; -import mage.abilities.common.ZoneChangeTriggeredAbility; +import mage.abilities.common.ZoneChangeAllTriggeredAbility; import mage.abilities.costs.common.ReturnToHandChosenControlledPermanentCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; @@ -12,24 +12,29 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.filter.FilterCard; +import mage.filter.FilterPermanent; import mage.filter.StaticFilters; import mage.filter.common.FilterArtifactOrEnchantmentCard; +import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ManaValuePredicate; import mage.game.Game; -import mage.game.events.GameEvent; import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetControlledPermanent; import mage.target.targetadjustment.TargetAdjuster; import java.util.UUID; -import mage.game.events.ZoneChangeEvent; -import mage.game.permanent.Permanent; /** * @author TheElk801 */ public final class TameshiRealityArchitect extends CardImpl { + private static final FilterPermanent filter = new FilterPermanent("noncreature permanent"); + + static { + filter.add(Predicates.not(CardType.CREATURE.getPredicate())); + } + public TameshiRealityArchitect(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); @@ -40,7 +45,9 @@ public final class TameshiRealityArchitect extends CardImpl { this.toughness = new MageInt(3); // Whenever one or more noncreature permanents are returned to hand, draw a card. This ability triggers only once each turn. - this.addAbility(new TameshiRealityArchitectTriggeredAbility()); + this.addAbility(new ZoneChangeAllTriggeredAbility(Zone.BATTLEFIELD, Zone.BATTLEFIELD, Zone.HAND, + new DrawCardSourceControllerEffect(1), filter, + "Whenever one or more noncreature permanents are returned to hand, ", false).setTriggersOnce(true)); // {X}{W}, Return a land you control to its owner's hand: Return target artifact or enchantment card with mana value X or less from your graveyard to the battlefield. Activate only as a sorcery. Ability ability = new ActivateAsSorceryActivatedAbility( @@ -79,33 +86,3 @@ enum TameshiRealityArchitectAdjuster implements TargetAdjuster { ability.addTarget(new TargetCardInYourGraveyard(filter)); } } - -class TameshiRealityArchitectTriggeredAbility extends ZoneChangeTriggeredAbility { - - TameshiRealityArchitectTriggeredAbility() { - super(Zone.BATTLEFIELD, Zone.BATTLEFIELD, Zone.HAND, new DrawCardSourceControllerEffect(1), - "Whenever one or more noncreature permanents are returned to hand, ", false); - this.setTriggersOnce(true); - } - - private TameshiRealityArchitectTriggeredAbility(final TameshiRealityArchitectTriggeredAbility ability) { - super(ability); - } - - @Override - public TameshiRealityArchitectTriggeredAbility copy() { - return new TameshiRealityArchitectTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - Permanent permanentMovedToHand = game.getPermanentOrLKIBattlefield(zEvent.getTargetId()); - if (permanentMovedToHand != null - && fromZone == zEvent.getFromZone() - && toZone == zEvent.getToZone()) { - return !permanentMovedToHand.isCreature(game); - } - return false; - } -}