Merge branch 'master' into staticValueRefactor

This commit is contained in:
Evan Kranzler 2020-01-05 20:46:59 -05:00
commit 38fe022fc0

View file

@ -1,7 +1,5 @@
package mage.abilities;
import java.util.Locale;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.effects.Effect;
import mage.constants.AbilityType;
@ -14,6 +12,9 @@ import mage.game.events.ZoneChangeEvent;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.Locale;
import java.util.UUID;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -155,7 +156,9 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
* latter triggers trigger from the game state after the move where the
* Kozilek card is itself and has the ability.
*/
if (event != null && event.getTargetId() != null && event.getTargetId().equals(getSourceId())) {
if (event == null || event.getTargetId() == null || !event.getTargetId().equals(getSourceId())) {
return super.isInUseableZone(game, source, event);
}
switch (event.getType()) {
case ZONE_CHANGE:
ZoneChangeEvent zce = (ZoneChangeEvent) event;
@ -169,7 +172,6 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
}
}
}
break;
case DESTROYED_PERMANENT:
if (isLeavesTheBattlefieldTrigger()) {
if (event.getType() == EventType.DESTROYED_PERMANENT) {
@ -180,14 +182,11 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
source = game.getLastKnownInformation(getSourceId(), event.getZone());
}
}
break;
case PHASED_OUT:
case PHASED_IN:
if (this.zone == Zone.ALL || game.getLastKnownInformation(getSourceId(), zone) != null) {
return this.hasSourceObjectAbility(game, source, event);
}
break;
}
}
return super.isInUseableZone(game, source, event);
}