mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
move CardHelper::getColor to CardView::getColorText
This commit is contained in:
parent
63df7f65a7
commit
d60e01d497
4 changed files with 15 additions and 15 deletions
|
|
@ -41,18 +41,7 @@ import mage.view.CardView;
|
||||||
public final class CardHelper {
|
public final class CardHelper {
|
||||||
private CardHelper() {
|
private CardHelper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getColor(CardView c) {
|
|
||||||
if (c.getColor().getColorCount() == 0) return "Colorless";
|
|
||||||
else if (c.getColor().getColorCount() > 1) return "Gold";
|
|
||||||
else if (c.getColor().isBlack()) return "Black";
|
|
||||||
else if (c.getColor().isBlue()) return "Blue";
|
|
||||||
else if (c.getColor().isWhite()) return "White";
|
|
||||||
else if (c.getColor().isGreen()) return "Green";
|
|
||||||
else if (c.getColor().isRed()) return "Red";
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getType(CardView c) {
|
public static String getType(CardView c) {
|
||||||
StringBuilder type = new StringBuilder();
|
StringBuilder type = new StringBuilder();
|
||||||
for (SuperType superType : c.getSuperTypes()) {
|
for (SuperType superType : c.getSuperTypes()) {
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,8 @@ public class MageCardComparator implements Comparator<CardView> {
|
||||||
break;
|
break;
|
||||||
// Color
|
// Color
|
||||||
case 3:
|
case 3:
|
||||||
aCom = CardHelper.getColor(a);
|
aCom = a.getColorText();
|
||||||
bCom = CardHelper.getColor(b);
|
bCom = a.getColorText();
|
||||||
break;
|
break;
|
||||||
// Type
|
// Type
|
||||||
case 4:
|
case 4:
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
||||||
castingCost = ManaSymbols.replaceSymbolsWithHTML(castingCost, ManaSymbols.Type.TABLE);
|
castingCost = ManaSymbols.replaceSymbolsWithHTML(castingCost, ManaSymbols.Type.TABLE);
|
||||||
return "<html>" + castingCost + "</html>";
|
return "<html>" + castingCost + "</html>";
|
||||||
case 3:
|
case 3:
|
||||||
return CardHelper.getColor(c);
|
return c.getColorText();
|
||||||
case 4:
|
case 4:
|
||||||
return CardHelper.getType(c);
|
return CardHelper.getType(c);
|
||||||
case 5:
|
case 5:
|
||||||
|
|
|
||||||
|
|
@ -961,4 +961,15 @@ public class CardView extends SimpleCardView {
|
||||||
return cardTypes.contains(CardType.CREATURE);
|
return cardTypes.contains(CardType.CREATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getColorText() {
|
||||||
|
if (getColor().getColorCount() == 0) return "Colorless";
|
||||||
|
else if (getColor().getColorCount() > 1) return "Gold";
|
||||||
|
else if (getColor().isBlack()) return "Black";
|
||||||
|
else if (getColor().isBlue()) return "Blue";
|
||||||
|
else if (getColor().isWhite()) return "White";
|
||||||
|
else if (getColor().isGreen()) return "Green";
|
||||||
|
else if (getColor().isRed()) return "Red";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue