* Nether Traitor - Fixed that the last ability did not trigger if a Token creature died.

This commit is contained in:
LevelX2 2015-04-04 15:37:22 +02:00
parent 03b8a22c43
commit f61aa848cc

View file

@ -35,7 +35,6 @@ import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect; import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.ShadowAbility; import mage.abilities.keyword.ShadowAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ColoredManaSymbol; import mage.constants.ColoredManaSymbol;
@ -93,20 +92,22 @@ class NetherTraitorTriggeredAbility extends TriggeredAbilityImpl {
return new NetherTraitorTriggeredAbility(this); return new NetherTraitorTriggeredAbility(this);
} }
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
Card card = game.getCard(event.getTargetId()); if (zEvent.getTarget() != null &&
if (card != null && zEvent.getTarget().getOwnerId().equals(this.getControllerId()) &&
card.getOwnerId().equals(this.getControllerId()) && zEvent.getTarget().getCardType().contains(CardType.CREATURE)&&
card.getCardType().contains(CardType.CREATURE)&& !zEvent.getTarget().getId().equals(this.getSourceId())) {
!card.getId().equals(this.getSourceId())) {
return true; return true;
} }
} }
}
return false; return false;
} }