mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Identifier are shown for Looked at and revealed cards view
This commit is contained in:
parent
cb666a87ca
commit
bafd27f5b3
20 changed files with 58 additions and 56 deletions
|
@ -801,7 +801,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
ShowCardsDialog newReveal = new ShowCardsDialog();
|
||||
revealed.put(reveal.getName(), newReveal);
|
||||
}
|
||||
revealed.get(reveal.getName()).loadCards("Revealed " + reveal.getName(), CardsViewUtil.convertSimple(reveal.getCards(), loadedCards), bigCard, Config.dimensions, gameId, false);
|
||||
revealed.get(reveal.getName()).loadCards("Revealed " + reveal.getName(), reveal.getCards(), bigCard, Config.dimensions, gameId, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -814,7 +814,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
ShowCardsDialog newLookedAt = new ShowCardsDialog();
|
||||
lookedAt.put(looked.getName(), newLookedAt);
|
||||
}
|
||||
lookedAt.get(looked.getName()).loadCards("Looked at by " + looked.getName(), CardsViewUtil.convertSimple(looked.getCards(), loadedCards), bigCard, Config.dimensions, gameId, false);
|
||||
lookedAt.get(looked.getName()).loadCards("Looked at by " + looked.getName(), looked.getCards(), bigCard, Config.dimensions, gameId, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.mage.card.arcane.UI;
|
|||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import mage.client.dialog.MageDialog;
|
||||
import mage.constants.Rarity;
|
||||
|
||||
public class GuiDisplayUtil {
|
||||
|
|
|
@ -114,20 +114,19 @@ public class CardView extends SimpleCardView {
|
|||
protected boolean isPlayable;
|
||||
protected boolean isChoosable;
|
||||
protected boolean selected;
|
||||
protected boolean canAttack;
|
||||
protected boolean gameObject;
|
||||
protected boolean canAttack;
|
||||
|
||||
public CardView(Card card) {
|
||||
this(card, null, null, false);
|
||||
this(card, null, false);
|
||||
}
|
||||
|
||||
public CardView(Card card, UUID cardId) {
|
||||
this(card, null, null, false);
|
||||
this(card, null, false);
|
||||
this.id = cardId;
|
||||
}
|
||||
|
||||
public CardView(Card card, Game game, UUID cardId) {
|
||||
this(card, game, null, false);
|
||||
this(card, game, false);
|
||||
this.id = cardId;
|
||||
}
|
||||
|
||||
|
@ -135,15 +134,12 @@ public class CardView extends SimpleCardView {
|
|||
*
|
||||
* @param card
|
||||
* @param game
|
||||
* @param cardId not used?
|
||||
* @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
|
||||
*/
|
||||
public CardView(Card card, Game game, UUID cardId, boolean controlled) {
|
||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode());
|
||||
public CardView(Card card, Game game, boolean controlled) {
|
||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null);
|
||||
// no information available for face down cards as long it's not a controlled face down morph card
|
||||
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
|
||||
this.gameObject = game != null;
|
||||
|
||||
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
|
||||
if (game != null && card.isFaceDown(game)) {
|
||||
this.fillEmpty(card, controlled);
|
||||
if (card instanceof Spell) {
|
||||
|
@ -301,7 +297,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
public CardView(MageObject object) {
|
||||
super(object.getId(), "", 0, false, "");
|
||||
super(object.getId(), "", 0, false, "", true);
|
||||
this.name = object.getName();
|
||||
this.displayName = object.getName();
|
||||
if (object instanceof Permanent) {
|
||||
|
@ -345,11 +341,12 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
protected CardView() {
|
||||
super(null, "", 0, false, "");
|
||||
super(null, "", 0, false, "", true);
|
||||
}
|
||||
|
||||
public CardView(EmblemView emblem) {
|
||||
this(true);
|
||||
this.gameObject = true;
|
||||
this.id = emblem.getId();
|
||||
this.mageObjectType = MageObjectType.EMBLEM;
|
||||
this.name = emblem.getName();
|
||||
|
@ -368,13 +365,6 @@ public class CardView extends SimpleCardView {
|
|||
fillEmpty(null, false);
|
||||
}
|
||||
|
||||
|
||||
public CardView(String name) {
|
||||
this(true);
|
||||
this.name = name;
|
||||
this.displayName = name;
|
||||
}
|
||||
|
||||
private void fillEmpty(Card card, boolean controlled) {
|
||||
this.name = "Face Down";
|
||||
this.displayName = name;
|
||||
|
@ -736,8 +726,5 @@ public class CardView extends SimpleCardView {
|
|||
public void setCanAttack(boolean canAttack) {
|
||||
this.canAttack = canAttack;
|
||||
}
|
||||
|
||||
public boolean isGameObject() {
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
|||
|
||||
public CardsView(Game game, Collection<? extends Card> cards) {
|
||||
for (Card card: cards) {
|
||||
this.put(card.getId(), new CardView(card, game, null, false));
|
||||
this.put(card.getId(), new CardView(card, game, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import mage.game.command.Commander;
|
|||
public class CommanderView extends CardView implements CommandObjectView, Serializable{
|
||||
|
||||
public CommanderView(Commander commander, Card sourceCard, Game game) {
|
||||
super(sourceCard, game, null, false);
|
||||
super(sourceCard, game, false);
|
||||
this.mageObjectType = MageObjectType.COMMANDER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ public class DeckView implements Serializable {
|
|||
|
||||
public DeckView(Deck deck) {
|
||||
name = deck.getName();
|
||||
cards = new SimpleCardsView(deck.getCards());
|
||||
sideboard = new SimpleCardsView(deck.getSideboard());
|
||||
cards = new SimpleCardsView(deck.getCards(), false);
|
||||
sideboard = new SimpleCardsView(deck.getSideboard(), false);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
@ -44,8 +44,8 @@ public class DraftPickView implements Serializable {
|
|||
protected int timeout;
|
||||
|
||||
public DraftPickView(DraftPlayer player, int timeout) {
|
||||
this.booster = new SimpleCardsView(player.getBooster());
|
||||
this.picks = new SimpleCardsView(player.getDeck().getSideboard());
|
||||
this.booster = new SimpleCardsView(player.getBooster(), false);
|
||||
this.picks = new SimpleCardsView(player.getDeck().getSideboard(), false);
|
||||
this.picking = player.isPicking();
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ExileView extends CardsView {
|
|||
this.name = exileZone.getName();
|
||||
this.id = exileZone.getId();
|
||||
for (Card card: exileZone.getCards(game)) {
|
||||
this.put(card.getId(), new CardView(card, game, card.getId(), false));
|
||||
this.put(card.getId(), new CardView(card, game, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ public class GameView implements Serializable {
|
|||
}
|
||||
else {
|
||||
// Spell
|
||||
stack.put(stackObject.getId(), new CardView((Spell)stackObject, game, null, stackObject.getControllerId().equals(createdForPlayerId)));
|
||||
stack.put(stackObject.getId(), new CardView((Spell)stackObject, game, stackObject.getControllerId().equals(createdForPlayerId)));
|
||||
checkPaid(stackObject.getId(), (Spell)stackObject);
|
||||
}
|
||||
//stackOrder.add(stackObject.getId());
|
||||
|
|
|
@ -46,7 +46,7 @@ public class LookedAtView implements Serializable {
|
|||
public LookedAtView(String name, Cards cards, Game game) {
|
||||
this.name = name;
|
||||
for (Card card: cards.getCards(game)) {
|
||||
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
this.cards.put(card.getId(), new CardView(card, game, card.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class PermanentView extends CardView {
|
|||
private final boolean attachedToPermanent;
|
||||
|
||||
public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) {
|
||||
super(permanent, game, null, permanent.getControllerId().equals(createdForPlayerId));
|
||||
super(permanent, game, permanent.getControllerId().equals(createdForPlayerId));
|
||||
this.controlled = permanent.getControllerId().equals(createdForPlayerId);
|
||||
this.rules = permanent.getRules(game);
|
||||
this.tapped = permanent.isTapped();
|
||||
|
|
|
@ -95,12 +95,12 @@ public class PlayerView implements Serializable {
|
|||
|
||||
this.hasLeft = player.hasLeft();
|
||||
for (Card card: player.getGraveyard().getCards(game)) {
|
||||
graveyard.put(card.getId(), new CardView(card, game, card.getId(), false));
|
||||
graveyard.put(card.getId(), new CardView(card, game, false));
|
||||
}
|
||||
for (ExileZone exileZone : game.getExile().getExileZones()) {
|
||||
for (Card card : exileZone.getCards(game)) {
|
||||
if (player.getId().equals(card.getOwnerId())) {
|
||||
exile.put(card.getId(), new CardView(card, game, card.getId(), false)); // unnown if it's allowed to look under a face down card
|
||||
exile.put(card.getId(), new CardView(card, game, false)); // unnown if it's allowed to look under a face down card
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ import mage.game.Game;
|
|||
public class RevealedView implements Serializable {
|
||||
|
||||
private final String name;
|
||||
private final SimpleCardsView cards = new SimpleCardsView();
|
||||
private final CardsView cards = new CardsView();
|
||||
|
||||
public RevealedView(String name, Cards cards, Game game) {
|
||||
this.name = name;
|
||||
for (Card card: cards.getCards(game)) {
|
||||
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
this.cards.put(card.getId(), new CardView(card, game, card.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class RevealedView implements Serializable {
|
|||
return name;
|
||||
}
|
||||
|
||||
public SimpleCardsView getCards() {
|
||||
public CardsView getCards() {
|
||||
return cards;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,13 +41,18 @@ public class SimpleCardView implements Serializable {
|
|||
protected String tokenSetCode;
|
||||
protected int cardNumber;
|
||||
protected boolean usesVariousArt;
|
||||
protected boolean gameObject;
|
||||
|
||||
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean usesVariousArt, String tokenSetCode) {
|
||||
this(id, expansionSetCode, cardNumber, usesVariousArt, tokenSetCode, false);
|
||||
}
|
||||
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean usesVariousArt, String tokenSetCode, boolean isGameObject) {
|
||||
this.id = id;
|
||||
this.expansionSetCode = expansionSetCode;
|
||||
this.cardNumber = cardNumber;
|
||||
this.usesVariousArt = usesVariousArt;
|
||||
this.tokenSetCode = tokenSetCode;
|
||||
this.gameObject = isGameObject;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
|
@ -69,5 +74,8 @@ public class SimpleCardView implements Serializable {
|
|||
public String getTokenSetCode() {
|
||||
return tokenSetCode;
|
||||
}
|
||||
|
||||
|
||||
public boolean isGameObject() {
|
||||
return gameObject;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,9 +42,9 @@ public class SimpleCardsView extends LinkedHashMap<UUID, SimpleCardView> {
|
|||
|
||||
public SimpleCardsView() {}
|
||||
|
||||
public SimpleCardsView(Collection<Card> cards) {
|
||||
public SimpleCardsView(Collection<Card> cards, boolean isGameObject) {
|
||||
for (Card card: cards) {
|
||||
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), isGameObject));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ public class GameSessionPlayer extends GameSessionWatcher {
|
|||
Map<String, SimpleCardsView> handCards = new HashMap<>();
|
||||
for (UUID controlledPlayerId : player.getPlayersUnderYourControl()) {
|
||||
Player opponent = game.getPlayer(controlledPlayerId);
|
||||
handCards.put(opponent.getName(), new SimpleCardsView(opponent.getHand().getCards(game)));
|
||||
handCards.put(opponent.getName(), new SimpleCardsView(opponent.getHand().getCards(game), true));
|
||||
}
|
||||
gameView.setOpponentHands(handCards);
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public class GameSessionWatcher {
|
|||
Map<String, SimpleCardsView> handCards = new HashMap<>();
|
||||
for (Player player: game.getPlayers().values()) {
|
||||
if (player.hasUserPermissionToSeeHand(userId)) {
|
||||
handCards.put(player.getName(), new SimpleCardsView(player.getHand().getCards(game)));
|
||||
handCards.put(player.getName(), new SimpleCardsView(player.getHand().getCards(game), true));
|
||||
gameView.setWatchedHands(handCards);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.sets.tenthedition;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
|
@ -50,10 +51,10 @@ public class Peek extends CardImpl {
|
|||
super(ownerId, 94, "Peek", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}");
|
||||
this.expansionSetCode = "10E";
|
||||
|
||||
|
||||
// Look at target player's hand.
|
||||
this.getSpellAbility().addEffect(new PeekEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
|
||||
// Draw a card.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
|
||||
}
|
||||
|
@ -71,7 +72,7 @@ public class Peek extends CardImpl {
|
|||
class PeekEffect extends OneShotEffect {
|
||||
PeekEffect() {
|
||||
super(Outcome.Detriment);
|
||||
staticText = "Look at target player's hand";
|
||||
staticText = "look at target player's hand";
|
||||
}
|
||||
|
||||
PeekEffect(final PeekEffect effect) {
|
||||
|
@ -82,8 +83,9 @@ class PeekEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null && controller != null) {
|
||||
controller.lookAtCards("Peek", player.getHand(), game);
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (player != null && controller != null && sourceObject != null) {
|
||||
controller.lookAtCards(sourceObject.getIdName(), player.getHand(), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -32,10 +32,8 @@ import mage.abilities.SpellAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.AdjustingSourceCosts;
|
||||
import mage.abilities.effects.common.AffinityEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
@ -50,12 +48,14 @@ public class AffinityForLandTypeAbility extends SimpleStaticAbility implements A
|
|||
private final FilterControlledPermanent filter;
|
||||
|
||||
String text;
|
||||
String landType;
|
||||
|
||||
public AffinityForLandTypeAbility(String landType, String text) {
|
||||
super(Zone.OUTSIDE, new AffinityEffect(getFilter(landType)));
|
||||
this.filter = getFilter(landType);
|
||||
setRuleAtTheTop(true);
|
||||
this.text = text;
|
||||
this.landType = landType;
|
||||
}
|
||||
|
||||
private static FilterControlledPermanent getFilter(String landType) {
|
||||
|
@ -78,7 +78,7 @@ public class AffinityForLandTypeAbility extends SimpleStaticAbility implements A
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Affinity for " + text;
|
||||
return "Affinity for " + text + " <i>(This spell costs 1 less to cast for each " + landType + " you control.)</i>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,4 +90,4 @@ public class AffinityForLandTypeAbility extends SimpleStaticAbility implements A
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -343,7 +343,13 @@ public class Spell extends StackObjImpl implements Card {
|
|||
|
||||
@Override
|
||||
public String getIdName() {
|
||||
return getName() + " ["+getId().toString().substring(0,3) +"]";
|
||||
String idName;
|
||||
if (card != null) {
|
||||
idName = card.getId().toString().substring(0,3);
|
||||
} else {
|
||||
idName = getId().toString().substring(0,3);
|
||||
}
|
||||
return getName() + " ["+idName+"]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue