mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
move methods from cardutil to magepermanent, cardview:getColorText now uses ObjectColor.getDescription
This commit is contained in:
parent
b3110af503
commit
27aea04820
4 changed files with 15 additions and 39 deletions
|
|
@ -10,4 +10,12 @@ public abstract class MagePermanent extends MageCard {
|
|||
public abstract void update(PermanentView card);
|
||||
public abstract PermanentView getOriginalPermanent();
|
||||
|
||||
public boolean isCreature(){
|
||||
return getOriginal().isCreature();
|
||||
}
|
||||
|
||||
public boolean isLand(){
|
||||
return getOriginal().isLand();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,25 +21,6 @@ public final class CardUtil {
|
|||
private static final String regexGreen = ".*\\x7b.{0,2}G.{0,2}\\x7d.*";
|
||||
private static final String regexWhite = ".*\\x7b.{0,2}W.{0,2}\\x7d.*";
|
||||
|
||||
|
||||
|
||||
|
||||
public static boolean isCreature(MagePermanent card) {
|
||||
return is(card.getOriginal(), CardType.CREATURE);
|
||||
}
|
||||
|
||||
public static boolean isPlaneswalker(MagePermanent card) {
|
||||
return is(card.getOriginal(), CardType.PLANESWALKER);
|
||||
}
|
||||
|
||||
public static boolean isLand(MagePermanent card) {
|
||||
return is(card.getOriginal(), CardType.LAND);
|
||||
}
|
||||
|
||||
public static boolean is(CardView card, CardType type) {
|
||||
return card.getCardTypes().contains(type);
|
||||
}
|
||||
|
||||
public static int getColorIdentitySortValue(List<String> manaCost, ObjectColor originalColor, List<String> rules) {
|
||||
ObjectColor color = new ObjectColor(originalColor);
|
||||
for (String rule : rules) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
package mage.view;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.xml.internal.ws.util.StringUtils;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Abilities;
|
||||
|
|
@ -963,22 +965,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
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 "";
|
||||
return StringUtils.capitalize(getColor().getDescription());
|
||||
}
|
||||
|
||||
public String getTypeText() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue