UI: added draft rating info in card viewer

This commit is contained in:
Oleg Agafonov 2019-02-01 18:32:22 +04:00
parent 8e74cc1d6a
commit 0c8fdfcaf2
2 changed files with 39 additions and 9 deletions

View file

@ -2,8 +2,6 @@
package mage.view;
import com.google.gson.annotations.Expose;
import java.util.*;
import java.util.stream.Collectors;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Abilities;
@ -29,6 +27,9 @@ import mage.target.Target;
import mage.target.Targets;
import mage.util.SubTypeList;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -110,6 +111,8 @@ public class CardView extends SimpleCardView {
protected boolean canAttack;
protected boolean inViewerOnly;
protected Card originalCard = null;
public CardView(Card card) {
this(card, null, false);
}
@ -126,6 +129,7 @@ public class CardView extends SimpleCardView {
public CardView(CardView cardView) {
super(cardView.id, cardView.expansionSetCode, cardView.cardNumber, cardView.usesVariousArt, cardView.tokenSetCode, cardView.gameObject, cardView.tokenDescriptor);
this.originalCard = cardView.originalCard;
this.id = UUID.randomUUID();
this.parentId = cardView.parentId;
@ -199,14 +203,15 @@ public class CardView extends SimpleCardView {
this.selected = cardView.selected;
this.canAttack = cardView.canAttack;
this.inViewerOnly = cardView.inViewerOnly;
this.originalCard = cardView.originalCard.copy();
}
/**
* @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);
@ -232,15 +237,17 @@ 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());
this.originalCard = card;
// 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
boolean showFaceUp = true;
@ -460,10 +467,14 @@ public class CardView extends SimpleCardView {
// Get starting loyalty
this.startingLoyalty = "" + card.getStartingLoyalty();
}
public CardView(MageObject object) {
super(object.getId(), "", "0", false, "", true, "");
this.originalCard = null;
this.name = object.getName();
this.displayName = object.getName();
if (object instanceof Permanent) {
@ -1046,4 +1057,8 @@ public class CardView extends SimpleCardView {
public boolean inViewerOnly() {
return inViewerOnly;
}
public Card getOriginalCard() {
return this.originalCard;
}
}