changed how phasing is handled

This commit is contained in:
Evan Kranzler 2017-10-10 13:35:41 -04:00
parent 51f0e92103
commit 3d20e4dbef
5 changed files with 41 additions and 17 deletions

View file

@ -1484,16 +1484,15 @@ public abstract class PlayerImpl implements Player, Serializable {
// phasing out is known as phasing out "indirectly." An enchantment or Equipment
// that phased out indirectly won't phase in by itself, but instead phases in
// along with the card it's attached to.
for (UUID attachmentId : permanent.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null) {
attachment.phaseOut(game);
}
Permanent attachedTo = game.getPermanent(permanent.getAttachedTo());
if (!(attachedTo != null && attachedTo.getControllerId().equals(this.getId()))) {
permanent.phaseOut(game, false);
}
permanent.phaseOut(game);
}
for (Permanent permanent : phasedOut) {
permanent.phaseIn(game);
if (!permanent.isPhasedOutIndirectly()) {
permanent.phaseIn(game);
}
}
}