checkstyle and refactor

This commit is contained in:
jendave
2011-10-29 06:24:29 +00:00
parent e646a6190e
commit 626fa471ee
69 changed files with 463 additions and 462 deletions

View File

@@ -44,7 +44,7 @@ public abstract class CardPanelContainer extends JPanel {
*/
private int cardWidthMin = 50;
private int cardWidthMax = Constant.Runtime.width[0];
private int cardWidthMax = Constant.Runtime.WIDTH[0];
/**
*
*/

View File

@@ -6810,7 +6810,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isBlack() {
return CardUtil.getColors(this).contains(Constant.Color.Black);
return CardUtil.getColors(this).contains(Constant.Color.BLACK);
}
/**
@@ -6821,7 +6821,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isBlue() {
return CardUtil.getColors(this).contains(Constant.Color.Blue);
return CardUtil.getColors(this).contains(Constant.Color.BLUE);
}
/**
@@ -6832,7 +6832,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isRed() {
return CardUtil.getColors(this).contains(Constant.Color.Red);
return CardUtil.getColors(this).contains(Constant.Color.RED);
}
/**
@@ -6843,7 +6843,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isGreen() {
return CardUtil.getColors(this).contains(Constant.Color.Green);
return CardUtil.getColors(this).contains(Constant.Color.GREEN);
}
/**
@@ -6854,7 +6854,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isWhite() {
return CardUtil.getColors(this).contains(Constant.Color.White);
return CardUtil.getColors(this).contains(Constant.Color.WHITE);
}
/**
@@ -6865,7 +6865,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isColorless() {
return CardUtil.getColors(this).contains(Constant.Color.Colorless);
return CardUtil.getColors(this).contains(Constant.Color.COLORLESS);
}
/**

View File

@@ -99,7 +99,7 @@ public class CardFilter {
if (name == "black") {
for (int i = 0; i < all.size(); i++) {
cardName = all.getCard(i);
if (!CardUtil.getColors(cardName).contains(Constant.Color.Black)) {
if (!CardUtil.getColors(cardName).contains(Constant.Color.BLACK)) {
listFilter.add(cardName);
}
@@ -109,7 +109,7 @@ public class CardFilter {
if (name == "blue") {
for (int i = 0; i < all.size(); i++) {
cardName = all.getCard(i);
if (!CardUtil.getColors(cardName).contains(Constant.Color.Blue)) {
if (!CardUtil.getColors(cardName).contains(Constant.Color.BLUE)) {
listFilter.add(cardName);
}
@@ -119,7 +119,7 @@ public class CardFilter {
if (name == "green") {
for (int i = 0; i < all.size(); i++) {
cardName = all.getCard(i);
if (!CardUtil.getColors(cardName).contains(Constant.Color.Green)) {
if (!CardUtil.getColors(cardName).contains(Constant.Color.GREEN)) {
listFilter.add(cardName);
}
@@ -129,7 +129,7 @@ public class CardFilter {
if (name == "red") {
for (int i = 0; i < all.size(); i++) {
cardName = all.getCard(i);
if (!CardUtil.getColors(cardName).contains(Constant.Color.Red)) {
if (!CardUtil.getColors(cardName).contains(Constant.Color.RED)) {
listFilter.add(cardName);
}
@@ -139,7 +139,7 @@ public class CardFilter {
if (name == "white") {
for (int i = 0; i < all.size(); i++) {
cardName = all.getCard(i);
if (!CardUtil.getColors(cardName).contains(Constant.Color.White)) {
if (!CardUtil.getColors(cardName).contains(Constant.Color.WHITE)) {
listFilter.add(cardName);
}
@@ -149,7 +149,7 @@ public class CardFilter {
if (name.equals("colorless")) {
for (int i = 0; i < all.size(); i++) {
cardName = all.getCard(i);
if (!CardUtil.getColors(cardName).contains(Constant.Color.Colorless)) {
if (!CardUtil.getColors(cardName).contains(Constant.Color.COLORLESS)) {
listFilter.add(cardName);
}

View File

@@ -184,11 +184,11 @@ public final class CardUtil {
*/
public static String getShortColor(final String longColor) {
Map<String, String> map = new HashMap<String, String>();
map.put(Constant.Color.Black.toString(), "B");
map.put(Constant.Color.Blue.toString(), "U");
map.put(Constant.Color.Green.toString(), "G");
map.put(Constant.Color.Red.toString(), "R");
map.put(Constant.Color.White.toString(), "W");
map.put(Constant.Color.BLACK.toString(), "B");
map.put(Constant.Color.BLUE.toString(), "U");
map.put(Constant.Color.GREEN.toString(), "G");
map.put(Constant.Color.RED.toString(), "R");
map.put(Constant.Color.WHITE.toString(), "W");
Object o = map.get(longColor);
if (o == null) {
@@ -245,19 +245,19 @@ public final class CardUtil {
case ' ':
break;
case 'G':
colors.add(Constant.Color.Green);
colors.add(Constant.Color.GREEN);
break;
case 'W':
colors.add(Constant.Color.White);
colors.add(Constant.Color.WHITE);
break;
case 'B':
colors.add(Constant.Color.Black);
colors.add(Constant.Color.BLACK);
break;
case 'U':
colors.add(Constant.Color.Blue);
colors.add(Constant.Color.BLUE);
break;
case 'R':
colors.add(Constant.Color.Red);
colors.add(Constant.Color.RED);
break;
default:
break;
@@ -265,7 +265,7 @@ public final class CardUtil {
}
for (String kw : c.getKeyword()) {
if (kw.startsWith(c.getName() + " is ") || kw.startsWith("CARDNAME is ")) {
for (String color : Constant.Color.Colors) {
for (String color : Constant.Color.COLORS) {
if (kw.endsWith(color + ".")) {
colors.add(color);
}

View File

@@ -88,15 +88,15 @@ public enum Color {
*/
public static Color convertFromString(final String s) {
if (s.equals(Constant.Color.White)) {
if (s.equals(Constant.Color.WHITE)) {
return Color.White;
} else if (s.equals(Constant.Color.Green)) {
} else if (s.equals(Constant.Color.GREEN)) {
return Color.Green;
} else if (s.equals(Constant.Color.Red)) {
} else if (s.equals(Constant.Color.RED)) {
return Color.Red;
} else if (s.equals(Constant.Color.Black)) {
} else if (s.equals(Constant.Color.BLACK)) {
return Color.Black;
} else if (s.equals(Constant.Color.Blue)) {
} else if (s.equals(Constant.Color.BLUE)) {
return Color.Blue;
}
@@ -148,17 +148,17 @@ public enum Color {
*/
public String toString() {
if (this.equals(Color.White)) {
return Constant.Color.White;
return Constant.Color.WHITE;
} else if (this.equals(Color.Green)) {
return Constant.Color.Green;
return Constant.Color.GREEN;
} else if (this.equals(Color.Red)) {
return Constant.Color.Red;
return Constant.Color.RED;
} else if (this.equals(Color.Black)) {
return Constant.Color.Black;
return Constant.Color.BLACK;
} else if (this.equals(Color.Blue)) {
return Constant.Color.Blue;
return Constant.Color.BLUE;
} else {
return Constant.Color.Colorless;
return Constant.Color.COLORLESS;
}
}
}

View File

@@ -600,7 +600,7 @@ public class Combat {
getList(a).remove(c);
// TODO if Declare Blockers and Declare Blockers (Abilities)
// merge this logic needs to be tweaked
if (getBlockers(a).size() == 0 && AllZone.getPhase().is(Constant.Phase.Combat_Declare_Blockers)) {
if (getBlockers(a).size() == 0 && AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
blocked.remove(a);
}
}
@@ -837,7 +837,7 @@ public class Combat {
// This function handles both Regular and First Strike combat assignment
Player player = AllZone.getCombat().getDefendingPlayer();
boolean bFirstStrike = AllZone.getPhase().is(Constant.Phase.Combat_FirstStrikeDamage);
boolean bFirstStrike = AllZone.getPhase().is(Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE);
HashMap<Card, Integer> defMap = AllZone.getCombat().getDefendingDamageMap();

View File

@@ -713,7 +713,7 @@ public class CombatUtil {
}
if (c.hasKeyword("CARDNAME can't attack unless defending player controls a blue permanent.")) {
temp = list.getColor(Constant.Color.Blue);
temp = list.getColor(Constant.Color.BLUE);
if (temp.isEmpty()) {
return false;
}
@@ -2018,8 +2018,8 @@ public class CombatUtil {
String phase = AllZone.getPhase().getPhase();
if (phase.equals(Constant.Phase.Combat_Declare_Attackers)
|| phase.equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)) {
if (phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
|| phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)) {
if (!cost.equals("0")) {
final Ability ability = new Ability(c, cost) {
@Override

View File

@@ -54,7 +54,7 @@ public class ComputerAI_General implements Computer {
ComputerUtil.chooseLandsToPlay();
if (AllZone.getStack().size() == 0) {
playCards(Constant.Phase.Main2);
playCards(Constant.Phase.MAIN2);
} else {
stackResponse();
}
@@ -188,7 +188,7 @@ public class ComputerAI_General implements Computer {
if (c.isPermanent()
&& c.hasKeyword("Flash")
&& (AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer()) || AllZone.getPhase()
.isBefore(Constant.Phase.Combat_Declare_Attackers_InstantAbility))) {
.isBefore(Constant.Phase.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY))) {
return false;
}
return true;
@@ -236,7 +236,7 @@ public class ComputerAI_General implements Computer {
if (c.isPermanent()
&& c.hasKeyword("Flash")
&& (AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer()) || AllZone.getPhase()
.isBefore(Constant.Phase.Combat_Declare_Attackers_InstantAbility))) {
.isBefore(Constant.Phase.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY))) {
return false;
}
return true;
@@ -472,7 +472,7 @@ public class ComputerAI_General implements Computer {
sas = getOtherPhases();
boolean pass = (sas.length == 0)
|| AllZone.getPhase().is(Constant.Phase.End_Of_Turn, AllZone.getComputerPlayer());
|| AllZone.getPhase().is(Constant.Phase.END_OF_TURN, AllZone.getComputerPlayer());
if (!pass) { // Each AF should check the phase individually
pass = ComputerUtil.playCards(sas);
}

View File

@@ -81,15 +81,15 @@ public class ComputerAI_Input extends Input {
computer.main1();
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
computer.beginCombat();
} else if (phase.equals(Constant.Phase.Combat_Declare_Attackers)) {
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
computer.declareAttackers();
} else if (phase.equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)) {
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)) {
computer.declareAttackersAfter();
} else if (phase.equals(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
computer.declareBlockersAfter();
} else if (phase.equals(Constant.Phase.Combat_End)) {
} else if (phase.equals(Constant.Phase.COMBAT_END)) {
computer.endOfCombat();
} else if (phase.equals(Constant.Phase.Main2)) {
} else if (phase.equals(Constant.Phase.MAIN2)) {
Log.debug("Computer main2");
computer.main2();
} else {

View File

@@ -712,23 +712,23 @@ public class ComputerUtil {
return colors;
}
if (!colors.contains(Constant.Color.Black) && m.isBasic() && m.mana().equals("B")) {
colors.add(Constant.Color.Black);
if (!colors.contains(Constant.Color.BLACK) && m.isBasic() && m.mana().equals("B")) {
colors.add(Constant.Color.BLACK);
}
if (!colors.contains(Constant.Color.White) && m.isBasic() && m.mana().equals("W")) {
colors.add(Constant.Color.White);
if (!colors.contains(Constant.Color.WHITE) && m.isBasic() && m.mana().equals("W")) {
colors.add(Constant.Color.WHITE);
}
if (!colors.contains(Constant.Color.Green) && m.isBasic() && m.mana().equals("G")) {
colors.add(Constant.Color.Green);
if (!colors.contains(Constant.Color.GREEN) && m.isBasic() && m.mana().equals("G")) {
colors.add(Constant.Color.GREEN);
}
if (!colors.contains(Constant.Color.Red) && m.isBasic() && m.mana().equals("R")) {
colors.add(Constant.Color.Red);
if (!colors.contains(Constant.Color.RED) && m.isBasic() && m.mana().equals("R")) {
colors.add(Constant.Color.RED);
}
if (!colors.contains(Constant.Color.Blue) && m.isBasic() && m.mana().equals("U")) {
colors.add(Constant.Color.Blue);
if (!colors.contains(Constant.Color.BLUE) && m.isBasic() && m.mana().equals("U")) {
colors.add(Constant.Color.BLUE);
}
if (!colors.contains(Constant.Color.Colorless) && m.isBasic() && m.mana().equals("1")) {
colors.add(Constant.Color.Colorless);
if (!colors.contains(Constant.Color.COLORLESS) && m.isBasic() && m.mana().equals("1")) {
colors.add(Constant.Color.COLORLESS);
}
return colors;

View File

@@ -40,31 +40,31 @@ public interface Constant {
public static final boolean[] MILL = new boolean[1];
/** The Constant DevMode. */
public static final boolean[] DevMode = new boolean[1]; // one for
public static final boolean[] DEV_MODE = new boolean[1]; // one for
// normal mode
// one for quest
// mode
/** The Constant NetConn. */
public static final boolean[] NetConn = new boolean[1];
public static final boolean[] NET_CONN = new boolean[1];
/** The Constant UpldDrft. */
public static final boolean[] UpldDrft = new boolean[1];
public static final boolean[] UPLOAD_DRAFT = new boolean[1];
/** The Constant RndCFoil. */
public static final boolean[] RndCFoil = new boolean[1];
public static final boolean[] RANDOM_FOIL = new boolean[1];
/** The Constant width. */
public static final int[] width = { 300 };
public static final int[] WIDTH = { 300 };
/** The Constant height. */
public static final int[] height = new int[1];
public static final int[] HEIGHT = new int[1];
/** The Constant stackSize. */
public static final int[] stackSize = new int[1];
public static final int[] STACK_SIZE = new int[1];
/** The Constant stackOffset. */
public static final int[] stackOffset = new int[1];
public static final int[] STACK_OFFSET = new int[1];
/**
* @return the gameType
@@ -128,34 +128,34 @@ public interface Constant {
String COMBAT_BEGIN = "BeginCombat";
/** The Constant Combat_Declare_Attackers. */
String Combat_Declare_Attackers = "Declare Attackers";
String COMBAT_DECLARE_ATTACKERS = "Declare Attackers";
/** The Constant Combat_Declare_Attackers_InstantAbility. */
String Combat_Declare_Attackers_InstantAbility = "Declare Attackers - Play Instants and Abilities";
String COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY = "Declare Attackers - Play Instants and Abilities";
/** The Constant Combat_Declare_Blockers. */
String Combat_Declare_Blockers = "Declare Blockers";
String COMBAT_DECLARE_BLOCKERS = "Declare Blockers";
/** The Constant Combat_Declare_Blockers_InstantAbility. */
String Combat_Declare_Blockers_InstantAbility = "Declare Blockers - Play Instants and Abilities";
String COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY = "Declare Blockers - Play Instants and Abilities";
/** The Constant Combat_Damage. */
String Combat_Damage = "Combat Damage";
String COMBAT_DAMAGE = "Combat Damage";
/** The Constant Combat_FirstStrikeDamage. */
String Combat_FirstStrikeDamage = "First Strike Damage";
String COMBAT_FIRST_STRIKE_DAMAGE = "First Strike Damage";
/** The Constant Combat_End. */
String Combat_End = "EndCombat";
String COMBAT_END = "EndCombat";
/** The Constant Main2. */
String Main2 = "Main2";
String MAIN2 = "Main2";
/** The Constant End_Of_Turn. */
String End_Of_Turn = "End of Turn";
String END_OF_TURN = "End of Turn";
/** The Constant Cleanup. */
String Cleanup = "Cleanup";
String CLEANUP = "Cleanup";
}
/**
@@ -229,37 +229,37 @@ public interface Constant {
public interface Color {
/** The Black. */
String Black = "black";
String BLACK = "black";
/** The Blue. */
String Blue = "blue";
String BLUE = "blue";
/** The Green. */
String Green = "green";
String GREEN = "green";
/** The Red. */
String Red = "red";
String RED = "red";
/** The White. */
String White = "white";
String WHITE = "white";
/** The Colorless. */
String Colorless = "colorless";
String COLORLESS = "colorless";
// color order "wubrg"
/** The Colors. */
String[] Colors = { White, Blue, Black, Red, Green, Colorless };
String[] COLORS = { WHITE, BLUE, BLACK, RED, GREEN, COLORLESS };
/** The only colors. */
String[] onlyColors = { White, Blue, Black, Red, Green };
String[] ONLY_COLORS = { WHITE, BLUE, BLACK, RED, GREEN };
/** The Snow. */
String Snow = "snow";
String SNOW = "snow";
/** The Mana colors. */
String[] ManaColors = { White, Blue, Black, Red, Green, Colorless, Snow };
String[] MANA_COLORS = { WHITE, BLUE, BLACK, RED, GREEN, COLORLESS, SNOW };
/** The loaded. */
boolean[] loaded = { false };
boolean[] LOADED = { false };
// public static final Constant_StringHashMap[] LandColor = new
// Constant_StringHashMap[1];
@@ -284,13 +284,13 @@ public interface Constant {
CardList[] COMPUTER_LIST = new CardList[1];
/** The human life. */
int[] humanLife = new int[1];
int[] HUMAN_LIFE = new int[1];
/** The computer life. */
int[] COMPUTER_LIFE = new int[1];
/** The opp icon name. */
String[] oppIconName = new String[1];
String[] OPP_ICON_NAME = new String[1];
}
/**

View File

@@ -1312,7 +1312,7 @@ public class GameAction {
// friendliness
CardFactoryInterface c = AllZone.getCardFactory();
Card.resetUniqueNumber();
boolean canRandomFoil = Constant.Runtime.RndCFoil[0]
boolean canRandomFoil = Constant.Runtime.RANDOM_FOIL[0]
&& Constant.Runtime.getGameType().equals(GameType.Constructed);
Random generator = MyRandom.random;
for (Entry<CardPrinted, Integer> stackOfCards : humanDeck.getMain()) {

View File

@@ -576,7 +576,7 @@ public final class GameActionUtil {
public void resolve() {
String color = "";
Object o = GuiUtils.getChoice("Choose mana color", Constant.Color.onlyColors);
Object o = GuiUtils.getChoice("Choose mana color", Constant.Color.ONLY_COLORS);
color = Input_PayManaCostUtil.getShortColorString((String) o);
Ability_Mana abMana = new Ability_Mana(c, "0", color) {

View File

@@ -246,9 +246,9 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
// Dev Mode Creation
JMenu devMenu = new JMenu(ForgeProps.getLocalized(MENU_BAR.DEV.TITLE));
devMenu.setEnabled(Constant.Runtime.DevMode[0]);
devMenu.setEnabled(Constant.Runtime.DEV_MODE[0]);
if (Constant.Runtime.DevMode[0]) {
if (Constant.Runtime.DEV_MODE[0]) {
canLoseByDecking.setSelected(Constant.Runtime.MILL[0]);
Action viewAIHand = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Hand), COMPUTER_HAND.BASE);
@@ -675,8 +675,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
if (AllZone.getQuestData() != null) {
File base = ForgeProps.getFile(IMAGE_ICON);
String iconName = "";
if (Constant.Quest.oppIconName[0] != null) {
iconName = Constant.Quest.oppIconName[0];
if (Constant.Quest.OPP_ICON_NAME[0] != null) {
iconName = Constant.Quest.OPP_ICON_NAME[0];
File file = new File(base, iconName);
ImageIcon icon = new ImageIcon(file.toString());
oppIconLabel.setIcon(icon);
@@ -1427,7 +1427,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
/** {@inheritDoc} */
public final boolean stopAtPhase(final Player turn, final String phase) {
if (turn.isComputer()) {
if (phase.equals(Constant.Phase.End_Of_Turn)) {
if (phase.equals(Constant.Phase.END_OF_TURN)) {
return cbAIEndOfTurn.isSelected();
} else if (phase.equals(Constant.Phase.UPKEEP)) {
return cbAIUpkeep.isSelected();
@@ -1435,11 +1435,11 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
return cbAIDraw.isSelected();
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
return cbAIBeginCombat.isSelected();
} else if (phase.equals(Constant.Phase.Combat_End)) {
} else if (phase.equals(Constant.Phase.COMBAT_END)) {
return cbAIEndCombat.isSelected();
}
} else {
if (phase.equals(Constant.Phase.End_Of_Turn)) {
if (phase.equals(Constant.Phase.END_OF_TURN)) {
return cbHumanEndOfTurn.isSelected();
} else if (phase.equals(Constant.Phase.UPKEEP)) {
return cbHumanUpkeep.isSelected();
@@ -1447,7 +1447,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
return cbHumanDraw.isSelected();
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
return cbHumanBeginCombat.isSelected();
} else if (phase.equals(Constant.Phase.Combat_End)) {
} else if (phase.equals(Constant.Phase.COMBAT_END)) {
return cbHumanEndCombat.isSelected();
}
}

View File

@@ -92,17 +92,17 @@ public final class GuiDisplayUtil implements NewConstants {
color = Color.gray;
} else if (list.size() > 1) {
color = Color.orange;
} else if (list.get(0).equals(Constant.Color.Black)) {
} else if (list.get(0).equals(Constant.Color.BLACK)) {
color = Color.black;
} else if (list.get(0).equals(Constant.Color.Green)) {
} else if (list.get(0).equals(Constant.Color.GREEN)) {
color = new Color(0, 220, 39);
} else if (list.get(0).equals(Constant.Color.White)) {
} else if (list.get(0).equals(Constant.Color.WHITE)) {
color = Color.white;
} else if (list.get(0).equals(Constant.Color.Red)) {
} else if (list.get(0).equals(Constant.Color.RED)) {
color = Color.red;
} else if (list.get(0).equals(Constant.Color.Blue)) {
} else if (list.get(0).equals(Constant.Color.BLUE)) {
color = Color.blue;
} else if (list.get(0).equals(Constant.Color.Colorless)) {
} else if (list.get(0).equals(Constant.Color.COLORLESS)) {
color = Color.gray;
} else {
color = new Color(200, 0, 230); // If your card has a violet border,
@@ -354,11 +354,11 @@ public final class GuiDisplayUtil implements NewConstants {
ArrayList<Card> manaPools = getManaPools(list);
ArrayList<Card> enchantedLands = getEnchantedLands(list);
ArrayList<Card> basicBlues = getBasics(list, Constant.Color.Blue);
ArrayList<Card> basicReds = getBasics(list, Constant.Color.Red);
ArrayList<Card> basicBlacks = getBasics(list, Constant.Color.Black);
ArrayList<Card> basicGreens = getBasics(list, Constant.Color.Green);
ArrayList<Card> basicWhites = getBasics(list, Constant.Color.White);
ArrayList<Card> basicBlues = getBasics(list, Constant.Color.BLUE);
ArrayList<Card> basicReds = getBasics(list, Constant.Color.RED);
ArrayList<Card> basicBlacks = getBasics(list, Constant.Color.BLACK);
ArrayList<Card> basicGreens = getBasics(list, Constant.Color.GREEN);
ArrayList<Card> basicWhites = getBasics(list, Constant.Color.WHITE);
ArrayList<Card> badlands = getNonBasicLand(list, "Badlands");
ArrayList<Card> bayou = getNonBasicLand(list, "Bayou");
ArrayList<Card> plateau = getNonBasicLand(list, "Plateau");
@@ -414,7 +414,7 @@ public final class GuiDisplayUtil implements NewConstants {
int x = marginX;
int cardOffset = Constant.Runtime.stackOffset[0];
int cardOffset = Constant.Runtime.STACK_OFFSET[0];
String color = "";
ArrayList<JPanel> cards = new ArrayList<JPanel>();
@@ -447,7 +447,7 @@ public final class GuiDisplayUtil implements NewConstants {
startANewStack = false;
}
if (!startANewStack && atInStack == Constant.Runtime.stackSize[0]) {
if (!startANewStack && atInStack == Constant.Runtime.STACK_SIZE[0]) {
startANewStack = true;
}
@@ -617,7 +617,7 @@ public final class GuiDisplayUtil implements NewConstants {
int x = marginX;
int cardOffset = Constant.Runtime.stackOffset[0];
int cardOffset = Constant.Runtime.STACK_OFFSET[0];
String color = "";
ArrayList<JPanel> cards = new ArrayList<JPanel>();
@@ -649,7 +649,7 @@ public final class GuiDisplayUtil implements NewConstants {
startANewStack = false;
}
if (!startANewStack && atInStack == Constant.Runtime.stackSize[0]) {
if (!startANewStack && atInStack == Constant.Runtime.STACK_SIZE[0]) {
startANewStack = true;
}
@@ -979,26 +979,26 @@ public final class GuiDisplayUtil implements NewConstants {
}
else if (name.equals("Swamp") || name.equals("Bog")) {
if (color == Constant.Color.Black) {
if (color == Constant.Color.BLACK) {
ret.add(c);
}
} else if (name.equals("Forest") || name.equals("Grass")) {
if (color == Constant.Color.Green) {
if (color == Constant.Color.GREEN) {
ret.add(c);
}
} else if (name.equals("Plains") || name.equals("White Sand")) {
if (color == Constant.Color.White) {
if (color == Constant.Color.WHITE) {
ret.add(c);
}
} else if (name.equals("Mountain") || name.equals("Rock")) {
if (color == Constant.Color.Red) {
if (color == Constant.Color.RED) {
ret.add(c);
}
} else if (name.equals("Island") || name.equals("Underwater")) {
if (color == Constant.Color.Blue) {
if (color == Constant.Color.BLUE) {
ret.add(c);
}
}

View File

@@ -129,7 +129,7 @@ public class HttpUtil {
} catch (IOException e) {
return;
}
if (Constant.Runtime.DevMode[0]) {
if (Constant.Runtime.DEV_MODE[0]) {
System.out.println(response.toString());
}
}

View File

@@ -249,10 +249,10 @@ public class ImageCache implements NewConstants {
private static boolean isExpectedSize(final String key, final BufferedImage image) {
if (key.endsWith(NORMAL)) {
// normal
return image.getWidth() == Constant.Runtime.width[0] && image.getHeight() == Constant.Runtime.height[0];
return image.getWidth() == Constant.Runtime.WIDTH[0] && image.getHeight() == Constant.Runtime.HEIGHT[0];
} else if (key.endsWith(TAPPED)) {
// tapped
return image.getWidth() == Constant.Runtime.height[0] && image.getHeight() == Constant.Runtime.width[0];
return image.getWidth() == Constant.Runtime.HEIGHT[0] && image.getHeight() == Constant.Runtime.WIDTH[0];
} else {
// original & full is never wrong
return true;
@@ -285,8 +285,8 @@ public class ImageCache implements NewConstants {
private static BufferedImage getNormalSizeImage(final BufferedImage original) {
int srcWidth = original.getWidth();
int srcHeight = original.getHeight();
int tgtWidth = Constant.Runtime.width[0];
int tgtHeight = Constant.Runtime.height[0];
int tgtWidth = Constant.Runtime.WIDTH[0];
int tgtHeight = Constant.Runtime.HEIGHT[0];
if (srcWidth == tgtWidth && srcHeight == tgtHeight) {
return original;
@@ -328,8 +328,8 @@ public class ImageCache implements NewConstants {
* int srcWidth = original.getWidth(); int srcHeight =
* original.getHeight();
*/
int tgtWidth = Constant.Runtime.width[0];
int tgtHeight = Constant.Runtime.height[0];
int tgtWidth = Constant.Runtime.WIDTH[0];
int tgtHeight = Constant.Runtime.HEIGHT[0];
AffineTransform at = new AffineTransform();
// at.scale((double) tgtWidth / srcWidth, (double) tgtHeight /

View File

@@ -373,7 +373,7 @@ public class MagicStack extends MyObservable {
System.out.println(sp.getSourceCard().getName() + " - activatingPlayer not set before adding to stack.");
}
if (AllZone.getPhase().is(Constant.Phase.Cleanup)) { // If something
if (AllZone.getPhase().is(Constant.Phase.CLEANUP)) { // If something
// triggers during
// Cleanup, need to
// repeat

View File

@@ -240,11 +240,11 @@ public class Phase extends MyObservable implements java.io.Serializable {
/** The phase order. */
String[] phaseOrder = { Constant.Phase.UNTAP, Constant.Phase.UPKEEP, Constant.Phase.DRAW, Constant.Phase.MAIN1,
Constant.Phase.COMBAT_BEGIN, Constant.Phase.Combat_Declare_Attackers,
Constant.Phase.Combat_Declare_Attackers_InstantAbility, Constant.Phase.Combat_Declare_Blockers,
Constant.Phase.Combat_Declare_Blockers_InstantAbility, Constant.Phase.Combat_FirstStrikeDamage,
Constant.Phase.Combat_Damage, Constant.Phase.Combat_End, Constant.Phase.Main2, Constant.Phase.End_Of_Turn,
Constant.Phase.Cleanup };
Constant.Phase.COMBAT_BEGIN, Constant.Phase.COMBAT_DECLARE_ATTACKERS,
Constant.Phase.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY, Constant.Phase.COMBAT_DECLARE_BLOCKERS,
Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY, Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE,
Constant.Phase.COMBAT_DAMAGE, Constant.Phase.COMBAT_END, Constant.Phase.MAIN2, Constant.Phase.END_OF_TURN,
Constant.Phase.CLEANUP };
/**
* <p>
@@ -307,7 +307,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
PhaseUtil.handleDraw();
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
PhaseUtil.verifyCombat();
} else if (phase.equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)) {
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)) {
if (inCombat()) {
PhaseUtil.handleDeclareAttackers();
} else {
@@ -316,13 +316,13 @@ public class Phase extends MyObservable implements java.io.Serializable {
}
// we can skip AfterBlockers and AfterAttackers if necessary
else if (phase.equals(Constant.Phase.Combat_Declare_Blockers)) {
else if (phase.equals(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
if (inCombat()) {
PhaseUtil.verifyCombat();
} else {
AllZone.getPhase().setNeedToNextPhase(true);
}
} else if (phase.equals(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
// After declare blockers are finished being declared mark them
// blocked and trigger blocking things
if (!inCombat()) {
@@ -330,7 +330,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
} else {
PhaseUtil.handleDeclareBlockers();
}
} else if (phase.equals(Constant.Phase.Combat_FirstStrikeDamage)) {
} else if (phase.equals(Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE)) {
if (!inCombat()) {
AllZone.getPhase().setNeedToNextPhase(true);
} else {
@@ -348,7 +348,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
CombatUtil.showCombat();
}
}
} else if (phase.equals(Constant.Phase.Combat_Damage)) {
} else if (phase.equals(Constant.Phase.COMBAT_DAMAGE)) {
if (!inCombat()) {
AllZone.getPhase().setNeedToNextPhase(true);
} else {
@@ -363,13 +363,13 @@ public class Phase extends MyObservable implements java.io.Serializable {
AllZone.getGameAction().checkStateEffects();
CombatUtil.showCombat();
}
} else if (phase.equals(Constant.Phase.Combat_End)) {
} else if (phase.equals(Constant.Phase.COMBAT_END)) {
// End Combat always happens
AllZone.getEndOfCombat().executeUntil();
AllZone.getEndOfCombat().executeAt();
} else if (phase.equals(Constant.Phase.End_Of_Turn)) {
} else if (phase.equals(Constant.Phase.END_OF_TURN)) {
AllZone.getEndOfTurn().executeAt();
} else if (phase.equals(Constant.Phase.Cleanup)) {
} else if (phase.equals(Constant.Phase.CLEANUP)) {
AllZone.getPhase().getPlayerTurn().setAssignedDamage(0);
// Reset Damage received map
@@ -447,32 +447,32 @@ public class Phase extends MyObservable implements java.io.Serializable {
AllZone.getComputerPlayer().getManaPool().clearPool();
}
if (getPhase().equals(Constant.Phase.Combat_Declare_Attackers)) {
if (getPhase().equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
AllZone.getStack().unfreezeStack();
nCombatsThisTurn++;
} else if (getPhase().equals(Constant.Phase.UNTAP)) {
nCombatsThisTurn = 0;
}
if (getPhase().equals(Constant.Phase.Combat_End)) {
if (getPhase().equals(Constant.Phase.COMBAT_END)) {
AllZone.getCombat().reset();
AllZone.getDisplay().showCombat("");
resetAttackedThisCombat(getPlayerTurn());
this.bCombat = false;
}
if (phaseOrder[phaseIndex].equals(Constant.Phase.Cleanup)) {
if (phaseOrder[phaseIndex].equals(Constant.Phase.CLEANUP)) {
bPreventCombatDamageThisTurn = false;
if (!bRepeat) {
AllZone.getPhase().setPlayerTurn(handleNextTurn());
}
}
if (is(Constant.Phase.Combat_Declare_Blockers)) {
if (is(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
AllZone.getStack().unfreezeStack();
}
if (is(Constant.Phase.Combat_End) && extraCombats > 0) {
if (is(Constant.Phase.COMBAT_END) && extraCombats > 0) {
// TODO: ExtraCombat needs to be changed for other spell/abilities
// that give extra combat
// can do it like ExtraTurn stack ExtraPhases
@@ -485,7 +485,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
AllZone.getCombat().reset();
AllZone.getCombat().setAttackingPlayer(player);
AllZone.getCombat().setDefendingPlayer(opp);
phaseIndex = findIndex(Constant.Phase.Combat_Declare_Attackers);
phaseIndex = findIndex(Constant.Phase.COMBAT_DECLARE_ATTACKERS);
} else {
if (!bRepeat) { // for when Cleanup needs to repeat itself
phaseIndex++;
@@ -873,7 +873,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
*/
public static boolean canCastSorcery(final Player player) {
return AllZone.getPhase().isPlayerTurn(player)
&& (AllZone.getPhase().getPhase().equals(Constant.Phase.Main2) || AllZone.getPhase().getPhase()
&& (AllZone.getPhase().getPhase().equals(Constant.Phase.MAIN2) || AllZone.getPhase().getPhase()
.equals(Constant.Phase.MAIN1)) && AllZone.getStack().size() == 0;
}

View File

@@ -564,11 +564,11 @@ public abstract class Player extends GameEntity {
// specific cards
if (AllZoneUtil.isCardInPlay("Spirit of Resistance", this)) {
if (AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.Black).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.Blue).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.Green).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.Red).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.White).size() > 0) {
if (AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.BLACK).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.BLUE).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.GREEN).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.RED).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.WHITE).size() > 0) {
return 0;
}
}
@@ -1107,7 +1107,7 @@ public abstract class Player extends GameEntity {
AllZone.getTriggerHandler().runTrigger("Drawn", runParams);
}
// lose:
else if (!Constant.Runtime.DevMode[0] || AllZone.getDisplay().canLoseByDecking()) {
else if (!Constant.Runtime.DEV_MODE[0] || AllZone.getDisplay().canLoseByDecking()) {
// if devMode is off, or canLoseByDecking is Enabled, run Lose
// Condition
if (!cantLose()) {

View File

@@ -254,7 +254,7 @@ public final class BoosterUtils {
List<CardPrinted> out = new ArrayList<CardPrinted>();
Collections.shuffle(in, MyRandom.random);
for (int i = 0; i < Constant.Color.Colors.length; i++) {
for (int i = 0; i < Constant.Color.COLORS.length; i++) {
CardPrinted check = findCardOfColor(in, i);
if (check != null) {
out.add(check);

View File

@@ -249,17 +249,17 @@ public final class CardColor implements Comparable<CardColor> {
}
switch (myColor) {
case 0:
return Constant.Color.Colorless;
return Constant.Color.COLORLESS;
case WHITE:
return Constant.Color.White;
return Constant.Color.WHITE;
case BLUE:
return Constant.Color.Blue;
return Constant.Color.BLUE;
case BLACK:
return Constant.Color.Black;
return Constant.Color.BLACK;
case RED:
return Constant.Color.Red;
return Constant.Color.RED;
case GREEN:
return Constant.Color.Green;
return Constant.Color.GREEN;
default:
return "multi";
}

View File

@@ -1288,11 +1288,11 @@ public class AbilityFactory {
return false;
}
if (sa.getRestrictions().getPlaneswalker() && AllZone.getPhase().is(Constant.Phase.Main2)) {
if (sa.getRestrictions().getPlaneswalker() && AllZone.getPhase().is(Constant.Phase.MAIN2)) {
return true;
}
return (AllZone.getPhase().is(Constant.Phase.End_Of_Turn) && AllZone.getPhase().isNextTurn(
return (AllZone.getPhase().is(Constant.Phase.END_OF_TURN) && AllZone.getPhase().isNextTurn(
AllZone.getComputerPlayer()));
}
@@ -1309,7 +1309,7 @@ public class AbilityFactory {
public static boolean waitForBlocking(final SpellAbility sa) {
return (sa.getSourceCard().isCreature() && sa.getPayCosts().getTap() && (AllZone.getPhase().isBefore(
Constant.Phase.Combat_Declare_Blockers_InstantAbility) || AllZone.getPhase().isNextTurn(
Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY) || AllZone.getPhase().isNextTurn(
AllZone.getHumanPlayer())));
}

View File

@@ -272,7 +272,7 @@ public class AbilityFactory_AlterLife {
}
// Don't use lifegain before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.Main2) && !params.containsKey("ActivationPhases")) {
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")) {
return false;
}
@@ -637,7 +637,7 @@ public class AbilityFactory_AlterLife {
}
// Don't use loselife before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.Main2) && !params.containsKey("ActivationPhases") && !priority) {
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases") && !priority) {
return false;
}
@@ -1071,7 +1071,7 @@ public class AbilityFactory_AlterLife {
}
// Don't use poison before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.Main2) && !params.containsKey("ActivationPhases")) {
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")) {
return false;
}
@@ -1289,7 +1289,7 @@ public class AbilityFactory_AlterLife {
}
// Don't use setLife before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.Main2) && !params.containsKey("ActivationPhases")) {
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")) {
return false;
}

View File

@@ -309,13 +309,13 @@ public final class AbilityFactory_Animate {
// don't use instant speed animate abilities outside humans
// Combat_Declare_Attackers_InstantAbility step
if ((!AllZone.getPhase().is(Constant.Phase.Combat_Declare_Attackers_InstantAbility) || AllZone.getCombat()
if ((!AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || AllZone.getCombat()
.getAttackers().length == 0) && AllZone.getPhase().isPlayerTurn(AllZone.getHumanPlayer())) {
return false;
}
// don't activate during main2 unless this effect is permanent
if (AllZone.getPhase().is(Constant.Phase.Main2) && !params.containsKey("Permanent")) {
if (AllZone.getPhase().is(Constant.Phase.MAIN2) && !params.containsKey("Permanent")) {
return false;
}

View File

@@ -424,7 +424,7 @@ public final class AbilityFactory_ChangeZone {
}
// don't use fetching to top of library/graveyard before main2
if (AllZone.getPhase().isBefore(Constant.Phase.Main2) && !params.containsKey("ActivationPhases")
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")
&& !destination.equals("Battlefield") && !destination.equals("Hand")) {
return false;
}
@@ -1326,7 +1326,7 @@ public final class AbilityFactory_ChangeZone {
}
}
// Save combatants
else if (AllZone.getPhase().is(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
else if (AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
CardList combatants = aiPermanents.getType("Creature");
CardListUtil.sortByEvaluateCreature(combatants);
@@ -1376,7 +1376,7 @@ public final class AbilityFactory_ChangeZone {
&& destination.equals(Zone.Exile)
&& (subAPI.equals("DelayedTrigger") || (subAPI.equals("ChangeZone")
&& subAffected.equals("Remembered")))
&& !(AllZone.getPhase().is(Constant.Phase.Combat_Declare_Attackers_InstantAbility) || sa.isAbility())) {
&& !(AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || sa.isAbility())) {
return false;
}

View File

@@ -630,10 +630,10 @@ public final class AbilityFactory_Choose {
if (sa.getActivatingPlayer().isHuman()) {
if (params.containsKey("OrColors")) {
final List<String> o = GuiUtils.getChoices("Choose a color or colors",
Constant.Color.onlyColors);
Constant.Color.ONLY_COLORS);
card.setChosenColor(new ArrayList<String>(o));
} else {
final Object o = GuiUtils.getChoice("Choose a color", Constant.Color.onlyColors);
final Object o = GuiUtils.getChoice("Choose a color", Constant.Color.ONLY_COLORS);
if (null == o) {
return;
}
@@ -671,7 +671,7 @@ public final class AbilityFactory_Choose {
}
}
if (chosen.equals("")) {
chosen = Constant.Color.Green;
chosen = Constant.Color.GREEN;
}
GuiUtils.getChoice("Computer picked: ", chosen);
final ArrayList<String> colorTemp = new ArrayList<String>();

View File

@@ -189,7 +189,7 @@ public final class AbilityFactory_Combat {
if (AllZone.getPhase().isPlayerTurn(sa.getActivatingPlayer())) {
return false;
}
if (!AllZone.getPhase().is(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
if (!AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
return false;
}
@@ -229,9 +229,9 @@ public final class AbilityFactory_Combat {
// AI should only activate this during Human's turn
boolean chance;
if (AllZone.getPhase().isPlayerTurn(sa.getActivatingPlayer().getOpponent())) {
chance = AllZone.getPhase().isBefore(Constant.Phase.Combat_FirstStrikeDamage);
chance = AllZone.getPhase().isBefore(Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE);
} else {
chance = AllZone.getPhase().isAfter(Constant.Phase.Combat_Damage);
chance = AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DAMAGE);
}
final Ability_Sub subAb = sa.getSubAbility();
@@ -263,9 +263,9 @@ public final class AbilityFactory_Combat {
boolean chance;
if (AllZone.getPhase().isPlayerTurn(sa.getActivatingPlayer().getOpponent())) {
chance = AllZone.getPhase().isBefore(Constant.Phase.Combat_FirstStrikeDamage);
chance = AllZone.getPhase().isBefore(Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE);
} else {
chance = AllZone.getPhase().isAfter(Constant.Phase.Combat_Damage);
chance = AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DAMAGE);
}
// check SubAbilities DoTrigger?
@@ -912,7 +912,7 @@ public final class AbilityFactory_Combat {
}
// only use on creatures that can attack
if (!AllZone.getPhase().isBefore(Constant.Phase.Main2)) {
if (!AllZone.getPhase().isBefore(Constant.Phase.MAIN2)) {
return false;
}

View File

@@ -362,7 +362,7 @@ public class AbilityFactory_Counters {
}
// Don't use non P1P1/M1M1 counters before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.Main2) && !params.containsKey("ActivationPhases")
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")
&& !(type.equals("P1P1") || type.equals("M1M1"))) {
return false;
}

View File

@@ -319,7 +319,7 @@ public class AbilityFactory_DealDamage {
if (source.getName().equals("Stuffy Doll")) {
// Now stuffy sits around for blocking
// TODO(sol): this should also happen if Stuffy is going to die
if (AllZone.getPhase().is(Constant.Phase.End_Of_Turn, AllZone.getHumanPlayer())) {
if (AllZone.getPhase().is(Constant.Phase.END_OF_TURN, AllZone.getHumanPlayer())) {
return true;
} else {
return false;
@@ -398,7 +398,7 @@ public class AbilityFactory_DealDamage {
if (AF.isSpell()) {
// If this is a spell, cast it instead of discarding
if ((AllZone.getPhase().is(Constant.Phase.End_Of_Turn) || AllZone.getPhase().is(Constant.Phase.Main2))
if ((AllZone.getPhase().is(Constant.Phase.END_OF_TURN) || AllZone.getPhase().is(Constant.Phase.MAIN2))
&& AllZone.getPhase().isPlayerTurn(comp) && (hand.size() > comp.getMaxHandSize())) {
return true;
}

View File

@@ -339,7 +339,7 @@ public final class AbilityFactory_Debuff {
private static boolean debuffTgtAI(final AbilityFactory af, final SpellAbility sa, final ArrayList<String> kws,
final boolean mandatory) {
// this would be for evasive things like Flying, Unblockable, etc
if (!mandatory && AllZone.getPhase().isAfter(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
if (!mandatory && AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
return false;
}

View File

@@ -293,7 +293,7 @@ public class AbilityFactory_GainControl {
// Don't steal something if I can't Attack without, or prevent it from
// blocking at least
if (lose != null && lose.contains("EOT") && AllZone.getPhase().isAfter(Constant.Phase.Combat_Declare_Blockers)) {
if (lose != null && lose.contains("EOT") && AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
return false;
}

View File

@@ -556,14 +556,14 @@ public class AbilityFactory_Mana {
colors = hasProperty(maxChoices, cards, colors);
} else if (reflectProperty.equals("Produced")) {
String producedColors = (String) abMana.getTriggeringObject("Produced");
for (String col : Constant.Color.onlyColors) {
for (String col : Constant.Color.ONLY_COLORS) {
String s = Input_PayManaCostUtil.getShortColorString(col);
if (producedColors.contains(s) && !colors.contains(col)) {
colors.add(col);
}
}
if (maxChoices == 6 && producedColors.contains("1") && !colors.contains(Constant.Color.Colorless)) {
colors.add(Constant.Color.Colorless);
if (maxChoices == 6 && producedColors.contains("1") && !colors.contains(Constant.Color.COLORLESS)) {
colors.add(Constant.Color.COLORLESS);
}
} else if (reflectProperty.equals("Produce")) {
ArrayList<Ability_Mana> abilities = new ArrayList<Ability_Mana>();
@@ -623,7 +623,7 @@ public class AbilityFactory_Mana {
for (Card c : cards) {
// For each card, go through all the colors and if the card is that
// color, add
for (String col : Constant.Color.onlyColors) {
for (String col : Constant.Color.ONLY_COLORS) {
if (c.isColor(col) && !colors.contains(col)) {
colors.add(col);
if (colors.size() == maxChoices) {
@@ -649,15 +649,15 @@ public class AbilityFactory_Mana {
* @return a {@link java.util.ArrayList} object.
*/
private static ArrayList<String> canProduce(final int maxChoices, final Ability_Mana ab, final ArrayList<String> colors) {
for (String col : Constant.Color.onlyColors) {
for (String col : Constant.Color.ONLY_COLORS) {
String s = Input_PayManaCostUtil.getShortColorString(col);
if (ab.canProduce(s) && !colors.contains(col)) {
colors.add(col);
}
}
if (maxChoices == 6 && ab.canProduce("1") && !colors.contains(Constant.Color.Colorless)) {
colors.add(Constant.Color.Colorless);
if (maxChoices == 6 && ab.canProduce("1") && !colors.contains(Constant.Color.COLORLESS)) {
colors.add(Constant.Color.COLORLESS);
}
return colors;

View File

@@ -780,7 +780,7 @@ public class AbilityFactory_PermanentState {
if (turn.isHuman()) {
// Tap things down if it's Human's turn
} else if (phase.inCombat() && phase.isBefore(Constant.Phase.Combat_Declare_Blockers)) {
} else if (phase.inCombat() && phase.isBefore(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
// TODO Tap creatures down if in combat
} else {
// Generally don't want to tap things during AI turn outside of

View File

@@ -266,7 +266,7 @@ public class AbilityFactory_PreventDamage {
}
}
} else {
if (AllZone.getPhase().is(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
if (AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
boolean flag = false;
for (Object o : objects) {
if (o instanceof Card) {
@@ -316,7 +316,7 @@ public class AbilityFactory_PreventDamage {
}
} // Protect combatants
else if (AllZone.getPhase().is(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
else if (AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (tgt.canTgtPlayer() && CombatUtil.wouldLoseLife(AllZone.getCombat())
&& (CombatUtil.lifeInDanger(AllZone.getCombat()) || sa.isAbility())) {
tgt.addTarget(AllZone.getComputerPlayer());
@@ -419,7 +419,7 @@ public class AbilityFactory_PreventDamage {
if (compTargetables.size() > 0) {
CardList combatants = compTargetables.getType("Creature");
CardListUtil.sortByEvaluateCreature(combatants);
if (AllZone.getPhase().is(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
if (AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
for (Card c : combatants) {
if (CombatUtil.combatantWouldBeDestroyed(c)) {
tgt.addTarget(c);

View File

@@ -155,7 +155,7 @@ public final class AbilityFactory_Protection {
}
private static boolean hasProtectionFrom(final Card card, final String color) {
ArrayList<String> onlyColors = new ArrayList<String>(Arrays.asList(Constant.Color.onlyColors));
ArrayList<String> onlyColors = new ArrayList<String>(Arrays.asList(Constant.Color.ONLY_COLORS));
// make sure we have a valid color
if (!onlyColors.contains(color)) {
@@ -214,7 +214,7 @@ public final class AbilityFactory_Protection {
// will the creature attack (only relevant for sorcery speed)?
if (CardFactoryUtil.AI_doesCreatureAttack(c)
&& AllZone.getPhase().isBefore(Constant.Phase.Combat_Declare_Attackers)
&& AllZone.getPhase().isBefore(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())) {
return true;
}
@@ -228,7 +228,7 @@ public final class AbilityFactory_Protection {
}
// is the creature in blocked and the blocker would survive
if (AllZone.getPhase().isAfter(Constant.Phase.Combat_Declare_Blockers)
if (AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS)
&& AllZone.getCombat().isAttacking(c) && AllZone.getCombat().isBlocked(c)
&& CombatUtil.blockerWouldBeDestroyed(AllZone.getCombat().getBlockers(c).get(0))) {
return true;
@@ -279,7 +279,7 @@ public final class AbilityFactory_Protection {
}
// Phase Restrictions
if (AllZone.getStack().size() == 0 && AllZone.getPhase().isBefore(Constant.Phase.Combat_FirstStrikeDamage)) {
if (AllZone.getStack().size() == 0 && AllZone.getPhase().isBefore(Constant.Phase.COMBAT_FIRST_STRIKE_DAMAGE)) {
// Instant-speed protections should not be cast outside of combat
// when the stack is empty
if (!AbilityFactory.isSorcerySpeed(sa)) {
@@ -326,7 +326,7 @@ public final class AbilityFactory_Protection {
* @return a boolean.
*/
private static boolean protectTgtAI(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
if (!mandatory && AllZone.getPhase().isAfter(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
if (!mandatory && AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
return false;
}
@@ -353,11 +353,11 @@ public final class AbilityFactory_Protection {
// If the cost is tapping, don't activate before declare
// attack/block
if (sa.getPayCosts() != null && sa.getPayCosts().getTap()) {
if (AllZone.getPhase().isBefore(Constant.Phase.Combat_Declare_Attackers)
if (AllZone.getPhase().isBefore(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())) {
list.remove(sa.getSourceCard());
}
if (AllZone.getPhase().isBefore(Constant.Phase.Combat_Declare_Blockers)
if (AllZone.getPhase().isBefore(Constant.Phase.COMBAT_DECLARE_BLOCKERS)
&& AllZone.getPhase().isPlayerTurn(AllZone.getHumanPlayer())) {
list.remove(sa.getSourceCard());
}
@@ -783,7 +783,7 @@ public final class AbilityFactory_Protection {
// Replace AnyColor with the 5 colors
if (choices.contains("AnyColor")) {
gains.addAll(Arrays.asList(Constant.Color.onlyColors));
gains.addAll(Arrays.asList(Constant.Color.ONLY_COLORS));
choices = choices.replaceAll("AnyColor,?", "");
}
// Add any remaining choices

View File

@@ -261,20 +261,20 @@ public class AbilityFactory_Pump {
// give haste to creatures that could attack with it
if (c.hasSickness() && kHaste && AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())
&& CombatUtil.canAttackNextTurn(c)
&& AllZone.getPhase().isBefore(Constant.Phase.Combat_Declare_Attackers)) {
&& AllZone.getPhase().isBefore(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
return true;
}
// give evasive keywords to creatures that can attack
if (evasive && AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer()) && CombatUtil.canAttack(c)
&& AllZone.getPhase().isBefore(Constant.Phase.Combat_Declare_Attackers)
&& AllZone.getPhase().isBefore(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
&& c.getNetCombatDamage() > 0) {
return true;
}
// will the creature attack (only relevant for sorcery speed)?
if (CardFactoryUtil.AI_doesCreatureAttack(c)
&& AllZone.getPhase().isBefore(Constant.Phase.Combat_Declare_Attackers)
&& AllZone.getPhase().isBefore(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())) {
return true;
}
@@ -288,13 +288,13 @@ public class AbilityFactory_Pump {
}
// is the creature unblocked and the spell will pump its power?
if (AllZone.getPhase().isAfter(Constant.Phase.Combat_Declare_Blockers)
if (AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS)
&& AllZone.getCombat().isAttacking(c) && AllZone.getCombat().isUnblocked(c) && attack > 0) {
return true;
}
// is the creature blocked and the blocker would survive
if (AllZone.getPhase().isAfter(Constant.Phase.Combat_Declare_Blockers)
if (AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS)
&& AllZone.getCombat().isAttacking(c) && AllZone.getCombat().isBlocked(c)
&& AllZone.getCombat().getBlockers(c) != null
&& !CombatUtil.blockerWouldBeDestroyed(AllZone.getCombat().getBlockers(c).get(0))) {
@@ -304,8 +304,8 @@ public class AbilityFactory_Pump {
// if the life of the computer is in danger, try to pump
// potential blockers before declaring blocks
if (CombatUtil.lifeInDanger(AllZone.getCombat())
&& AllZone.getPhase().isAfter(Constant.Phase.Combat_Declare_Attackers)
&& AllZone.getPhase().isBefore(Constant.Phase.Main2)
&& AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
&& AllZone.getPhase().isBefore(Constant.Phase.MAIN2)
&& CombatUtil.canBlock(c, AllZone.getCombat())
&& AllZone.getPhase().isPlayerTurn(AllZone.getHumanPlayer())) {
return true;
@@ -356,7 +356,7 @@ public class AbilityFactory_Pump {
final boolean addsKeywords = Keywords.size() > 0;
if (addsKeywords) {
if (!containsCombatRelevantKeyword(Keywords) && AllZone.getPhase().isBefore(Constant.Phase.Main2))
if (!containsCombatRelevantKeyword(Keywords) && AllZone.getPhase().isBefore(Constant.Phase.MAIN2))
{
list.clear(); // this keyword is not combat relevenat
}
@@ -524,7 +524,7 @@ public class AbilityFactory_Pump {
* @return a boolean.
*/
private boolean pumpTgtAI(final SpellAbility sa, final int defense, final int attack, final boolean mandatory) {
if (!mandatory && AllZone.getPhase().isAfter(Constant.Phase.Combat_Declare_Blockers_InstantAbility)
if (!mandatory && AllZone.getPhase().isAfter(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
&& !(AF.isCurse() && (defense < 0 || !containsCombatRelevantKeyword(Keywords)))) {
return false;
}
@@ -544,11 +544,11 @@ public class AbilityFactory_Pump {
// If the cost is tapping, don't activate before declare
// attack/block
if (sa.getPayCosts() != null && sa.getPayCosts().getTap()) {
if (AllZone.getPhase().isBefore(Constant.Phase.Combat_Declare_Attackers)
if (AllZone.getPhase().isBefore(Constant.Phase.COMBAT_DECLARE_ATTACKERS)
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer())) {
list.remove(sa.getSourceCard());
}
if (AllZone.getPhase().isBefore(Constant.Phase.Combat_Declare_Blockers)
if (AllZone.getPhase().isBefore(Constant.Phase.COMBAT_DECLARE_BLOCKERS)
&& AllZone.getPhase().isPlayerTurn(AllZone.getHumanPlayer())) {
list.remove(sa.getSourceCard());
}

View File

@@ -253,7 +253,7 @@ public class AbilityFactory_Regenerate {
}
}
} else {
if (AllZone.getPhase().is(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
if (AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
boolean flag = false;
for (Card c : list) {
@@ -297,7 +297,7 @@ public class AbilityFactory_Regenerate {
chance = true;
}
} else {
if (AllZone.getPhase().is(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
if (AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
CardList combatants = targetables.getType("Creature");
CardListUtil.sortByEvaluateCreature(combatants);
@@ -389,7 +389,7 @@ public class AbilityFactory_Regenerate {
if (compTargetables.size() > 0) {
CardList combatants = compTargetables.getType("Creature");
CardListUtil.sortByEvaluateCreature(combatants);
if (AllZone.getPhase().is(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
if (AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
for (Card c : combatants) {
if (c.getShield() == 0 && CombatUtil.combatantWouldBeDestroyed(c)) {
tgt.addTarget(c);
@@ -670,7 +670,7 @@ public class AbilityFactory_Regenerate {
// i control
} else {
if (AllZone.getPhase().is(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
if (AllZone.getPhase().is(Constant.Phase.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
CardList combatants = list.getType("Creature");
for (Card c : combatants) {

View File

@@ -247,7 +247,7 @@ public final class AbilityFactory_Reveal {
}
// Don't use draw abilities before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.Main2) && !params.containsKey("ActivationPhases")
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")
&& !params.containsKey("DestinationZone")) {
return false;
}

View File

@@ -261,7 +261,7 @@ public class AbilityFactory_Token extends AbilityFactory {
}
// Don't generate tokens without haste before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.Main2)
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2)
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer()) && !haste) {
return false;
}

View File

@@ -270,7 +270,7 @@ public class AbilityFactory_ZoneAffecting {
}
// Don't use draw abilities before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.Main2) && !params.containsKey("ActivationPhases")) {
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")) {
return false;
}
@@ -285,7 +285,7 @@ public class AbilityFactory_ZoneAffecting {
{
chance = .667; // 66.7% chance for sorcery speed
}
if ((AllZone.getPhase().is(Constant.Phase.End_Of_Turn) && AllZone.getPhase().isNextTurn(
if ((AllZone.getPhase().is(Constant.Phase.END_OF_TURN) && AllZone.getPhase().isNextTurn(
AllZone.getComputerPlayer())))
{
chance = .9; // 90% for end of opponents turn
@@ -744,7 +744,7 @@ public class AbilityFactory_ZoneAffecting {
Random r = MyRandom.random;
// Don't use draw abilities before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.Main2) && !params.containsKey("ActivationPhases")) {
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")) {
return false;
}
@@ -760,7 +760,7 @@ public class AbilityFactory_ZoneAffecting {
chance = .667; // 66.7% chance for sorcery speed
}
if ((AllZone.getPhase().is(Constant.Phase.End_Of_Turn) && AllZone.getPhase().isNextTurn(
if ((AllZone.getPhase().is(Constant.Phase.END_OF_TURN) && AllZone.getPhase().isNextTurn(
AllZone.getComputerPlayer())))
{
chance = .9; // 90% for end of opponents turn
@@ -1391,7 +1391,7 @@ public class AbilityFactory_ZoneAffecting {
}
// Don't use draw abilities before main 2 if possible
if (AllZone.getPhase().isBefore(Constant.Phase.Main2) && !params.containsKey("ActivationPhases")) {
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2) && !params.containsKey("ActivationPhases")) {
return false;
}
@@ -1407,7 +1407,7 @@ public class AbilityFactory_ZoneAffecting {
chance = .75; // 75% chance for sorcery speed
}
if ((AllZone.getPhase().is(Constant.Phase.End_Of_Turn) && AllZone.getPhase().isNextTurn(
if ((AllZone.getPhase().is(Constant.Phase.END_OF_TURN) && AllZone.getPhase().isNextTurn(
AllZone.getComputerPlayer())))
{
chance = .9; // 90% for end of opponents turn

View File

@@ -1128,7 +1128,7 @@ public class CardFactoryUtil {
@Override
public boolean canPlayAI() {
if (AllZone.getPhase().isBefore(Constant.Phase.Main2)) {
if (AllZone.getPhase().isBefore(Constant.Phase.MAIN2)) {
return false;
}
@@ -1454,7 +1454,7 @@ public class CardFactoryUtil {
public boolean addCard(final Card c) {
return c.isCreature()
&& (CombatUtil.canAttack(c) || (CombatUtil.canAttackNextTurn(c) && AllZone.getPhase()
.is(Constant.Phase.Main2))) && CardFactoryUtil.canTarget(sourceCard, c)
.is(Constant.Phase.MAIN2))) && CardFactoryUtil.canTarget(sourceCard, c)
&& (((c.getNetDefense() + tough) > 0) || sourceCard.getName().equals("Skullclamp"));
}
});
@@ -3213,7 +3213,7 @@ public class CardFactoryUtil {
// Count$IfMainPhase.<numMain>.<numNotMain> // 7/10
if (sq[0].contains("IfMainPhase")) {
final String cPhase = AllZone.getPhase().getPhase();
if ((cPhase.equals(Constant.Phase.MAIN1) || cPhase.equals(Constant.Phase.Main2))
if ((cPhase.equals(Constant.Phase.MAIN1) || cPhase.equals(Constant.Phase.MAIN2))
&& AllZone.getPhase().getPlayerTurn().equals(cardController)) {
return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
} else {

View File

@@ -812,7 +812,7 @@ public class CardFactory_Creatures {
public void execute() {
if (card.getController().isHuman()) {
String[] colors = Constant.Color.onlyColors;
String[] colors = Constant.Color.ONLY_COLORS;
Object o = GuiUtils.getChoice("Choose color", colors);
color[0] = (String) o;
@@ -824,11 +824,11 @@ public class CardFactory_Creatures {
list.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Hand));
list.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield));
color[0] = Constant.Color.White;
color[0] = Constant.Color.WHITE;
int max = list.getKeywordsContain(color[0]).size();
String[] colors = { Constant.Color.Blue, Constant.Color.Black, Constant.Color.Red,
Constant.Color.Green };
String[] colors = { Constant.Color.BLUE, Constant.Color.BLACK, Constant.Color.RED,
Constant.Color.GREEN };
for (String c : colors) {
int cmp = list.getKeywordsContain(c).size();
if (cmp > max) {

View File

@@ -137,7 +137,7 @@ class CardFactory_Lands {
@Override
public boolean canPlayAI() {
String phase = AllZone.getPhase().getPhase();
return phase.equals(Constant.Phase.Main2) && super.canPlayAI();
return phase.equals(Constant.Phase.MAIN2) && super.canPlayAI();
}
@Override

View File

@@ -686,7 +686,7 @@ public class CardFactory_Planeswalkers {
@Override
public boolean canPlayAI() {
return (card.getCounters(Counters.LOYALTY) <= 6)
&& AllZone.getPhase().getPhase().equals(Constant.Phase.Main2);
&& AllZone.getPhase().getPhase().equals(Constant.Phase.MAIN2);
}
@Override

View File

@@ -47,7 +47,7 @@ public class Mana {
* @return a {@link java.lang.String} object.
*/
public final String toString() {
if (color.equals(Constant.Color.Colorless)) {
if (color.equals(Constant.Color.COLORLESS)) {
return Integer.toString(amount);
}
@@ -71,7 +71,7 @@ public class Mana {
*/
public final String toDescriptiveString() {
// this will be used for advanced choice box
if (color.equals(Constant.Color.Colorless)) {
if (color.equals(Constant.Color.COLORLESS)) {
return Integer.toString(amount);
}
@@ -139,7 +139,7 @@ public class Mana {
* @return a int.
*/
public final int getColorlessAmount() {
return color.equals(Constant.Color.Colorless) ? amount : 0;
return color.equals(Constant.Color.COLORLESS) ? amount : 0;
}
/**

View File

@@ -384,7 +384,7 @@ public class ManaCost {
}
choice.reduce(mana);
if (!mana.equals(Constant.Color.Colorless)) {
if (!mana.equals(Constant.Color.COLORLESS)) {
if (sunburstMap.containsKey(mana)) {
sunburstMap.put(mana, sunburstMap.get(mana) + 1);
} else {
@@ -428,7 +428,7 @@ public class ManaCost {
}
choice.reduce(mana);
if (!mana.isColor(Constant.Color.Colorless)) {
if (!mana.isColor(Constant.Color.COLORLESS)) {
if (sunburstMap.containsKey(mana.getColor())) {
sunburstMap.put(mana.getColor(), sunburstMap.get(mana.getColor()) + 1);
} else {

View File

@@ -56,13 +56,13 @@ public class ManaPool extends Card {
addIntrinsicKeyword("Indestructible");
setImmutable(true);
clearPool();
map.put(Constant.Color.White, 0);
map.put(Constant.Color.Blue, 1);
map.put(Constant.Color.Black, 2);
map.put(Constant.Color.Red, 3);
map.put(Constant.Color.Green, 4);
map.put(Constant.Color.Colorless, 5);
map.put(Constant.Color.Snow, 6);
map.put(Constant.Color.WHITE, 0);
map.put(Constant.Color.BLUE, 1);
map.put(Constant.Color.BLACK, 2);
map.put(Constant.Color.RED, 3);
map.put(Constant.Color.GREEN, 4);
map.put(Constant.Color.COLORLESS, 5);
map.put(Constant.Color.SNOW, 6);
}
/**
@@ -77,8 +77,8 @@ public class ManaPool extends Card {
int[] normalMana = { 0, 0, 0, 0, 0, 0 };
int[] snowMana = { 0, 0, 0, 0, 0, 0 };
String[] manaStrings = { Constant.Color.White, Constant.Color.Blue, Constant.Color.Black, Constant.Color.Red,
Constant.Color.Green, Constant.Color.Colorless };
String[] manaStrings = { Constant.Color.WHITE, Constant.Color.BLUE, Constant.Color.BLACK, Constant.Color.RED,
Constant.Color.GREEN, Constant.Color.COLORLESS };
for (Mana m : pool) {
if (m.isSnow()) {
@@ -130,8 +130,8 @@ public class ManaPool extends Card {
int[] normalMana = { 0, 0, 0, 0, 0, 0 };
int[] snowMana = { 0, 0, 0, 0, 0, 0 };
String[] manaStrings = { Constant.Color.White, Constant.Color.Blue, Constant.Color.Black, Constant.Color.Red,
Constant.Color.Green, Constant.Color.Colorless };
String[] manaStrings = { Constant.Color.WHITE, Constant.Color.BLUE, Constant.Color.BLACK, Constant.Color.RED,
Constant.Color.GREEN, Constant.Color.COLORLESS };
for (Mana m : pool) {
if (m.isSnow()) {
@@ -255,7 +255,7 @@ public class ManaPool extends Card {
if (pool.equals(floatingMana)) {
floatingTotals[map.get(mana.getColor())] += mana.getAmount();
if (mana.isSnow()) {
floatingTotals[map.get(Constant.Color.Snow)] += mana.getAmount();
floatingTotals[map.get(Constant.Color.SNOW)] += mana.getAmount();
}
}
}
@@ -300,7 +300,7 @@ public class ManaPool extends Card {
for (String c : manaArr) {
String longStr = Input_PayManaCostUtil.getLongColorString(c);
if (longStr.equals(Constant.Color.Colorless)) {
if (longStr.equals(Constant.Color.COLORLESS)) {
genericTotal += Integer.parseInt(c);
} else if (color.equals("")) {
color = longStr;
@@ -319,7 +319,7 @@ public class ManaPool extends Card {
manaList.add(new Mana(color, total, card));
}
if (genericTotal > 0) {
manaList.add(new Mana(Constant.Color.Colorless, genericTotal, card));
manaList.add(new Mana(Constant.Color.COLORLESS, genericTotal, card));
}
return manaList;
@@ -339,7 +339,7 @@ public class ManaPool extends Card {
// Omnath in play, clear all non-green mana
int i = 0;
while (i < floatingMana.size()) {
if (floatingMana.get(i).isColor(Constant.Color.Green)) {
if (floatingMana.get(i).isColor(Constant.Color.GREEN)) {
i++;
continue;
}
@@ -366,7 +366,7 @@ public class ManaPool extends Card {
boolean wantSnow = false;
for (int i = 0; i < colors.length; i++) {
colors[i] = Input_PayManaCostUtil.getLongColorString(colors[i]);
if (colors[i].equals(Constant.Color.Snow)) {
if (colors[i].equals(Constant.Color.SNOW)) {
wantSnow = true;
}
}
@@ -384,10 +384,10 @@ public class ManaPool extends Card {
} else if (wantSnow && mana.isSnow()) {
if (choice == null) {
choice = mana;
} else if (choice.isColor(Constant.Color.Colorless)) {
} else if (choice.isColor(Constant.Color.COLORLESS)) {
// do nothing Snow Colorless should be used first to pay for
// Snow mana
} else if (mana.isColor(Constant.Color.Colorless)) {
} else if (mana.isColor(Constant.Color.COLORLESS)) {
// give preference to Colorless Snow mana over Colored snow
// mana
choice = mana;
@@ -396,8 +396,8 @@ public class ManaPool extends Card {
// pay Snow costs
choice = mana;
}
} else if (colors[0].equals(Constant.Color.Colorless)) { // colorless
if (choice == null && mana.isColor(Constant.Color.Colorless)) {
} else if (colors[0].equals(Constant.Color.COLORLESS)) { // colorless
if (choice == null && mana.isColor(Constant.Color.COLORLESS)) {
choice = mana; // Colorless fits the bill nicely
} else if (choice == null) {
manaChoices.add(mana);
@@ -412,14 +412,14 @@ public class ManaPool extends Card {
return choice;
}
if (colors[0].equals(Constant.Color.Colorless)) {
if (colors[0].equals(Constant.Color.COLORLESS)) {
if (manaChoices.size() == 1) {
choice = manaChoices.get(0);
} else if (manaChoices.size() > 1) {
int[] normalMana = { 0, 0, 0, 0, 0, 0 };
int[] snowMana = { 0, 0, 0, 0, 0, 0 };
String[] manaStrings = { Constant.Color.White, Constant.Color.Blue, Constant.Color.Black,
Constant.Color.Red, Constant.Color.Green, Constant.Color.Colorless };
String[] manaStrings = { Constant.Color.WHITE, Constant.Color.BLUE, Constant.Color.BLACK,
Constant.Color.RED, Constant.Color.GREEN, Constant.Color.COLORLESS };
// loop through manaChoices adding
for (Mana m : manaChoices) {
@@ -575,7 +575,7 @@ public class ManaPool extends Card {
if (pool.equals(floatingMana)) {
floatingTotals[map.get(choice.getColor())] -= choice.getAmount();
if (choice.isSnow()) {
floatingTotals[map.get(Constant.Color.Snow)] -= choice.getAmount();
floatingTotals[map.get(Constant.Color.SNOW)] -= choice.getAmount();
}
}
}

View File

@@ -121,7 +121,7 @@ public class Generate2ColorDeck {
// reduce to cards that match the colors
CardList CL1 = AllCards.getColor(color1);
CL1.addAll(AllCards.getColor(Constant.Color.Colorless));
CL1.addAll(AllCards.getColor(Constant.Color.COLORLESS));
CardList CL2 = AllCards.getColor(color2);
// remove multicolor cards that don't match the colors

View File

@@ -132,7 +132,7 @@ public class Generate3ColorDeck {
// reduce to cards that match the colors
CardList CL1 = AllCards.getColor(color1);
CL1.addAll(AllCards.getColor(Constant.Color.Colorless));
CL1.addAll(AllCards.getColor(Constant.Color.COLORLESS));
CardList CL2 = AllCards.getColor(color2);
CardList CL3 = AllCards.getColor(color3);

View File

@@ -131,7 +131,7 @@ public class Generate5ColorDeck {
// reduce to cards that match the colors
CardList cL1 = allCards.getColor(color1);
cL1.addAll(allCards.getColor(Constant.Color.Colorless));
cL1.addAll(allCards.getColor(Constant.Color.COLORLESS));
CardList cL2 = allCards.getColor(color2);
CardList cL3 = allCards.getColor(color3);
CardList cL4 = allCards.getColor(color4);

View File

@@ -43,11 +43,11 @@ public class GenerateConstructedDeck {
* </p>
*/
private void setupMap() {
map.put(Constant.Color.Black, "Swamp");
map.put(Constant.Color.Blue, "Island");
map.put(Constant.Color.Green, "Forest");
map.put(Constant.Color.Red, "Mountain");
map.put(Constant.Color.White, "Plains");
map.put(Constant.Color.BLACK, "Swamp");
map.put(Constant.Color.BLUE, "Island");
map.put(Constant.Color.GREEN, "Forest");
map.put(Constant.Color.RED, "Mountain");
map.put(Constant.Color.WHITE, "Plains");
}
/**
@@ -147,12 +147,12 @@ public class GenerateConstructedDeck {
int b;
do {
a = CardUtil.getRandomIndex(Constant.Color.onlyColors);
b = CardUtil.getRandomIndex(Constant.Color.onlyColors);
a = CardUtil.getRandomIndex(Constant.Color.ONLY_COLORS);
b = CardUtil.getRandomIndex(Constant.Color.ONLY_COLORS);
} while (a == b); // do not want to get the same color twice
color1 = Constant.Color.onlyColors[a];
color2 = Constant.Color.onlyColors[b];
color1 = Constant.Color.ONLY_COLORS[a];
color2 = Constant.Color.ONLY_COLORS[b];
CardList out = new CardList();
out.addAll(CardListUtil.getColor(in, color1));
@@ -163,7 +163,7 @@ public class GenerateConstructedDeck {
public boolean addCard(final Card c) {
// is this really a colorless artifact and not something
// weird like Sarcomite Myr which is a colored artifact
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.Colorless)
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS)
&& !Singletons.getModel().getPreferences().deckGenRmvArtifacts;
}
});

View File

@@ -48,11 +48,11 @@ public class GenerateConstructedMultiColorDeck {
* </p>
*/
private void setupBasicLandMap() {
map.put(Constant.Color.Black, "Swamp");
map.put(Constant.Color.Blue, "Island");
map.put(Constant.Color.Green, "Forest");
map.put(Constant.Color.Red, "Mountain");
map.put(Constant.Color.White, "Plains");
map.put(Constant.Color.BLACK, "Swamp");
map.put(Constant.Color.BLUE, "Island");
map.put(Constant.Color.GREEN, "Forest");
map.put(Constant.Color.RED, "Mountain");
map.put(Constant.Color.WHITE, "Plains");
}
/**
@@ -61,26 +61,26 @@ public class GenerateConstructedMultiColorDeck {
* </p>
*/
private void setupMultiMap() {
multiMap.put(Constant.Color.Black + Constant.Color.Blue, new String[] { "Underground Sea", "Watery Grave" });
multiMap.put(Constant.Color.Black + Constant.Color.Green, new String[] { "Bayou", "Overgrown Tomb" });
multiMap.put(Constant.Color.Black + Constant.Color.Red, new String[] { "Badlands", "Blood Crypt" });
multiMap.put(Constant.Color.Black + Constant.Color.White, new String[] { "Scrubland", "Godless Shrine" });
multiMap.put(Constant.Color.Blue + Constant.Color.Black, new String[] { "Underground Sea", "Watery Grave" });
multiMap.put(Constant.Color.Blue + Constant.Color.Green, new String[] { "Tropical Island", "Breeding Pool" });
multiMap.put(Constant.Color.Blue + Constant.Color.Red, new String[] { "Volcanic Island", "Steam Vents" });
multiMap.put(Constant.Color.Blue + Constant.Color.White, new String[] { "Tundra", "Hallowed Fountain" });
multiMap.put(Constant.Color.Green + Constant.Color.Black, new String[] { "Bayou", "Overgrown Tomb" });
multiMap.put(Constant.Color.Green + Constant.Color.Blue, new String[] { "Tropical Island", "Breeding Pool" });
multiMap.put(Constant.Color.Green + Constant.Color.Red, new String[] { "Taiga", "Stomping Ground" });
multiMap.put(Constant.Color.Green + Constant.Color.White, new String[] { "Savannah", "Temple Garden" });
multiMap.put(Constant.Color.Red + Constant.Color.Black, new String[] { "Badlands", "Blood Crypt" });
multiMap.put(Constant.Color.Red + Constant.Color.Blue, new String[] { "Volcanic Island", "Steam Vents" });
multiMap.put(Constant.Color.Red + Constant.Color.Green, new String[] { "Taiga", "Stomping Ground" });
multiMap.put(Constant.Color.Red + Constant.Color.White, new String[] { "Plateau", "Sacred Foundry" });
multiMap.put(Constant.Color.White + Constant.Color.Black, new String[] { "Scrubland", "Godless Shrine" });
multiMap.put(Constant.Color.White + Constant.Color.Blue, new String[] { "Tundra", "Hallowed Fountain" });
multiMap.put(Constant.Color.White + Constant.Color.Green, new String[] { "Savannah", "Temple Garden" });
multiMap.put(Constant.Color.White + Constant.Color.Red, new String[] { "Plateau", "Sacred Foundry" });
multiMap.put(Constant.Color.BLACK + Constant.Color.BLUE, new String[] { "Underground Sea", "Watery Grave" });
multiMap.put(Constant.Color.BLACK + Constant.Color.GREEN, new String[] { "Bayou", "Overgrown Tomb" });
multiMap.put(Constant.Color.BLACK + Constant.Color.RED, new String[] { "Badlands", "Blood Crypt" });
multiMap.put(Constant.Color.BLACK + Constant.Color.WHITE, new String[] { "Scrubland", "Godless Shrine" });
multiMap.put(Constant.Color.BLUE + Constant.Color.BLACK, new String[] { "Underground Sea", "Watery Grave" });
multiMap.put(Constant.Color.BLUE + Constant.Color.GREEN, new String[] { "Tropical Island", "Breeding Pool" });
multiMap.put(Constant.Color.BLUE + Constant.Color.RED, new String[] { "Volcanic Island", "Steam Vents" });
multiMap.put(Constant.Color.BLUE + Constant.Color.WHITE, new String[] { "Tundra", "Hallowed Fountain" });
multiMap.put(Constant.Color.GREEN + Constant.Color.BLACK, new String[] { "Bayou", "Overgrown Tomb" });
multiMap.put(Constant.Color.GREEN + Constant.Color.BLUE, new String[] { "Tropical Island", "Breeding Pool" });
multiMap.put(Constant.Color.GREEN + Constant.Color.RED, new String[] { "Taiga", "Stomping Ground" });
multiMap.put(Constant.Color.GREEN + Constant.Color.WHITE, new String[] { "Savannah", "Temple Garden" });
multiMap.put(Constant.Color.RED + Constant.Color.BLACK, new String[] { "Badlands", "Blood Crypt" });
multiMap.put(Constant.Color.RED + Constant.Color.BLUE, new String[] { "Volcanic Island", "Steam Vents" });
multiMap.put(Constant.Color.RED + Constant.Color.GREEN, new String[] { "Taiga", "Stomping Ground" });
multiMap.put(Constant.Color.RED + Constant.Color.WHITE, new String[] { "Plateau", "Sacred Foundry" });
multiMap.put(Constant.Color.WHITE + Constant.Color.BLACK, new String[] { "Scrubland", "Godless Shrine" });
multiMap.put(Constant.Color.WHITE + Constant.Color.BLUE, new String[] { "Tundra", "Hallowed Fountain" });
multiMap.put(Constant.Color.WHITE + Constant.Color.GREEN, new String[] { "Savannah", "Temple Garden" });
multiMap.put(Constant.Color.WHITE + Constant.Color.RED, new String[] { "Plateau", "Sacred Foundry" });
}
/**
@@ -312,16 +312,16 @@ public class GenerateConstructedMultiColorDeck {
int b;
int c;
a = CardUtil.getRandomIndex(Constant.Color.onlyColors);
a = CardUtil.getRandomIndex(Constant.Color.ONLY_COLORS);
do {
b = CardUtil.getRandomIndex(Constant.Color.onlyColors);
c = CardUtil.getRandomIndex(Constant.Color.onlyColors);
b = CardUtil.getRandomIndex(Constant.Color.ONLY_COLORS);
c = CardUtil.getRandomIndex(Constant.Color.ONLY_COLORS);
} while (a == b || a == c || b == c); // do not want to get the same
// color thrice
color1 = Constant.Color.onlyColors[a];
color2 = Constant.Color.onlyColors[b];
color3 = Constant.Color.onlyColors[c];
color1 = Constant.Color.ONLY_COLORS[a];
color2 = Constant.Color.ONLY_COLORS[b];
color3 = Constant.Color.ONLY_COLORS[c];
CardList out = new CardList();
out.addAll(CardListUtil.getColor(in, color1));
@@ -333,7 +333,7 @@ public class GenerateConstructedMultiColorDeck {
public boolean addCard(final Card c) {
// is this really a colorless artifact and not something
// wierd like Sarcomite Myr which is a colored artifact
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.Colorless)
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS)
&& !Singletons.getModel().getPreferences().deckGenRmvArtifacts;
}
});
@@ -364,11 +364,11 @@ public class GenerateConstructedMultiColorDeck {
*/
private CardList get5Colors(final CardList in) {
color1 = Constant.Color.Black;
color2 = Constant.Color.Blue;
color3 = Constant.Color.Green;
color4 = Constant.Color.Red;
color5 = Constant.Color.White;
color1 = Constant.Color.BLACK;
color2 = Constant.Color.BLUE;
color3 = Constant.Color.GREEN;
color4 = Constant.Color.RED;
color5 = Constant.Color.WHITE;
CardList out = new CardList();
/*
@@ -385,7 +385,7 @@ public class GenerateConstructedMultiColorDeck {
public boolean addCard(final Card c) {
// is this really a colorless artifact and not something
// wierd like Sarcomite Myr which is a colored artifact
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.Colorless)
return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS)
&& !Singletons.getModel().getPreferences().deckGenRmvArtifacts;
}
});

View File

@@ -53,7 +53,7 @@ public class BoosterDraftAI {
//in_choose should ONLY be on the RIGHT side of any equal sign
//only 1 card should be removed from in_choose
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Player[" + player + "] pack: " + chooseFrom.toString());
CardList wouldPick = new CardList();
@@ -78,7 +78,7 @@ public class BoosterDraftAI {
if (creatures.size() > 0) {
pickedCard = creatures.get(creatures.size() - 1);
playerColors.get(player).Color1 = pickedCard.getColor().get(0).toStringArray().get(0);
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Player[" + player + "] Color1: " + playerColors.get(player).Color1);
playerColors.get(player).Mana1 = playerColors.get(player).ColorToMana(playerColors.get(player).Color1);
@@ -86,7 +86,7 @@ public class BoosterDraftAI {
//if the first pick has more than one color add the second as second color to draft
if (pickedCard.getColor().get(0).toStringArray().size() > 1) {
playerColors.get(player).Color2 = pickedCard.getColor().get(0).toStringArray().get(1);
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Player[" + player + "] Color2: " + playerColors.get(player).Color2);
playerColors.get(player).Mana2 = playerColors.get(player).ColorToMana(playerColors.get(player).Color2);
@@ -103,7 +103,7 @@ public class BoosterDraftAI {
if (creatures.size() > 0) {
pickedCard = creatures.get(creatures.size() - 1);
playerColors.get(player).Color2 = pickedCard.getColor().get(0).toStringArray().get(0);
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Player[" + player + "] Color2: " + playerColors.get(player).Color2);
playerColors.get(player).Mana2 = playerColors.get(player).ColorToMana(playerColors.get(player).Color2);
@@ -211,7 +211,7 @@ public class BoosterDraftAI {
chooseFrom.remove(pickedCard);
deck[player].add(pickedCard);
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Player[" + player + "] picked " + pickedCard.getName() + " (" + pickedCard.getManaCost() + ") " + pickedCard.getType().toString() + "\n");
}
@@ -280,7 +280,7 @@ public class BoosterDraftAI {
for (int i = 0; i < deck.length; i++) {
//addLand(deck[i], deckColor[i]);
//out[i] = getDeck(deck[i]);
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Deck[" + i + "]");
out[i] = buildDeck(deck[i], playerColors.get(i));
@@ -325,7 +325,7 @@ public class BoosterDraftAI {
nCreatures--;
AIPlayables.remove(c);
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Creature[" + i + "]:" + c.getName() + " (" + c.getManaCost() + ")");
i++;
@@ -341,7 +341,7 @@ public class BoosterDraftAI {
otherCreatures = AIPlayables.getType("Creature");
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("AddCreature: " + c.getName() + " (" + c.getManaCost() + ")");
}
@@ -358,7 +358,7 @@ public class BoosterDraftAI {
others = AIPlayables.getNotType("Creature").getNotType("Land").getOnly2Colors(pClrs.Color1, pClrs.Color2);
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Others[" + ii++ + "]:" + c.getName() + " (" + c.getManaCost() + ")");
}
@@ -377,7 +377,7 @@ public class BoosterDraftAI {
z = AIPlayables.getNotType("Land");
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("NonLands[" + ii++ + "]:" + c.getName() + "(" + c.getManaCost() + ")");
}
@@ -391,7 +391,7 @@ public class BoosterDraftAI {
lands = AIPlayables.getType("Land");
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Land:" + c.getName());
}
@@ -439,7 +439,7 @@ public class BoosterDraftAI {
float p = (float) ClrCnts[i].Count / (float) totalColor;
int nLand = (int) ((float) landsNeeded * p) + 1;
//tmpDeck += "nLand-" + ClrCnts[i].Color + ":" + nLand + "\n";
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Basics[" + ClrCnts[i].Color + "]:" + nLand);
// just to prevent a null exception by the deck size fixing code
@@ -461,7 +461,7 @@ public class BoosterDraftAI {
outList.add(c);
landsNeeded--;
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("AddBasics: " + c.getName());
}
if (++n > 4)
@@ -565,11 +565,11 @@ public class BoosterDraftAI {
}
//initilize color map
colorToLand.put(Constant.Color.Black, "Swamp");
colorToLand.put(Constant.Color.Blue, "Island");
colorToLand.put(Constant.Color.Green, "Forest");
colorToLand.put(Constant.Color.Red, "Mountain");
colorToLand.put(Constant.Color.White, "Plains");
colorToLand.put(Constant.Color.BLACK, "Swamp");
colorToLand.put(Constant.Color.BLUE, "Island");
colorToLand.put(Constant.Color.GREEN, "Forest");
colorToLand.put(Constant.Color.RED, "Mountain");
colorToLand.put(Constant.Color.WHITE, "Plains");
//initilize deck array and playerColors list
for (int i = 0; i < deck.length; i++) {
@@ -584,15 +584,15 @@ public class BoosterDraftAI {
//all 10 two color combinations
private String[][] deckColorChoices = {
{Constant.Color.Black, Constant.Color.Blue}, {Constant.Color.Black, Constant.Color.Green},
{Constant.Color.Black, Constant.Color.Red}, {Constant.Color.Black, Constant.Color.White},
{Constant.Color.BLACK, Constant.Color.BLUE}, {Constant.Color.BLACK, Constant.Color.GREEN},
{Constant.Color.BLACK, Constant.Color.RED}, {Constant.Color.BLACK, Constant.Color.WHITE},
{Constant.Color.Blue, Constant.Color.Green}, {Constant.Color.Blue, Constant.Color.Red},
{Constant.Color.Blue, Constant.Color.White},
{Constant.Color.BLUE, Constant.Color.GREEN}, {Constant.Color.BLUE, Constant.Color.RED},
{Constant.Color.BLUE, Constant.Color.WHITE},
{Constant.Color.Green, Constant.Color.Red}, {Constant.Color.Green, Constant.Color.White},
{Constant.Color.GREEN, Constant.Color.RED}, {Constant.Color.GREEN, Constant.Color.WHITE},
{Constant.Color.Red, Constant.Color.White}
{Constant.Color.RED, Constant.Color.WHITE}
};
private Comparator<Card> bestCreature = new Comparator<Card>() {

View File

@@ -280,7 +280,7 @@ public final class BoosterDraft_1 implements BoosterDraft {
throw new RuntimeException("BoosterDraft : setChoice() error - card not found - " + c + " - booster pack = " + thisBooster);
}
if (Constant.Runtime.UpldDrft[0]) {
if (Constant.Runtime.UPLOAD_DRAFT[0]) {
for (int i = 0; i < thisBooster.size(); i++) {
CardPrinted cc = thisBooster.get(i);
String cnBk = cc.getName() + "|" + cc.getSet();
@@ -306,9 +306,9 @@ public final class BoosterDraft_1 implements BoosterDraft {
currentBoosterPick++;
} //setChoice()
/** This will upload drafting picks to cardforge HQ */
/** This will upload drafting picks to cardforge HQ. */
public void finishedDrafting() {
if (Constant.Runtime.UpldDrft[0]) {
if (Constant.Runtime.UPLOAD_DRAFT[0]) {
if (draftPicks.size() > 1) {
ArrayList<String> outDraftData = new ArrayList<String>();
@@ -321,7 +321,8 @@ public final class BoosterDraft_1 implements BoosterDraft {
FileUtil.writeFile("res/draft/tmpDraftData.txt", outDraftData);
HttpUtil poster = new HttpUtil();
poster.upload("http://cardforge.org/draftAI/submitDraftData.php?fmt=" + draftFormat, "res/draft/tmpDraftData.txt");
poster.upload("http://cardforge.org/draftAI/submitDraftData.php?fmt="
+ draftFormat, "res/draft/tmpDraftData.txt");
}
}
}

View File

@@ -46,8 +46,8 @@ class DeckColors {
public String ColorToMana(String color) {
String Mana[] = {"W", "U", "B", "R", "G"};
for (int i = 0; i < Constant.Color.onlyColors.length; i++) {
if (Constant.Color.onlyColors[i].equals(color))
for (int i = 0; i < Constant.Color.ONLY_COLORS.length; i++) {
if (Constant.Color.ONLY_COLORS[i].equals(color))
return Mana[i];
}

View File

@@ -191,7 +191,7 @@ public class SealedDeck {
colorChooserList.add(creatures.get(i));
int colorCounts[] = {0, 0, 0, 0, 0};
String colors[] = Constant.Color.onlyColors;
String colors[] = Constant.Color.ONLY_COLORS;
for (int i = 0; i < colors.length; i++)
colorCounts[i] = colorChooserList.getColor(colors[i]).size();
@@ -345,7 +345,7 @@ public class SealedDeck {
float p = (float) ClrCnts[i].Count / (float) totalColor;
int nLand = (int) ((float) landsNeeded * p) + 1;
//tmpDeck += "nLand-" + ClrCnts[i].Color + ":" + nLand + "\n";
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("Basics[" + ClrCnts[i].Color + "]:" + nLand);
for (int j = 0; j <= nLand; j++) {
@@ -364,7 +364,7 @@ public class SealedDeck {
deck.add(c);
landsNeeded--;
if (Constant.Runtime.DevMode[0])
if (Constant.Runtime.DEV_MODE[0])
System.out.println("AddBasics: " + c.getName());
}
if (++n > 4)
@@ -406,7 +406,7 @@ public class SealedDeck {
String Mana[] = {"W", "U", "B", "R", "G"};
String Clrs[] = {"white", "blue", "black", "red", "green"};
for (int i = 0; i < Constant.Color.onlyColors.length; i++) {
for (int i = 0; i < Constant.Color.ONLY_COLORS.length; i++) {
if (Clrs[i].equals(color))
return Mana[i];
}

View File

@@ -514,7 +514,7 @@ public class DeckEditorQuestMenu extends JMenuBar {
deckMenu.add(save);
deckMenu.add(copy);
if (Constant.Runtime.DevMode[0]) {
if (Constant.Runtime.DEV_MODE[0]) {
deckMenu.addSeparator();
deckMenu.add(addCard);
}

View File

@@ -176,7 +176,7 @@ public final class TableWithCards {
StringBuffer show = new StringBuffer();
show.append("Total - ").append(total).append(", Creatures - ").append(creature).append(", Land - ")
.append(land);
String[] color = Constant.Color.onlyColors;
String[] color = Constant.Color.ONLY_COLORS;
List<Predicate<CardRules>> predicates = CardRules.Predicates.Presets.colors;
for (int i = 0; i < color.length; ++i) {
show.append(String.format(", %s - %d", color[i], predicates.get(i).count(deck, deck.fnToCard)));

View File

@@ -192,13 +192,13 @@ public class InputControl extends MyObservable implements java.io.Serializable {
}
// Special Inputs needed for the following phases:
if (phase.equals(Constant.Phase.Combat_Declare_Attackers)) {
if (phase.equals(Constant.Phase.COMBAT_DECLARE_ATTACKERS)) {
model.getGameState().getStack().freezeStack();
if (playerTurn.isHuman()) {
return new Input_Attack();
}
} else if (phase.equals(Constant.Phase.Combat_Declare_Blockers)) {
} else if (phase.equals(Constant.Phase.COMBAT_DECLARE_BLOCKERS)) {
model.getGameState().getStack().freezeStack();
if (playerTurn.isHuman()) {
aiInput.getComputer().declareBlockers();
@@ -212,7 +212,7 @@ public class InputControl extends MyObservable implements java.io.Serializable {
return new Input_Block();
}
}
} else if (phase.equals(Constant.Phase.Cleanup)) {
} else if (phase.equals(Constant.Phase.CLEANUP)) {
// discard
if (model.getGameState().getStack().size() == 0) {
// resolve things

View File

@@ -56,7 +56,7 @@ public class Input_PayManaCostUtil {
boolean choice = true;
boolean skipExpress = false;
for (String color : Constant.Color.ManaColors) {
for (String color : Constant.Color.MANA_COLORS) {
if (manaCost.isNeeded(color)) {
cneeded.append(getShortColorString(color));
}
@@ -208,17 +208,17 @@ public class Input_PayManaCostUtil {
*/
public static String getLongColorString(final String color) {
Map<String, String> m = new HashMap<String, String>();
m.put("G", Constant.Color.Green);
m.put("R", Constant.Color.Red);
m.put("U", Constant.Color.Blue);
m.put("B", Constant.Color.Black);
m.put("W", Constant.Color.White);
m.put("S", Constant.Color.Snow);
m.put("G", Constant.Color.GREEN);
m.put("R", Constant.Color.RED);
m.put("U", Constant.Color.BLUE);
m.put("B", Constant.Color.BLACK);
m.put("W", Constant.Color.WHITE);
m.put("S", Constant.Color.SNOW);
Object o = m.get(color);
if (o == null) {
o = Constant.Color.Colorless;
o = Constant.Color.COLORLESS;
}
return o.toString();
@@ -235,13 +235,13 @@ public class Input_PayManaCostUtil {
*/
public static String getShortColorString(final String color) {
Map<String, String> m = new HashMap<String, String>();
m.put(Constant.Color.Green, "G");
m.put(Constant.Color.Red, "R");
m.put(Constant.Color.Blue, "U");
m.put(Constant.Color.Black, "B");
m.put(Constant.Color.White, "W");
m.put(Constant.Color.Colorless, "1");
m.put(Constant.Color.Snow, "S");
m.put(Constant.Color.GREEN, "G");
m.put(Constant.Color.RED, "R");
m.put(Constant.Color.BLUE, "U");
m.put(Constant.Color.BLACK, "B");
m.put(Constant.Color.WHITE, "W");
m.put(Constant.Color.COLORLESS, "1");
m.put(Constant.Color.SNOW, "S");
Object o = m.get(color);

View File

@@ -74,15 +74,15 @@ public class FModel {
}
Constant.Runtime.MILL[0] = preferences.millingLossCondition;
Constant.Runtime.DevMode[0] = preferences.developerMode;
Constant.Runtime.UpldDrft[0] = preferences.uploadDraftAI;
Constant.Runtime.RndCFoil[0] = preferences.randCFoil;
Constant.Runtime.DEV_MODE[0] = preferences.developerMode;
Constant.Runtime.UPLOAD_DRAFT[0] = preferences.uploadDraftAI;
Constant.Runtime.RANDOM_FOIL[0] = preferences.randCFoil;
final HttpUtil pinger = new HttpUtil();
if (pinger.getURL("http://cardforge.org/draftAI/ping.php").equals("pong")) {
Constant.Runtime.NetConn[0] = true;
Constant.Runtime.NET_CONN[0] = true;
} else {
Constant.Runtime.UpldDrft[0] = false;
Constant.Runtime.UPLOAD_DRAFT[0] = false;
}
setBuildInfo(new BuildInfo());

View File

@@ -169,19 +169,19 @@ public class QuestUtil {
// Determine color ("random" defaults to null color)
String col = null;
if (temp[1].equalsIgnoreCase("black")) {
col = Constant.Color.Black;
col = Constant.Color.BLACK;
} else if (temp[1].equalsIgnoreCase("blue")) {
col = Constant.Color.Blue;
col = Constant.Color.BLUE;
} else if (temp[1].equalsIgnoreCase("colorless")) {
col = Constant.Color.Colorless;
col = Constant.Color.COLORLESS;
} else if (temp[1].equalsIgnoreCase("green")) {
col = Constant.Color.Green;
col = Constant.Color.GREEN;
} else if (temp[1].equalsIgnoreCase("multicolor")) {
col = "Multicolor"; // Note: No constant color for this??
} else if (temp[1].equalsIgnoreCase("red")) {
col = Constant.Color.Red;
col = Constant.Color.RED;
} else if (temp[1].equalsIgnoreCase("white")) {
col = Constant.Color.White;
col = Constant.Color.WHITE;
}
return BoosterUtils.generateCards(qty, rar, col);

View File

@@ -70,7 +70,7 @@ public class QuestPetPlant extends QuestPetAbstract {
@Override
public boolean canPlayAI() {
return AllZone.getPhase().getPhase().equals(Constant.Phase.Main2);
return AllZone.getPhase().getPhase().equals(Constant.Phase.MAIN2);
}
@Override

View File

@@ -505,7 +505,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
final void refresh() {
AllZone.getQuestData().saveData();
devModeCheckBox.setSelected(Constant.Runtime.DevMode[0]);
devModeCheckBox.setSelected(Constant.Runtime.DEV_MODE[0]);
smoothLandCheckBox.setSelected(Constant.Runtime.SMOOTH[0]);
creditsLabel.setText(" " + questData.getCredits());
@@ -730,10 +730,10 @@ public class QuestMainPanel extends QuestAbstractPanel {
Constant.Runtime.HUMAN_DECK[0] = humanDeck;
moveDeckToTop(humanDeckName);
Constant.Quest.oppIconName[0] = getEventIconFilename();
Constant.Quest.OPP_ICON_NAME[0] = getEventIconFilename();
// Dev Mode occurs before Display
Constant.Runtime.DevMode[0] = devModeCheckBox.isSelected();
Constant.Runtime.DEV_MODE[0] = devModeCheckBox.isSelected();
// DO NOT CHANGE THIS ORDER, GuiDisplay needs to be created before cards
// are added

View File

@@ -1022,7 +1022,7 @@ public class Gui_HomeScreen {
} else if (o.toString().equals(decks.get(2))) {
ArrayList<String> colors = new ArrayList<String>();
colors.add("Random");
for (String c : Constant.Color.onlyColors) {
for (String c : Constant.Color.ONLY_COLORS) {
colors.add(c);
}
@@ -1063,7 +1063,7 @@ public class Gui_HomeScreen {
} else if (o.toString().equals(decks.get(3))) {
ArrayList<String> colors = new ArrayList<String>();
colors.add("Random");
for (String c : Constant.Color.onlyColors) {
for (String c : Constant.Color.ONLY_COLORS) {
colors.add(c);
}
@@ -1361,8 +1361,8 @@ public class Gui_HomeScreen {
}
Singletons.getModel().getPreferences().cardSize = CardSizeType.valueOf(keys[index].toLowerCase());
Constant.Runtime.width[0] = widths[index];
Constant.Runtime.height[0] = heights[index];
Constant.Runtime.WIDTH[0] = widths[index];
Constant.Runtime.HEIGHT[0] = heights[index];
} catch (Exception ex) {
ErrorViewer.showError(ex);
@@ -1382,7 +1382,7 @@ public class Gui_HomeScreen {
return;
}
Singletons.getModel().getPreferences().stackOffset = StackOffsetType.valueOf(keys[index].toLowerCase());
Constant.Runtime.stackOffset[0] = offsets[index];
Constant.Runtime.STACK_OFFSET[0] = offsets[index];
} catch (Exception ex) {
ErrorViewer.showError(ex);

View File

@@ -181,20 +181,20 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
AllZone.setQuestData(null);
if (Constant.Runtime.width[0] == 0) {
Constant.Runtime.width[0] = 300;
if (Constant.Runtime.WIDTH[0] == 0) {
Constant.Runtime.WIDTH[0] = 300;
}
if (Constant.Runtime.height[0] == 0) {
Constant.Runtime.height[0] = 98;
if (Constant.Runtime.HEIGHT[0] == 0) {
Constant.Runtime.HEIGHT[0] = 98;
}
if (Constant.Runtime.stackSize[0] == 0) {
Constant.Runtime.stackSize[0] = 4;
if (Constant.Runtime.STACK_SIZE[0] == 0) {
Constant.Runtime.STACK_SIZE[0] = 4;
}
if (Constant.Runtime.stackOffset[0] == 0) {
Constant.Runtime.stackOffset[0] = 10;
if (Constant.Runtime.STACK_OFFSET[0] == 0) {
Constant.Runtime.STACK_OFFSET[0] = 10;
}
try {
@@ -533,8 +533,8 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
devModeCheckBox.setText(ForgeProps.getLocalized(NEW_GAME_TEXT.DEV_MODE));
devModeCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(final ActionEvent e) {
Constant.Runtime.DevMode[0] = devModeCheckBox.isSelected();
Singletons.getModel().getPreferences().developerMode = Constant.Runtime.DevMode[0];
Constant.Runtime.DEV_MODE[0] = devModeCheckBox.isSelected();
Singletons.getModel().getPreferences().developerMode = Constant.Runtime.DEV_MODE[0];
}
});
@@ -545,8 +545,8 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
upldDrftCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(final ActionEvent e) {
Constant.Runtime.UpldDrft[0] = upldDrftCheckBox.isSelected();
Singletons.getModel().getPreferences().uploadDraftAI = Constant.Runtime.UpldDrft[0];
Constant.Runtime.UPLOAD_DRAFT[0] = upldDrftCheckBox.isSelected();
Singletons.getModel().getPreferences().uploadDraftAI = Constant.Runtime.UPLOAD_DRAFT[0];
}
});
@@ -554,8 +554,8 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
foilRandomCheckBox.setToolTipText("Approximately 1:20 cards will appear with foiling effects applied.");
foilRandomCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(final ActionEvent e) {
Constant.Runtime.RndCFoil[0] = foilRandomCheckBox.isSelected();
Singletons.getModel().getPreferences().randCFoil = Constant.Runtime.RndCFoil[0];
Constant.Runtime.RANDOM_FOIL[0] = foilRandomCheckBox.isSelected();
Singletons.getModel().getPreferences().randCFoil = Constant.Runtime.RANDOM_FOIL[0];
}
});
@@ -1323,8 +1323,8 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
*/
public static void set(final int index) {
Singletons.getModel().getPreferences().cardSize = CardSizeType.valueOf(keys[index].toLowerCase());
Constant.Runtime.width[0] = widths[index];
Constant.Runtime.height[0] = (int) Math.round((widths[index] * (3.5 / 2.5)));
Constant.Runtime.WIDTH[0] = widths[index];
Constant.Runtime.HEIGHT[0] = (int) Math.round((widths[index] * (3.5 / 2.5)));
}
/**
@@ -1342,8 +1342,8 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
}
index++;
}
Constant.Runtime.width[0] = widths[index];
Constant.Runtime.height[0] = (int) Math.round((widths[index] * (3.5 / 2.5)));
Constant.Runtime.WIDTH[0] = widths[index];
Constant.Runtime.HEIGHT[0] = (int) Math.round((widths[index] * (3.5 / 2.5)));
}
}
@@ -1402,7 +1402,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
*/
public static void set(final int index) {
Singletons.getModel().getPreferences().maxStackSize = values[index];
Constant.Runtime.stackSize[0] = values[index];
Constant.Runtime.STACK_SIZE[0] = values[index];
}
/**
@@ -1413,7 +1413,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
*/
public static void setVal(final int val) {
Singletons.getModel().getPreferences().maxStackSize = val;
Constant.Runtime.stackSize[0] = val;
Constant.Runtime.STACK_SIZE[0] = val;
}
}
@@ -1469,7 +1469,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
*/
public static void set(final int index) {
Singletons.getModel().getPreferences().stackOffset = StackOffsetType.valueOf(keys[index].toLowerCase());
Constant.Runtime.stackOffset[0] = offsets[index];
Constant.Runtime.STACK_OFFSET[0] = offsets[index];
}
/**
@@ -1487,7 +1487,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
}
index++;
}
Constant.Runtime.stackOffset[0] = offsets[index];
Constant.Runtime.STACK_OFFSET[0] = offsets[index];
}
}
@@ -1626,10 +1626,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
// preferences.newGui = newGuiCheckBox.isSelected();
preferences.stackAiLand = smoothLandCheckBox.isSelected();
preferences.millingLossCondition = Constant.Runtime.MILL[0];
preferences.developerMode = Constant.Runtime.DevMode[0];
preferences.developerMode = Constant.Runtime.DEV_MODE[0];
preferences.cardOverlay = cardOverlay.isSelected();
preferences.scaleLargerThanOriginal = ImageCache.scaleLargerThanOriginal;
preferences.uploadDraftAI = Constant.Runtime.UpldDrft[0];
preferences.uploadDraftAI = Constant.Runtime.UPLOAD_DRAFT[0];
preferences.save();
} catch (Exception ex) {
int result = JOptionPane.showConfirmDialog(this,

View File

@@ -53,74 +53,74 @@ public class RunTest {
//********* test ManaCost
ManaCost manaCost = new ManaCost("G");
check("21", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Green);
manaCost.payMana(Constant.Color.GREEN);
check("22", manaCost.isPaid());
manaCost = new ManaCost("7");
check("23", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Black);
manaCost.payMana(Constant.Color.BLACK);
check("24", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Blue);
manaCost.payMana(Constant.Color.BLUE);
check("25", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Colorless);
manaCost.payMana(Constant.Color.COLORLESS);
check("26", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Green);
manaCost.payMana(Constant.Color.GREEN);
check("27", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Red);
manaCost.payMana(Constant.Color.RED);
check("28", !manaCost.isPaid());
manaCost.payMana(Constant.Color.White);
manaCost.payMana(Constant.Color.WHITE);
check("29", !manaCost.isPaid());
manaCost.payMana(Constant.Color.White);
manaCost.payMana(Constant.Color.WHITE);
check("30", manaCost.isPaid());
manaCost = new ManaCost("2 W W G G B B U U R R");
check("31", !manaCost.isPaid());
manaCost.payMana(Constant.Color.White);
manaCost.payMana(Constant.Color.WHITE);
check("32", !manaCost.isPaid());
manaCost.payMana(Constant.Color.White);
manaCost.payMana(Constant.Color.WHITE);
check("32.1", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Black);
manaCost.payMana(Constant.Color.BLACK);
check("33", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Black);
manaCost.payMana(Constant.Color.BLACK);
check("34", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Blue);
manaCost.payMana(Constant.Color.BLUE);
check("35", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Blue);
manaCost.payMana(Constant.Color.BLUE);
check("36", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Green);
manaCost.payMana(Constant.Color.GREEN);
check("37", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Green);
manaCost.payMana(Constant.Color.GREEN);
check("38", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Red);
manaCost.payMana(Constant.Color.RED);
check("39", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Red);
manaCost.payMana(Constant.Color.RED);
check("40", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Red);
manaCost.payMana(Constant.Color.RED);
check("41", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Blue);
manaCost.payMana(Constant.Color.BLUE);
check("42", manaCost.isPaid());
manaCost = new ManaCost("G G");
check("43", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Green);
manaCost.payMana(Constant.Color.GREEN);
check("44", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Green);
manaCost.payMana(Constant.Color.GREEN);
check("45", manaCost.isPaid());
manaCost = new ManaCost("1 U B");
check("45", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Black);
manaCost.payMana(Constant.Color.BLACK);
check("46", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Blue);
manaCost.payMana(Constant.Color.BLUE);
check("47", !manaCost.isPaid());
manaCost.payMana(Constant.Color.Blue);
manaCost.payMana(Constant.Color.BLUE);
check("48", manaCost.isPaid());
//********* test CardUtil.getColors()
c = new Card();
c.setManaCost("G");
ArrayList<String> color = CardUtil.getColors(c);
check("49", color.contains(Constant.Color.Green));
check("49", color.contains(Constant.Color.GREEN));
check("50", color.size() == 1);
c = new Card();
@@ -129,38 +129,38 @@ public class RunTest {
Set<String> set = new HashSet<String>(color);
System.out.println("color: " + color);
check("51", set.size() == 5);
check("52", color.contains(Constant.Color.Black));
check("53", color.contains(Constant.Color.Blue));
check("54", color.contains(Constant.Color.Green));
check("55", color.contains(Constant.Color.Red));
check("56", color.contains(Constant.Color.White));
check("52", color.contains(Constant.Color.BLACK));
check("53", color.contains(Constant.Color.BLUE));
check("54", color.contains(Constant.Color.GREEN));
check("55", color.contains(Constant.Color.RED));
check("56", color.contains(Constant.Color.WHITE));
c = new Card();
c.setManaCost("2");
color = CardUtil.getColors(c);
check("57", color.size() == 1);
check("58", color.contains(Constant.Color.Colorless));
check("58", color.contains(Constant.Color.COLORLESS));
c = new Card();
color = CardUtil.getColors(c);
check("59", color.size() == 1);
check("60", color.contains(Constant.Color.Colorless));
check("60", color.contains(Constant.Color.COLORLESS));
c = new Card();
c.setManaCost("");
color = CardUtil.getColors(c);
check("61", color.size() == 1);
check("62", color.contains(Constant.Color.Colorless));
check("62", color.contains(Constant.Color.COLORLESS));
c = cf.getCard("Bayou", null);
color = CardUtil.getColors(c);
check("63", color.size() == 1);
check("64", color.contains(Constant.Color.Colorless));
check("64", color.contains(Constant.Color.COLORLESS));
c = cf.getCard("Elvish Warrior", null);
color = CardUtil.getColors(c);
check("65", color.size() == 1);
check("66", color.contains(Constant.Color.Green));
check("66", color.contains(Constant.Color.GREEN));
c = new Card();
c.setManaCost("11 W W B B U U R R G G");
@@ -172,7 +172,7 @@ public class RunTest {
c.setManaCost("11");
color = CardUtil.getColors(c);
check("68", color.size() == 1);
check("69", color.contains(Constant.Color.Colorless));
check("69", color.contains(Constant.Color.COLORLESS));
check("70", c.isCreature());
check("71", !c.isArtifact());
@@ -210,8 +210,8 @@ public class RunTest {
check("97", c.isUntapped());
//test Input_PayManaCostUtil
check("98", Input_PayManaCostUtil.getLongColorString("G").equals(Constant.Color.Green));
check("99", Input_PayManaCostUtil.getLongColorString("1").equals(Constant.Color.Colorless));
check("98", Input_PayManaCostUtil.getLongColorString("G").equals(Constant.Color.GREEN));
check("99", Input_PayManaCostUtil.getLongColorString("1").equals(Constant.Color.COLORLESS));
/*
check("101", Input_PayManaCostUtil.isManaNeeded(Constant.Color.Green, new ManaCost("5")) == true);

View File

@@ -481,11 +481,11 @@ public class Mana_PartTest {
Card c = new Card();
p.addMana(new Mana(Constant.Color.Black, 1, c));
p.addMana(new Mana(Constant.Color.Red, 1, c));
p.addMana(new Mana(Constant.Color.Green, 1, c));
p.addMana(new Mana(Constant.Color.White, 1, c));
p.addMana(new Mana(Constant.Color.Blue, 1, c));
p.addMana(new Mana(Constant.Color.BLACK, 1, c));
p.addMana(new Mana(Constant.Color.RED, 1, c));
p.addMana(new Mana(Constant.Color.GREEN, 1, c));
p.addMana(new Mana(Constant.Color.WHITE, 1, c));
p.addMana(new Mana(Constant.Color.BLUE, 1, c));
check(46.1, p.isPaid(), p);
}