mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
* Fixed a problem of triggered effects that detect if a creature was exiled but the creature ended in a another zone (e.g. commander) (fixes #5905),
This commit is contained in:
parent
12639bce26
commit
554c5baf25
3 changed files with 71 additions and 13 deletions
|
|
@ -1,12 +1,9 @@
|
|||
|
||||
|
||||
package mage.game.events;
|
||||
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -16,19 +13,20 @@ public class ZoneChangeEvent extends GameEvent {
|
|||
|
||||
private Zone fromZone;
|
||||
private Zone toZone;
|
||||
private Zone originalToZone;
|
||||
private Permanent target;
|
||||
|
||||
public ZoneChangeEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone) {
|
||||
super(EventType.ZONE_CHANGE, target.getId(), sourceId, playerId);
|
||||
this.fromZone = fromZone;
|
||||
this.toZone = toZone;
|
||||
this.setToZone(toZone);
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public ZoneChangeEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, List<UUID> appliedEffects) {
|
||||
super(EventType.ZONE_CHANGE, target.getId(), sourceId, playerId);
|
||||
this.fromZone = fromZone;
|
||||
this.toZone = toZone;
|
||||
this.setToZone(toZone);
|
||||
this.target = target;
|
||||
if (appliedEffects != null) {
|
||||
this.appliedEffects = appliedEffects;
|
||||
|
|
@ -38,13 +36,13 @@ public class ZoneChangeEvent extends GameEvent {
|
|||
public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone) {
|
||||
super(EventType.ZONE_CHANGE, targetId, sourceId, playerId);
|
||||
this.fromZone = fromZone;
|
||||
this.toZone = toZone;
|
||||
this.setToZone(toZone);
|
||||
}
|
||||
|
||||
public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, List<UUID> appliedEffects) {
|
||||
super(EventType.ZONE_CHANGE, targetId, sourceId, playerId);
|
||||
this.fromZone = fromZone;
|
||||
this.toZone = toZone;
|
||||
this.setToZone(toZone);
|
||||
if (appliedEffects != null) {
|
||||
this.appliedEffects = appliedEffects;
|
||||
}
|
||||
|
|
@ -57,7 +55,7 @@ public class ZoneChangeEvent extends GameEvent {
|
|||
public ZoneChangeEvent(UUID targetId, UUID playerId, Zone fromZone, Zone toZone) {
|
||||
this(targetId, null, playerId, fromZone, toZone);
|
||||
}
|
||||
|
||||
|
||||
public Zone getFromZone() {
|
||||
return fromZone;
|
||||
}
|
||||
|
|
@ -68,6 +66,9 @@ public class ZoneChangeEvent extends GameEvent {
|
|||
|
||||
public void setToZone(Zone toZone) {
|
||||
this.toZone = toZone;
|
||||
if (originalToZone == null && toZone != null) {
|
||||
originalToZone = toZone;
|
||||
}
|
||||
}
|
||||
|
||||
public Permanent getTarget() {
|
||||
|
|
@ -79,6 +80,11 @@ public class ZoneChangeEvent extends GameEvent {
|
|||
}
|
||||
|
||||
public boolean isDiesEvent() {
|
||||
return (toZone == Zone.GRAVEYARD && fromZone == Zone.BATTLEFIELD);
|
||||
return (toZone == Zone.GRAVEYARD && fromZone == Zone.BATTLEFIELD);
|
||||
}
|
||||
|
||||
public Zone getOriginalToZone() {
|
||||
return originalToZone;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue