fixed Thraben Sentry

This commit is contained in:
Evan Kranzler 2017-09-14 13:36:17 -04:00
parent 68a42726a8
commit 73a8d64d5c
5 changed files with 17 additions and 20 deletions

View file

@ -3,6 +3,7 @@ package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
@ -15,7 +16,7 @@ import mage.target.targetpointer.FixedTarget;
*/
public class DiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
protected FilterCreaturePermanent filter;
protected FilterPermanent filter;
private boolean setTargetPointer;
public DiesCreatureTriggeredAbility(Effect effect, boolean optional) {
@ -34,15 +35,15 @@ public class DiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
this.setTargetPointer = setTargetPointer;
}
public DiesCreatureTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter) {
public DiesCreatureTriggeredAbility(Effect effect, boolean optional, FilterPermanent filter) {
this(effect, optional, filter, false);
}
public DiesCreatureTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter, boolean setTargetPointer) {
public DiesCreatureTriggeredAbility(Effect effect, boolean optional, FilterPermanent filter, boolean setTargetPointer) {
this(Zone.BATTLEFIELD, effect, optional, filter, setTargetPointer);
}
public DiesCreatureTriggeredAbility(Zone zone, Effect effect, boolean optional, FilterCreaturePermanent filter, boolean setTargetPointer) {
public DiesCreatureTriggeredAbility(Zone zone, Effect effect, boolean optional, FilterPermanent filter, boolean setTargetPointer) {
super(zone, effect, optional);
this.filter = filter;
this.setTargetPointer = setTargetPointer;
@ -68,7 +69,7 @@ public class DiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
if (filter.match(zEvent.getTarget(), sourceId, controllerId, game)) {
if (filter.match(zEvent.getTarget(), sourceId, controllerId, game) && zEvent.getTarget().isCreature()) {
if (setTargetPointer) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));

View file

@ -41,7 +41,7 @@ public final class StaticFilters {
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT = new FilterControlledArtifactPermanent();
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE = new FilterControlledPermanent("artifact or creature you control");
public static final FilterControlledPermanent FILTER_CONTROLLED_A_CREATURE = new FilterControlledCreaturePermanent("a creature you control");
public static final FilterPermanent FILTER_CONTROLLED_A_CREATURE = new FilterControlledCreaturePermanent("a creature you control");
public static final FilterControlledCreaturePermanent FILTER_CONTROLLED_ANOTHER_CREATURE = new FilterControlledCreaturePermanent("another creature");
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_NON_LAND = new FilterControlledPermanent("nonland permanent");
public static final FilterLandPermanent FILTER_LAND = new FilterLandPermanent();

View file

@ -25,19 +25,21 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.filter.common;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class FilterControlledCreaturePermanent extends FilterControlledPermanent {
public class FilterControlledCreaturePermanent extends FilterPermanent {
public FilterControlledCreaturePermanent() {
this("creature you control");
@ -46,8 +48,8 @@ public class FilterControlledCreaturePermanent extends FilterControlledPermanent
public FilterControlledCreaturePermanent(String name) {
super(name);
this.add(new CardTypePredicate(CardType.CREATURE));
}
this.add(new ControllerPredicate(TargetController.YOU));
}
public FilterControlledCreaturePermanent(SubType subtype, String name) {
super(name);