mirror of
https://github.com/correl/mage.git
synced 2024-12-29 03:00:15 +00:00
- Fixed #8721
This commit is contained in:
parent
d8137e7e05
commit
4af54ef196
2 changed files with 47 additions and 10 deletions
|
@ -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("<span color='green'><i>Chosen mode: " + mode.getEffects().getText(mode) + "</i></span>");
|
||||
}
|
||||
}
|
||||
|
||||
// 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("<span color='green'><i>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
|
||||
*/
|
||||
|
|
|
@ -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("<span color='green'><i>Targeted ability related to this card: " + game.getCard(stackObjectTarget.getSourceId()).getIdName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public CardView getSourceCard() {
|
||||
|
|
Loading…
Reference in a new issue