diff --git a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index 3d25c7f77a..af27ddd9a5 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java @@ -334,6 +334,9 @@ public final class GuiDisplayUtil { buffer.append("[only controlled] "); } } + if (card instanceof PermanentView && ((PermanentView) card).isAttachedToDifferentlyControlledPermanent()) { + buffer.append('(').append(((PermanentView) card).getNameController()).append(") "); + } if (card.getMageObjectType() != MageObjectType.NULL) { buffer.append(card.getMageObjectType().toString()); } diff --git a/Mage.Common/src/main/java/mage/view/PermanentView.java b/Mage.Common/src/main/java/mage/view/PermanentView.java index de65c427b4..52189ca2da 100644 --- a/Mage.Common/src/main/java/mage/view/PermanentView.java +++ b/Mage.Common/src/main/java/mage/view/PermanentView.java @@ -29,11 +29,14 @@ public class PermanentView extends CardView { private final CardView original; // original card before transforms and modifications (null for opponents face down cards) private final boolean copy; private final String nameOwner; // only filled if != controller + private final String nameController; private final boolean controlled; private final UUID attachedTo; private final boolean morphed; private final boolean manifested; private final boolean attachedToPermanent; + // If this card is attached to a permanent which is controlled by a player other than the one which controls this permanent + private final boolean attachedControllerDiffers; public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) { super(permanent, game, permanent.getControllerId() != null && permanent.getControllerId().equals(createdForPlayerId)); @@ -89,6 +92,13 @@ public class PermanentView extends CardView { this.nameOwner = ""; } + Player controller = game.getPlayer(permanent.getControllerId()); + if (controller != null) { + nameController = controller.getName(); + } else { + nameController = ""; + } + // add info for face down permanents if (permanent.isFaceDown(game) && card != null) { if (showFaceDownInfo) { @@ -116,10 +126,13 @@ public class PermanentView extends CardView { } } // determines if shown in it's own column - if (permanent.getAttachedTo() != null) { - attachedToPermanent = game.getPermanent(permanent.getAttachedTo()) != null; + Permanent attachment = game.getPermanent(permanent.getAttachedTo()); + if (attachment != null) { + attachedToPermanent = true; + attachedControllerDiffers = !attachment.getControllerId().equals(permanent.getControllerId()); } else { attachedToPermanent = false; + attachedControllerDiffers = false; } } @@ -163,6 +176,10 @@ public class PermanentView extends CardView { return nameOwner; } + public String getNameController() { + return nameController; + } + public boolean isControlled() { return controlled; } @@ -179,6 +196,10 @@ public class PermanentView extends CardView { return attachedToPermanent; } + public boolean isAttachedToDifferentlyControlledPermanent() { + return attachedControllerDiffers; + } + public boolean isMorphed() { return morphed; }