- Change CardDetailPanel to use Card.getManaDisplay() to show split cards cost separately

This commit is contained in:
Sol
2013-03-06 04:59:48 +00:00
parent ff3e861303
commit ea04892ea0
2 changed files with 17 additions and 1 deletions

View File

@@ -1632,6 +1632,22 @@ public class Card extends GameEntity implements Comparable<Card> {
return this.getCharacteristics().getManaCost();
}
/**
* <p>
* Display for the field <code>manaCost</code>.
* </p>
*
* @return a {@link java.lang.String} object.
*/
public final String getManaDisplay() {
// If this is a split card, display mana as X / Y. Otherwise, Display it as normal
if (this.getRules() != null && this.getRules().getSplitType() == CardSplitType.Split) {
return String.format("%s / %s", this.getState(CardCharacteristicName.LeftSplit).getManaCost(),
this.getState(CardCharacteristicName.RightSplit).getManaCost());
}
return this.getCharacteristics().getManaCost().toString();
}
/**
* <p>
* addColor.

View File

@@ -205,7 +205,7 @@ public class CardDetailPanel extends FPanel {
if (card.getManaCost().toString().equals("") || card.isLand()) {
this.nameCostLabel.setText(card.getName());
} else {
this.nameCostLabel.setText(card.getName() + " - " + card.getManaCost());
this.nameCostLabel.setText(card.getName() + " - " + card.getManaDisplay());
}
this.typeLabel.setText(GuiDisplayUtil.formatCardType(card));