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
|
|
@ -29,6 +29,7 @@
|
|||
package mage.cards.basiclands;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.mana.GreenManaAbility;
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +44,7 @@ public abstract class Forest extends BasicLand {
|
|||
|
||||
public Forest(UUID ownerId, String cardNumber) {
|
||||
super(ownerId, cardNumber, "Forest", new GreenManaAbility());
|
||||
this.frameColor = ObjectColor.GREEN;
|
||||
}
|
||||
|
||||
public Forest(final Forest land) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
package mage.cards.basiclands;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.mana.BlueManaAbility;
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +44,7 @@ public abstract class Island extends BasicLand {
|
|||
|
||||
public Island(UUID ownerId, String cardNumber) {
|
||||
super(ownerId, cardNumber, "Island", new BlueManaAbility());
|
||||
this.frameColor = ObjectColor.BLUE;
|
||||
}
|
||||
|
||||
public Island(Island land) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
package mage.cards.basiclands;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.mana.RedManaAbility;
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +44,7 @@ public abstract class Mountain extends BasicLand {
|
|||
|
||||
public Mountain(UUID ownerId, String cardNumber) {
|
||||
super(ownerId, cardNumber, "Mountain", new RedManaAbility());
|
||||
this.frameColor = ObjectColor.RED;
|
||||
}
|
||||
|
||||
public Mountain(Mountain land) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
package mage.cards.basiclands;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.mana.WhiteManaAbility;
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +44,7 @@ public abstract class Plains extends BasicLand {
|
|||
|
||||
public Plains(UUID ownerId, String cardNumber) {
|
||||
super(ownerId, cardNumber, "Plains", new WhiteManaAbility());
|
||||
this.frameColor = ObjectColor.WHITE;
|
||||
}
|
||||
|
||||
public Plains(Plains land) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
package mage.cards.basiclands;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.mana.BlackManaAbility;
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +44,7 @@ public abstract class Swamp extends BasicLand {
|
|||
|
||||
public Swamp(UUID ownerId, String cardNumber) {
|
||||
super(ownerId, cardNumber, "Swamp", new BlackManaAbility());
|
||||
this.frameColor = ObjectColor.BLACK;
|
||||
}
|
||||
|
||||
public Swamp(Swamp land) {
|
||||
|
|
|
|||
|
|
@ -7,11 +7,18 @@ import mage.abilities.costs.mana.ManaCostsImpl;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.CardType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @author North
|
||||
*/
|
||||
public class MockCard extends CardImpl {
|
||||
// Needs to be here, as it is normally calculated from the
|
||||
// PlaneswalkerEntersWithLoyaltyAbility of the card... but the MockCard
|
||||
// only has MockAbilities.
|
||||
private int startingLoyalty;
|
||||
|
||||
public MockCard(CardInfo card) {
|
||||
super(null, card.getName());
|
||||
this.cardNumber = card.getCardNumber();
|
||||
|
|
@ -28,6 +35,9 @@ public class MockCard extends CardImpl {
|
|||
this.manaCost = new ManaCostsImpl(join(card.getManaCosts()));
|
||||
|
||||
this.color = card.getColor();
|
||||
|
||||
this.frameColor = card.getFrameColor();
|
||||
|
||||
this.splitCard = card.isSplitCard();
|
||||
this.flipCard = card.isFlipCard();
|
||||
|
||||
|
|
@ -36,9 +46,21 @@ public class MockCard extends CardImpl {
|
|||
if (card.getSecondSideName() != null && !card.getSecondSideName().isEmpty()) {
|
||||
this.secondSideCard = new MockCard(CardRepository.instance.findCard(card.getSecondSideName()));
|
||||
}
|
||||
|
||||
if (this.cardType.contains(CardType.PLANESWALKER)) {
|
||||
String startingLoyaltyString = card.getStartingLoyalty();
|
||||
if (startingLoyaltyString.isEmpty()) {
|
||||
Logger.getLogger(MockCard.class).warn("Planeswalker `" + this.name + "` has empty starting loyalty.");
|
||||
} else {
|
||||
try {
|
||||
this.startingLoyalty = Integer.parseInt(startingLoyaltyString);
|
||||
} catch (NumberFormatException e) {
|
||||
Logger.getLogger(MockCard.class).warn("Planeswalker `" + this.name + "` starting loyalty in bad format: `" + startingLoyaltyString + "`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.flipCardName = card.getFlipCardName();
|
||||
|
||||
for(String ruleText: card.getRules()) {
|
||||
this.addAbility(textAbilityFromString(ruleText));
|
||||
}
|
||||
|
|
@ -47,6 +69,11 @@ public class MockCard extends CardImpl {
|
|||
public MockCard(final MockCard card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartingLoyalty() {
|
||||
return startingLoyalty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MockCard copy() {
|
||||
|
|
|
|||
|
|
@ -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