Merge pull request #2216 from stravant/master

Full characteristic-based card rendering for cards
This commit is contained in:
LevelX2 2016-09-03 09:13:49 +02:00 committed by GitHub
commit cb91c5b9aa
70 changed files with 6154 additions and 1013 deletions

View file

@ -0,0 +1,28 @@
package mage.cards;
/**
* @author stravant@gmail.com
*
* Enum listing the possible card faces for a card
*
* Because of Time Spiral block's shifted cards it is
* not sufficient to just look at a card's edition to
* determine what the card face should be.
*/
public enum CardBorder {
/* Old border card frames. ALPHA -> 8th ED */
OLD,
/* Future Sight frames. FUT futureshifted */
FUT,
/* Planar Chaos frames. PLC planeshifted */
PLC,
/* Modern card frames. 8th ED -> M15 */
MOD,
/* New border cards, M15 -> current */
M15
}

View file

@ -32,7 +32,7 @@ public abstract class MageCard extends JPanel {
public abstract void update(CardView card);
public abstract void updateImage();
public abstract void updateArtImage();
public abstract Image getImage();

View file

@ -68,14 +68,16 @@ public class CardView extends SimpleCardView {
protected String power;
protected String toughness;
protected String loyalty;
protected String startingLoyalty;
protected List<CardType> cardTypes;
protected List<String> subTypes;
protected List<String> superTypes;
protected ObjectColor color;
protected ObjectColor frameColor;
protected List<String> manaCost;
protected int convertedManaCost;
protected Rarity rarity;
protected MageObjectType mageObjectType = MageObjectType.NULL;
protected boolean isAbility;
@ -330,6 +332,12 @@ public class CardView extends SimpleCardView {
}
}
}
// Frame color
this.frameColor = card.getFrameColor(game);
// Get starting loyalty
this.startingLoyalty = "" + card.getStartingLoyalty();
}
public CardView(MageObject object) {
@ -374,6 +382,10 @@ public class CardView extends SimpleCardView {
this.expansionSetCode = stackAbility.getExpansionSetCode();
}
}
// Frame color
this.frameColor = object.getFrameColor(null);
// Starting loyalty. Must be extracted from an ability
this.startingLoyalty = "" + object.getStartingLoyalty();
}
protected CardView() {
@ -408,10 +420,12 @@ public class CardView extends SimpleCardView {
this.power = "";
this.toughness = "";
this.loyalty = "";
this.startingLoyalty = "";
this.cardTypes = new ArrayList<>();
this.subTypes = new ArrayList<>();
this.superTypes = new ArrayList<>();
this.color = new ObjectColor();
this.frameColor = new ObjectColor();
this.manaCost = new ArrayList<>();
this.convertedManaCost = 0;
@ -452,15 +466,16 @@ public class CardView extends SimpleCardView {
this.power = token.getPower().toString();
this.toughness = token.getToughness().toString();
this.loyalty = "";
this.startingLoyalty = "";
this.cardTypes = token.getCardType();
this.subTypes = token.getSubtype(null);
this.superTypes = token.getSupertype();
this.color = token.getColor(null);
this.frameColor = token.getFrameColor(null);
this.manaCost = token.getManaCost().getSymbols();
this.rarity = Rarity.NA;
this.type = token.getTokenType();
this.tokenSetCode = token.getOriginalExpansionSetCode();
this.tokenDescriptor = token.getTokenDescriptor();
}
protected final void setTargets(Targets targets) {
@ -519,6 +534,10 @@ public class CardView extends SimpleCardView {
public String getLoyalty() {
return loyalty;
}
public String getStartingLoyalty() {
return startingLoyalty;
}
public List<CardType> getCardTypes() {
return cardTypes;
@ -535,6 +554,10 @@ public class CardView extends SimpleCardView {
public ObjectColor getColor() {
return color;
}
public ObjectColor getFrameColor() {
return frameColor;
}
public List<String> getManaCost() {
return manaCost;
@ -767,3 +790,4 @@ public class CardView extends SimpleCardView {
}
}

View file

@ -53,4 +53,21 @@ public class CounterView implements Serializable {
public int getCount() {
return count;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (other == null) {
return false;
}
if (!(other instanceof CounterView)) {
return false;
}
CounterView oth = (CounterView)other;
return
(count == oth.count) &&
(name.equals(oth.name));
}
}