diff --git a/Mage.Common/src/main/java/mage/view/CardView.java b/Mage.Common/src/main/java/mage/view/CardView.java index c81824204c..7e4ea44717 100644 --- a/Mage.Common/src/main/java/mage/view/CardView.java +++ b/Mage.Common/src/main/java/mage/view/CardView.java @@ -40,6 +40,7 @@ import mage.util.SubTypes; import java.util.*; import java.util.stream.Collectors; +import mage.game.stack.StackObject; /** * @author BetaSteward_at_googlemail.com @@ -237,8 +238,8 @@ public class CardView extends SimpleCardView { * @param card * @param game * @param controlled is the card view created for the card controller - used - * for morph / face down cards to know which player may - * see information for the card + * for morph / face down cards to know which player may see information for + * the card */ public CardView(Card card, Game game, boolean controlled) { this(card, game, controlled, false, false); @@ -264,14 +265,12 @@ public class CardView extends SimpleCardView { /** * @param card * @param game - * @param controlled is the card view created for the card controller - * - used for morph / face down cards to know which - * player may see information for the card + * @param controlled is the card view created for the card controller - used + * for morph / face down cards to know which player may see information for + * the card * @param showFaceDownCard if true and the card is not on the battlefield, - * also a face down card is shown in the view, face - * down cards will be shown - * @param storeZone if true the card zone will be set in the zone - * attribute. + * also a face down card is shown in the view, face down cards will be shown + * @param storeZone if true the card zone will be set in the zone attribute. */ public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard, boolean storeZone) { super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null, card.getTokenDescriptor()); @@ -564,6 +563,23 @@ public class CardView extends SimpleCardView { this.rules.add("Chosen mode: " + mode.getEffects().getText(mode) + ""); } } + + // show target of a spell on the stack + if (!spell.getSpellAbility().getTargets().isEmpty()) { + StackObject stackObjectTarget = null; + for (Target target : spell.getSpellAbility().getTargets()) { + for (UUID targetId : target.getTargets()) { + MageObject mo = game.getObject(targetId); + if (mo instanceof StackObject) { + stackObjectTarget = (StackObject) mo; + } + if (stackObjectTarget != null) { + this.rules.add("Target on stack: " + stackObjectTarget.getIdName()); + } + } + } + + } } // Frame color @@ -993,7 +1009,8 @@ public class CardView extends SimpleCardView { } /** - * Name of the other side (transform), flipped, modal double faces card or copying card name. + * Name of the other side (transform), flipped, modal double faces card or + * copying card name. * * @return name */ diff --git a/Mage.Common/src/main/java/mage/view/StackAbilityView.java b/Mage.Common/src/main/java/mage/view/StackAbilityView.java index cbf0840312..b24dbc2491 100644 --- a/Mage.Common/src/main/java/mage/view/StackAbilityView.java +++ b/Mage.Common/src/main/java/mage/view/StackAbilityView.java @@ -21,6 +21,8 @@ import mage.util.GameLog; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import mage.game.stack.StackObject; +import mage.target.Target; /** * @author BetaSteward_at_googlemail.com @@ -140,6 +142,24 @@ public class StackAbilityView extends CardView { HintUtils.appendHints(rules, abilityHints); } } + + // show target of an ability on the stack if "related objects" is empty + if (!ability.getTargets().isEmpty() + && names.isEmpty()) { + StackObject stackObjectTarget = null; + for (Target target : ability.getTargets()) { + for (UUID targetId : target.getTargets()) { + MageObject mo = game.getObject(targetId); + if (mo instanceof StackObject) { + stackObjectTarget = (StackObject) mo; + } + if (stackObjectTarget != null) { + this.rules.add("Targeted ability related to this card: " + game.getCard(stackObjectTarget.getSourceId()).getIdName()); + } + } + } + + } } public CardView getSourceCard() {