mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00: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
|
@ -151,7 +151,7 @@ public class CardPluginImpl implements CardPlugin {
|
|||
outerLoop:
|
||||
//
|
||||
for (MagePermanent permanent : permanents) {
|
||||
if (!CardUtil.isLand(permanent) || CardUtil.isCreature(permanent)) {
|
||||
if (!permanent.isLand() || permanent.isCreature()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -418,11 +418,11 @@ public class CardPluginImpl implements CardPlugin {
|
|||
public boolean isType(MagePermanent card) {
|
||||
switch (this) {
|
||||
case land:
|
||||
return CardUtil.isLand(card);
|
||||
return card.isLand();
|
||||
case creature:
|
||||
return CardUtil.isCreature(card);
|
||||
return card.isCreature();
|
||||
case other:
|
||||
return !CardUtil.isLand(card) && !CardUtil.isCreature(card);
|
||||
return !card.isLand() && !card.isCreature();
|
||||
case attached:
|
||||
return card.getOriginalPermanent().isAttachedToPermanent();
|
||||
default:
|
||||
|
|
|
@ -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…
Reference in a new issue