Tireless tracker 2nd ability fix

This commit is contained in:
drmDev 2016-03-29 11:55:11 -04:00
parent d93b4d4751
commit 6f92850a6b

View file

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