From 6f92850a6b520d1fac59d224146dc60aee5cc72c Mon Sep 17 00:00:00 2001 From: drmDev Date: Tue, 29 Mar 2016 11:55:11 -0400 Subject: [PATCH] Tireless tracker 2nd ability fix --- .../shadowsoverinnistrad/TirelessTracker.java | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/TirelessTracker.java b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/TirelessTracker.java index 42c74f226c..027303b6e1 100644 --- a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/TirelessTracker.java +++ b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/TirelessTracker.java @@ -29,19 +29,21 @@ package mage.sets.shadowsoverinnistrad; import java.util.UUID; import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; -import mage.abilities.common.SacrificeAllTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.keyword.InvestigateEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.constants.TargetController; import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterControlledLandPermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -67,7 +69,7 @@ public class TirelessTracker extends CardImpl { this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new InvestigateEffect(), new FilterControlledLandPermanent("a land"), false, null, true)); // Whenever you sacrifice a Clue, put a +1/+1 counter on Tireless Tracker. - this.addAbility(new SacrificeAllTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), filter, TargetController.YOU, false)); + this.addAbility(new TirelessTrackerTriggeredAbility()); } public TirelessTracker(final TirelessTracker card) { @@ -79,3 +81,36 @@ public class TirelessTracker extends CardImpl { return new TirelessTracker(this); } } + +class TirelessTrackerTriggeredAbility extends TriggeredAbilityImpl { + + public TirelessTrackerTriggeredAbility() { + super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance())); + setLeavesTheBattlefieldTrigger(true); + } + + public TirelessTrackerTriggeredAbility(final TirelessTrackerTriggeredAbility ability) { + super(ability); + } + + @Override + public TirelessTrackerTriggeredAbility copy() { + return new TirelessTrackerTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SACRIFICED_PERMANENT; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return event.getPlayerId().equals(this.getControllerId()) + && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getSubtype().contains("Clue"); + } + + @Override + public String getRule() { + return "Whenever you sacrifice a Clue, " + super.getRule(); + } +}