1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-13 17:00:09 -09:00

fixed failing tests

This commit is contained in:
Evan Kranzler 2020-01-05 20:44:43 -05:00
parent 7f0d793544
commit 724acc4e14

View file

@ -1,7 +1,5 @@
package mage.abilities; package mage.abilities;
import java.util.Locale;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.constants.AbilityType; import mage.constants.AbilityType;
@ -14,6 +12,9 @@ import mage.game.events.ZoneChangeEvent;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.Locale;
import java.util.UUID;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
@ -155,39 +156,37 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
* latter triggers trigger from the game state after the move where the * latter triggers trigger from the game state after the move where the
* Kozilek card is itself and has the ability. * 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())) {
switch (event.getType()) { return super.isInUseableZone(game, source, event);
case ZONE_CHANGE: }
ZoneChangeEvent zce = (ZoneChangeEvent) event; switch (event.getType()) {
if (event.getTargetId().equals(getSourceId()) && !zce.getToZone().isPublicZone()) { case ZONE_CHANGE:
// If an ability triggers when the object that has it is put into a hidden zone from a graveyard, ZoneChangeEvent zce = (ZoneChangeEvent) event;
// that ability triggers from the graveyard, (such as Golgari Brownscale), if (event.getTargetId().equals(getSourceId()) && !zce.getToZone().isPublicZone()) {
// Yixlid Jailer will prevent that ability from triggering. // If an ability triggers when the object that has it is put into a hidden zone from a graveyard,
if (zce.getFromZone().match(Zone.GRAVEYARD)) { // that ability triggers from the graveyard, (such as Golgari Brownscale),
if (!CardUtil.cardHadAbility(this, game.getLastKnownInformationCard(getSourceId(), zce.getFromZone()), getSourceId(), game)) { // Yixlid Jailer will prevent that ability from triggering.
return false; if (zce.getFromZone().match(Zone.GRAVEYARD)) {
} if (!CardUtil.cardHadAbility(this, game.getLastKnownInformationCard(getSourceId(), zce.getFromZone()), getSourceId(), game)) {
return false;
} }
} }
break; }
case DESTROYED_PERMANENT: case DESTROYED_PERMANENT:
if (isLeavesTheBattlefieldTrigger()) { if (isLeavesTheBattlefieldTrigger()) {
if (event.getType() == EventType.DESTROYED_PERMANENT) { if (event.getType() == EventType.DESTROYED_PERMANENT) {
source = game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD); source = game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD);
} else if (((ZoneChangeEvent) event).getTarget() != null) { } else if (((ZoneChangeEvent) event).getTarget() != null) {
source = ((ZoneChangeEvent) event).getTarget(); source = ((ZoneChangeEvent) event).getTarget();
} else { } else {
source = game.getLastKnownInformation(getSourceId(), event.getZone()); source = game.getLastKnownInformation(getSourceId(), event.getZone());
}
} }
break; }
case PHASED_OUT: case PHASED_OUT:
case PHASED_IN: case PHASED_IN:
if (this.zone == Zone.ALL || game.getLastKnownInformation(getSourceId(), zone) != null) { if (this.zone == Zone.ALL || game.getLastKnownInformation(getSourceId(), zone) != null) {
return this.hasSourceObjectAbility(game, source, event); return this.hasSourceObjectAbility(game, source, event);
} }
break;
}
} }
return super.isInUseableZone(game, source, event); return super.isInUseableZone(game, source, event);
} }