forked from External/mage
Working Card Rendering
This commit is contained in:
parent
eeaea4c566
commit
d5415d2d04
63 changed files with 17729 additions and 1769 deletions
|
|
@ -39,7 +39,10 @@ import java.util.List;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
|
||||
import mage.abilities.effects.PlaneswalkerRedirectionEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.mock.MockCard;
|
||||
|
|
@ -70,6 +73,8 @@ public class CardInfo {
|
|||
@DatabaseField
|
||||
protected String toughness;
|
||||
@DatabaseField
|
||||
protected String startingLoyalty;
|
||||
@DatabaseField
|
||||
protected int convertedManaCost;
|
||||
@DatabaseField(dataType = DataType.ENUM_STRING)
|
||||
protected Rarity rarity;
|
||||
|
|
@ -94,6 +99,8 @@ public class CardInfo {
|
|||
@DatabaseField
|
||||
protected boolean white;
|
||||
@DatabaseField
|
||||
protected String frameColor;
|
||||
@DatabaseField
|
||||
protected boolean splitCard;
|
||||
@DatabaseField
|
||||
protected boolean splitCardHalf;
|
||||
|
|
@ -132,6 +139,7 @@ public class CardInfo {
|
|||
this.secondSideName = secondSide.getName();
|
||||
}
|
||||
|
||||
this.frameColor = card.getFrameColor(null).toString();
|
||||
this.blue = card.getColor(null).isBlue();
|
||||
this.black = card.getColor(null).isBlack();
|
||||
this.green = card.getColor(null).isGreen();
|
||||
|
|
@ -144,13 +152,13 @@ public class CardInfo {
|
|||
this.setManaCosts(card.getManaCost().getSymbols());
|
||||
|
||||
int length = 0;
|
||||
for (String rule :card.getRules()) {
|
||||
for (String rule: card.getRules()) {
|
||||
length += rule.length();
|
||||
}
|
||||
if (length > MAX_RULE_LENGTH) {
|
||||
length = 0;
|
||||
ArrayList<String> shortRules = new ArrayList<>();
|
||||
for (String rule :card.getRules()) {
|
||||
for (String rule: card.getRules()) {
|
||||
if (length + rule.length() + 3 <= MAX_RULE_LENGTH) {
|
||||
shortRules.add(rule);
|
||||
length += rule.length() + 3;
|
||||
|
|
@ -173,6 +181,21 @@ public class CardInfo {
|
|||
this.splitCardHalf = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Starting loyalty
|
||||
if (card.getCardType().contains(CardType.PLANESWALKER)) {
|
||||
for (Ability ab: card.getAbilities()) {
|
||||
if (ab instanceof PlanswalkerEntersWithLoyalityCountersAbility) {
|
||||
this.startingLoyalty = "" + ((PlanswalkerEntersWithLoyalityCountersAbility) ab).getStartingLoyalty();
|
||||
}
|
||||
}
|
||||
if (this.startingLoyalty == null) {
|
||||
Logger.getLogger(CardInfo.class).warn("Planeswalker `" + card.getName() + "` missing starting loyalty");
|
||||
this.startingLoyalty = "";
|
||||
}
|
||||
} else {
|
||||
this.startingLoyalty = "";
|
||||
}
|
||||
}
|
||||
|
||||
public Card getCard() {
|
||||
|
|
@ -200,6 +223,10 @@ public class CardInfo {
|
|||
color.setWhite(white);
|
||||
return color;
|
||||
}
|
||||
|
||||
public ObjectColor getFrameColor() {
|
||||
return new ObjectColor(frameColor);
|
||||
}
|
||||
|
||||
private String joinList(List<String> items) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -286,6 +313,10 @@ public class CardInfo {
|
|||
public String getToughness() {
|
||||
return toughness;
|
||||
}
|
||||
|
||||
public String getStartingLoyalty() {
|
||||
return startingLoyalty;
|
||||
}
|
||||
|
||||
public String getSetCode() {
|
||||
return setCode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue