[NEO] Use correct class for Tameshi's triggered ability and remove unneeded custom code

This commit is contained in:
Alex W. Jackson 2022-04-05 17:51:02 -04:00
parent 4a15f88a43
commit 8d2723729b

View file

@ -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;
}
}