Clean up an inconsistency in ZoneChangeEvent handling

Some places set a bit on the ZoneChangeEvent if a permanent was meant
to enter the battlefield tapped but only MeldCard ever read that bit to
determine whether things should come into play tapped.
This commit is contained in:
Samuel Sandeen 2016-09-05 09:51:32 -04:00
parent c58ad022d7
commit db3c2e9d8c
5 changed files with 4 additions and 14 deletions

View file

@ -461,7 +461,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
@Override
public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, ArrayList<UUID> appliedEffects) {
ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD, appliedEffects, tapped);
ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD, appliedEffects);
if (facedown) {
this.setFaceDown(true, game);
}

View file

@ -279,7 +279,7 @@ public abstract class MeldCard extends CardImpl {
game.setScopeRelevant(false);
game.applyEffects();
if (entered) {
if (event.getFlag()) {
if (tapped) {
permanent.setTapped(true);
}
event.setTarget(permanent);

View file

@ -44,7 +44,7 @@ public enum Zone {
if (this.equals(EXILED)) {
return "exile zone";
}
return super.toString(); //To change body of generated methods, choose Tools | Templates.
return super.toString();
}
}

View file

@ -67,17 +67,12 @@ public class ZoneChangeEvent extends GameEvent {
}
public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, ArrayList<UUID> appliedEffects) {
this(targetId, sourceId, playerId, fromZone, toZone, appliedEffects, false);
}
public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, ArrayList<UUID> appliedEffects, boolean comesIntoPlayTapped) {
super(EventType.ZONE_CHANGE, targetId, sourceId, playerId);
this.fromZone = fromZone;
this.toZone = toZone;
if (appliedEffects != null) {
this.appliedEffects = appliedEffects;
}
this.flag = comesIntoPlayTapped;
}
public ZoneChangeEvent(Permanent target, UUID playerId, Zone fromZone, Zone toZone) {
@ -111,9 +106,4 @@ public class ZoneChangeEvent extends GameEvent {
public boolean isDiesEvent() {
return (toZone == Zone.GRAVEYARD && fromZone == Zone.BATTLEFIELD);
}
public boolean comesIntoPlayTapped() {
return this.flag;
}
}

View file

@ -3179,7 +3179,7 @@ public abstract class PlayerImpl implements Player, Serializable {
if (faceDown) {
card.setFaceDown(true, game);
}
ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), source.getSourceId(), controllingPlayerId, fromZone, Zone.BATTLEFIELD, appliedEffects, tapped);
ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), source.getSourceId(), controllingPlayerId, fromZone, Zone.BATTLEFIELD, appliedEffects);
if (!game.replaceEvent(event)) {
// get permanent
Permanent permanent;