checkstyle and refactor

This commit is contained in:
jendave
2011-10-29 06:13:20 +00:00
parent 9ada94036e
commit e646a6190e
66 changed files with 691 additions and 622 deletions

View File

@@ -27,15 +27,15 @@ public class Util {
* Constant. * Constant.
* <code>isMac=System.getProperty("os.name").toLowerCase().indexOf("mac") != -1</code>. * <code>isMac=System.getProperty("os.name").toLowerCase().indexOf("mac") != -1</code>.
*/ */
public static final boolean isMac = System.getProperty("os.name").toLowerCase().indexOf("mac") != -1; public static final boolean IS_MAC = System.getProperty("os.name").toLowerCase().indexOf("mac") != -1;
/** /**
* Constant. * Constant.
* <code>isWindows=System.getProperty("os.name").toLowerCase().indexOf("windows") == -1</code> * <code>isWindows=System.getProperty("os.name").toLowerCase().indexOf("windows") == -1</code>
*/ */
public static final boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows") == -1; public static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase().indexOf("windows") == -1;
/** Constant <code>threadPool</code>. */ /** Constant <code>threadPool</code>. */
public static ThreadPoolExecutor threadPool; private static ThreadPoolExecutor threadPool;
/** Constant <code>threadCount</code>. */ /** Constant <code>threadCount</code>. */
private static int threadCount; private static int threadCount;
@@ -88,8 +88,7 @@ public class Util {
*/ */
private static void broadcast(final DatagramSocket socket, private static void broadcast(final DatagramSocket socket,
final byte[] data, final int port, final Enumeration<NetworkInterface> ifaces) final byte[] data, final int port, final Enumeration<NetworkInterface> ifaces)
throws IOException throws IOException {
{
for (NetworkInterface iface : Collections.list(ifaces)) { for (NetworkInterface iface : Collections.list(ifaces)) {
for (InetAddress address : Collections.list(iface.getInetAddresses())) { for (InetAddress address : Collections.list(iface.getInetAddresses())) {
if (!address.isSiteLocalAddress()) { if (!address.isSiteLocalAddress()) {

View File

@@ -149,7 +149,7 @@ public class AIPlayer extends Player {
public final CardList discard(final int num, final SpellAbility sa, final boolean duringResolution) { public final CardList discard(final int num, final SpellAbility sa, final boolean duringResolution) {
int max = getCardsIn(Zone.Hand).size(); int max = getCardsIn(Zone.Hand).size();
max = Math.min(max, num); max = Math.min(max, num);
CardList discarded = ComputerUtil.AI_discardNumType(max, null, sa); CardList discarded = ComputerUtil.discardNumTypeAI(max, null, sa);
for (int i = 0; i < discarded.size(); i++) { for (int i = 0; i < discarded.size(); i++) {
doDiscard(discarded.get(i), sa); doDiscard(discarded.get(i), sa);
} }
@@ -293,7 +293,7 @@ public class AIPlayer extends Player {
* @see forge.Player#discard_Chains_of_Mephistopheles() * @see forge.Player#discard_Chains_of_Mephistopheles()
*/ */
@Override @Override
protected final void discard_Chains_of_Mephistopheles() { protected final void discardChainsOfMephistopheles() {
discard(null); discard(null);
drawCard(); drawCard();
} }

View File

@@ -40,7 +40,7 @@ public final class AllZone implements NewConstants {
} }
/** Global <code>SKIN</code>. */ /** Global <code>SKIN</code>. */
private static FSkin SKIN = null; private static FSkin skin = null;
/** Global <code>questData</code>. */ /** Global <code>questData</code>. */
private static forge.quest.data.QuestData questData = null; private static forge.quest.data.QuestData questData = null;
@@ -582,7 +582,7 @@ public final class AllZone implements NewConstants {
* @since 1.0.15 * @since 1.0.15
*/ */
public static FSkin getSkin() { public static FSkin getSkin() {
return SKIN; return skin;
} }
/** /**
@@ -596,6 +596,6 @@ public final class AllZone implements NewConstants {
* @since 1.0.15 * @since 1.0.15
*/ */
public static void setSkin(final FSkin fs) { public static void setSkin(final FSkin fs) {
SKIN = fs; skin = fs;
} }
} // AllZone } // AllZone

View File

@@ -83,7 +83,7 @@ public abstract class AllZoneUtil {
*/ */
public static CardList getCreaturesInPlay() { public static CardList getCreaturesInPlay() {
CardList creats = getCardsIn(Zone.Battlefield); CardList creats = getCardsIn(Zone.Battlefield);
return creats.filter(CardListFilter.creatures); return creats.filter(CardListFilter.CREATURES);
} }
/** /**
@@ -95,7 +95,7 @@ public abstract class AllZoneUtil {
*/ */
public static CardList getCreaturesInPlay(final Player player) { public static CardList getCreaturesInPlay(final Player player) {
CardList creats = player.getCardsIn(Zone.Battlefield); CardList creats = player.getCardsIn(Zone.Battlefield);
return creats.filter(CardListFilter.creatures); return creats.filter(CardListFilter.CREATURES);
} }
// /////////////// Lands // /////////////// Lands
@@ -108,7 +108,7 @@ public abstract class AllZoneUtil {
* @return a CardList containing all lands the given player has in play * @return a CardList containing all lands the given player has in play
*/ */
public static CardList getPlayerLandsInPlay(final Player player) { public static CardList getPlayerLandsInPlay(final Player player) {
return player.getCardsIn(Zone.Battlefield).filter(CardListFilter.lands); return player.getCardsIn(Zone.Battlefield).filter(CardListFilter.LANDS);
} }
/** /**
@@ -117,7 +117,7 @@ public abstract class AllZoneUtil {
* @return a CardList of all lands on the battlefield * @return a CardList of all lands on the battlefield
*/ */
public static CardList getLandsInPlay() { public static CardList getLandsInPlay() {
return getCardsIn(Zone.Battlefield).filter(CardListFilter.lands); return getCardsIn(Zone.Battlefield).filter(CardListFilter.LANDS);
} }
// ============================================================================= // =============================================================================

View File

@@ -39,7 +39,7 @@ public final class Base64Coder {
* Constant. * Constant.
* <code>systemLineSeparator="System.getProperty(line.separator)"</code> * <code>systemLineSeparator="System.getProperty(line.separator)"</code>
*/ */
private static final String systemLineSeparator = System.getProperty("line.separator"); private static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator");
// Mapping table from 6-bit nibbles to Base64 characters. // Mapping table from 6-bit nibbles to Base64 characters.
/** Constant <code>map1=new char[64]</code>. */ /** Constant <code>map1=new char[64]</code>. */
@@ -116,7 +116,7 @@ public final class Base64Coder {
* @return A String containing the Base64 encoded data, broken into lines. * @return A String containing the Base64 encoded data, broken into lines.
*/ */
public static String encodeLines(final byte[] in) { public static String encodeLines(final byte[] in) {
return encodeLines(in, 0, in.length, 76, systemLineSeparator); return encodeLines(in, 0, in.length, 76, SYSTEM_LINE_SEPARATOR);
} }
/** /**
@@ -136,7 +136,8 @@ public final class Base64Coder {
* The line separator to be used to separate the output lines. * The line separator to be used to separate the output lines.
* @return A String containing the Base64 encoded data, broken into lines. * @return A String containing the Base64 encoded data, broken into lines.
*/ */
public static String encodeLines(final byte[] in, final int iOff, final int iLen, final int lineLen, final String lineSeparator) { public static String encodeLines(final byte[] in, final int iOff,
final int iLen, final int lineLen, final String lineSeparator) {
int blockLen = (lineLen * 3) / 4; int blockLen = (lineLen * 3) / 4;
if (blockLen <= 0) { if (blockLen <= 0) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();

View File

@@ -47,6 +47,11 @@ public class Card extends GameEntity implements Comparable<Card> {
private boolean isDoubleFaced = false; private boolean isDoubleFaced = false;
private boolean isFlip = false; private boolean isFlip = false;
/**
* Gets the characteristics.
*
* @return the characteristics
*/
public CardCharacteristics getCharacteristics() { public CardCharacteristics getCharacteristics() {
return characteristics[currentCharacteristic]; return characteristics[currentCharacteristic];
} }
@@ -4484,7 +4489,8 @@ public class Card extends GameEntity implements Comparable<Card> {
+ getCounters(Counters.P1P2) + getCounters(Counters.P1P2)
+ getCounters(Counters.P1P0) + getCounters(Counters.P1P0)
- getCounters(Counters.M1M1) - getCounters(Counters.M1M1)
+ (2 * getCounters(Counters.P2P2) - (2 * getCounters(Counters.M2M1)) - (2 * getCounters(Counters.M2M2)) - getCounters(Counters.M1M0)); + (2 * getCounters(Counters.P2P2) - (2 * getCounters(Counters.M2M1))
- (2 * getCounters(Counters.M2M2)) - getCounters(Counters.M1M0));
return total; return total;
} }
@@ -6245,7 +6251,8 @@ public class Card extends GameEntity implements Comparable<Card> {
cardType = toMixedCase(cardType); cardType = toMixedCase(cardType);
if (typeContains(cardType) if (typeContains(cardType)
|| ((isCreature() || isTribal()) && CardUtil.isACreatureType(cardType) && typeContains("AllCreatureTypes"))) { || ((isCreature() || isTribal()) && CardUtil.isACreatureType(cardType)
&& typeContains("AllCreatureTypes"))) {
return true; return true;
} }
return false; return false;
@@ -6257,7 +6264,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* isValid. * isValid.
* </p> * </p>
* *
* @param Restriction * @param restriction
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
* @param sourceController * @param sourceController
* a {@link forge.Player} object. * a {@link forge.Player} object.
@@ -6266,13 +6273,13 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean. * @return a boolean.
*/ */
@Override @Override
public final boolean isValid(final String Restriction, final Player sourceController, final Card source) { public final boolean isValid(final String restriction, final Player sourceController, final Card source) {
if (getName().equals("Mana Pool") || isImmutable()) { if (getName().equals("Mana Pool") || isImmutable()) {
return false; return false;
} }
String[] incR = Restriction.split("\\."); // Inclusive restrictions are String[] incR = restriction.split("\\."); // Inclusive restrictions are
// Card types // Card types
if (incR[0].equals("Spell") && !isSpell()) { if (incR[0].equals("Spell") && !isSpell()) {
@@ -6304,7 +6311,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* hasProperty. * hasProperty.
* </p> * </p>
* *
* @param Property * @param property
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
* @param sourceController * @param sourceController
* a {@link forge.Player} object. * a {@link forge.Player} object.
@@ -6313,52 +6320,52 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean. * @return a boolean.
*/ */
@Override @Override
public boolean hasProperty(final String Property, final Player sourceController, final Card source) { public boolean hasProperty(final String property, final Player sourceController, final Card source) {
// by name can also have color names, so needs to happen before colors. // by name can also have color names, so needs to happen before colors.
if (Property.startsWith("named")) { if (property.startsWith("named")) {
if (!getName().equals(Property.substring(5))) { if (!getName().equals(property.substring(5))) {
return false; return false;
} }
} else if (Property.startsWith("notnamed")) { } else if (property.startsWith("notnamed")) {
if (getName().equals(Property.substring(8))) { if (getName().equals(property.substring(8))) {
return false; return false;
} }
} else if (Property.startsWith("sameName")) { } else if (property.startsWith("sameName")) {
if (!getName().equals(source.getName())) { if (!getName().equals(source.getName())) {
return false; return false;
} }
} else if (Property.equals("NamedCard")) { } else if (property.equals("NamedCard")) {
if (!getName().equals(source.getNamedCard())) { if (!getName().equals(source.getNamedCard())) {
return false; return false;
} }
} }
// ... Card colors // ... Card colors
else if (Property.contains("White") || Property.contains("Blue") || Property.contains("Black") else if (property.contains("White") || property.contains("Blue") || property.contains("Black")
|| Property.contains("Red") || Property.contains("Green") || Property.contains("Colorless")) { || property.contains("Red") || property.contains("Green") || property.contains("Colorless")) {
if (Property.startsWith("non")) { if (property.startsWith("non")) {
if (CardUtil.getColors(this).contains(Property.substring(3).toLowerCase())) { if (CardUtil.getColors(this).contains(property.substring(3).toLowerCase())) {
return false; return false;
} }
} else if (!CardUtil.getColors(this).contains(Property.toLowerCase())) { } else if (!CardUtil.getColors(this).contains(property.toLowerCase())) {
return false; return false;
} }
} else if (Property.contains("MultiColor")) // ... Card is multicolored } else if (property.contains("MultiColor")) // ... Card is multicolored
{ {
if (Property.startsWith("non") && (CardUtil.getColors(this).size() > 1)) { if (property.startsWith("non") && (CardUtil.getColors(this).size() > 1)) {
return false; return false;
} }
if (!Property.startsWith("non") && (CardUtil.getColors(this).size() <= 1)) { if (!property.startsWith("non") && (CardUtil.getColors(this).size() <= 1)) {
return false; return false;
} }
} else if (Property.contains("MonoColor")) { } else if (property.contains("MonoColor")) {
// ... Card is monocolored // ... Card is monocolored
if (Property.startsWith("non") && (CardUtil.getColors(this).size() == 1 && !isColorless())) { if (property.startsWith("non") && (CardUtil.getColors(this).size() == 1 && !isColorless())) {
return false; return false;
} }
if (!Property.startsWith("non") && (CardUtil.getColors(this).size() > 1 || isColorless())) { if (!property.startsWith("non") && (CardUtil.getColors(this).size() > 1 || isColorless())) {
return false; return false;
} }
} else if (Property.equals("ChosenColor")) { } else if (property.equals("ChosenColor")) {
// Should this match All chosen colors, or any? Default to first // Should this match All chosen colors, or any? Default to first
// chosen for now until it matters. // chosen for now until it matters.
if (source.getChosenColor().size() == 0) { if (source.getChosenColor().size() == 0) {
@@ -6367,23 +6374,23 @@ public class Card extends GameEntity implements Comparable<Card> {
if (!CardUtil.getColors(this).contains(source.getChosenColor().get(0))) { if (!CardUtil.getColors(this).contains(source.getChosenColor().get(0))) {
return false; return false;
} }
} else if (Property.equals("DoubleFaced")) { } else if (property.equals("DoubleFaced")) {
if (!isDoubleFaced) { if (!isDoubleFaced) {
return false; return false;
} }
} else if (Property.equals("Flip")) { } else if (property.equals("Flip")) {
if (!isFlip) { if (!isFlip) {
return false; return false;
} }
} else if (Property.startsWith("YouCtrl")) { } else if (property.startsWith("YouCtrl")) {
if (!getController().isPlayer(sourceController)) { if (!getController().isPlayer(sourceController)) {
return false; return false;
} }
} else if (Property.startsWith("YouDontCtrl")) { } else if (property.startsWith("YouDontCtrl")) {
if (getController().isPlayer(sourceController)) { if (getController().isPlayer(sourceController)) {
return false; return false;
} }
} else if (Property.startsWith("EnchantedPlayerCtrl")) { } else if (property.startsWith("EnchantedPlayerCtrl")) {
Object o = source.getEnchanting(); Object o = source.getEnchanting();
if (o instanceof Player) { if (o instanceof Player) {
if (!getController().isPlayer((Player) o)) { if (!getController().isPlayer((Player) o)) {
@@ -6392,110 +6399,110 @@ public class Card extends GameEntity implements Comparable<Card> {
} else { // source not enchanting a player } else { // source not enchanting a player
return false; return false;
} }
} else if (Property.startsWith("YouOwn")) { } else if (property.startsWith("YouOwn")) {
if (!getOwner().isPlayer(sourceController)) { if (!getOwner().isPlayer(sourceController)) {
return false; return false;
} }
} else if (Property.startsWith("YouDontOwn")) { } else if (property.startsWith("YouDontOwn")) {
if (getOwner().isPlayer(sourceController)) { if (getOwner().isPlayer(sourceController)) {
return false; return false;
} }
} else if (Property.startsWith("OwnerDoesntControl")) { } else if (property.startsWith("OwnerDoesntControl")) {
if (getOwner().isPlayer(getController())) { if (getOwner().isPlayer(getController())) {
return false; return false;
} }
} else if (Property.startsWith("ControllerControls")) { } else if (property.startsWith("ControllerControls")) {
String type = Property.substring(18); String type = property.substring(18);
CardList list = getController().getCardsIn(Zone.Battlefield); CardList list = getController().getCardsIn(Zone.Battlefield);
if (list.getType(type).isEmpty()) { if (list.getType(type).isEmpty()) {
return false; return false;
} }
} else if (Property.startsWith("Other")) { } else if (property.startsWith("Other")) {
if (this.equals(source)) { if (this.equals(source)) {
return false; return false;
} }
} else if (Property.startsWith("Self")) { } else if (property.startsWith("Self")) {
if (!this.equals(source)) { if (!this.equals(source)) {
return false; return false;
} }
} else if (Property.startsWith("AttachedBy")) { } else if (property.startsWith("AttachedBy")) {
if (!equippedBy.contains(source) && !enchantedBy.contains(source)) { if (!equippedBy.contains(source) && !enchantedBy.contains(source)) {
return false; return false;
} }
} else if (Property.startsWith("Attached")) { } else if (property.startsWith("Attached")) {
if (!equipping.contains(source) && !source.equals(enchanting)) { if (!equipping.contains(source) && !source.equals(enchanting)) {
return false; return false;
} }
} else if (Property.startsWith("EnchantedBy")) { } else if (property.startsWith("EnchantedBy")) {
if (!enchantedBy.contains(source)) { if (!enchantedBy.contains(source)) {
return false; return false;
} }
} else if (Property.startsWith("NotEnchantedBy")) { } else if (property.startsWith("NotEnchantedBy")) {
if (enchantedBy.contains(source)) { if (enchantedBy.contains(source)) {
return false; return false;
} }
} else if (Property.startsWith("Enchanted")) { } else if (property.startsWith("Enchanted")) {
if (!source.equals(enchanting)) { if (!source.equals(enchanting)) {
return false; return false;
} }
} else if (Property.startsWith("EquippedBy")) { } else if (property.startsWith("EquippedBy")) {
if (!equippedBy.contains(source)) { if (!equippedBy.contains(source)) {
return false; return false;
} }
} else if (Property.startsWith("Equipped")) { } else if (property.startsWith("Equipped")) {
if (!equipping.contains(source)) { if (!equipping.contains(source)) {
return false; return false;
} }
} else if (Property.startsWith("HauntedBy")) { } else if (property.startsWith("HauntedBy")) {
if (!hauntedBy.contains(source)) { if (!hauntedBy.contains(source)) {
return false; return false;
} }
} else if (Property.startsWith("Above")) { // "Are Above" Source } else if (property.startsWith("Above")) { // "Are Above" Source
CardList list = this.getOwner().getCardsIn(Zone.Graveyard); CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
if (!list.getAbove(source, this)) { if (!list.getAbove(source, this)) {
return false; return false;
} }
} else if (Property.startsWith("DirectlyAbove")) { // "Are Directly Above" } else if (property.startsWith("DirectlyAbove")) { // "Are Directly Above"
// Source // Source
CardList list = this.getOwner().getCardsIn(Zone.Graveyard); CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
if (!list.getDirectlyAbove(source, this)) { if (!list.getDirectlyAbove(source, this)) {
return false; return false;
} }
} else if (Property.startsWith("TopGraveyardCreature")) { } else if (property.startsWith("TopGraveyardCreature")) {
CardList list = this.getOwner().getCardsIn(Zone.Graveyard); CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
list = list.getType("Creature"); list = list.getType("Creature");
list.reverse(); list.reverse();
if (list.isEmpty() || !this.equals(list.get(0))) { if (list.isEmpty() || !this.equals(list.get(0))) {
return false; return false;
} }
} else if (Property.startsWith("TopGraveyard")) { } else if (property.startsWith("TopGraveyard")) {
CardList list = this.getOwner().getCardsIn(Zone.Graveyard); CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
list.reverse(); list.reverse();
if (list.isEmpty() || !this.equals(list.get(0))) { if (list.isEmpty() || !this.equals(list.get(0))) {
return false; return false;
} }
} else if (Property.startsWith("TopLibrary")) { } else if (property.startsWith("TopLibrary")) {
CardList list = this.getOwner().getCardsIn(Zone.Library); CardList list = this.getOwner().getCardsIn(Zone.Library);
if (list.isEmpty() || !this.equals(list.get(0))) { if (list.isEmpty() || !this.equals(list.get(0))) {
return false; return false;
} }
} else if (Property.startsWith("Cloned")) { } else if (property.startsWith("Cloned")) {
if (cloneOrigin == null || !cloneOrigin.equals(source)) { if (cloneOrigin == null || !cloneOrigin.equals(source)) {
return false; return false;
} }
} else if (Property.startsWith("DamagedBy")) { } else if (property.startsWith("DamagedBy")) {
if (!receivedDamageFromThisTurn.containsKey(source)) { if (!receivedDamageFromThisTurn.containsKey(source)) {
return false; return false;
} }
} else if (Property.startsWith("Damaged")) { } else if (property.startsWith("Damaged")) {
if (!dealtDamageToThisTurn.containsKey(source)) { if (!dealtDamageToThisTurn.containsKey(source)) {
return false; return false;
} }
} else if (Property.startsWith("SharesColorWith")) { } else if (property.startsWith("SharesColorWith")) {
if (!sharesColorWith(source)) { if (!sharesColorWith(source)) {
return false; return false;
} }
} else if (Property.startsWith("withFlashback")) { } else if (property.startsWith("withFlashback")) {
boolean fb = false; boolean fb = false;
if (hasStartOfUnHiddenKeyword("Flashback")) { if (hasStartOfUnHiddenKeyword("Flashback")) {
fb = true; fb = true;
@@ -6508,133 +6515,133 @@ public class Card extends GameEntity implements Comparable<Card> {
if (!fb) { if (!fb) {
return false; return false;
} }
} else if (Property.startsWith("with")) { } else if (property.startsWith("with")) {
// ... Card keywords // ... Card keywords
if (Property.startsWith("without") && hasStartOfUnHiddenKeyword(Property.substring(7))) { if (property.startsWith("without") && hasStartOfUnHiddenKeyword(property.substring(7))) {
return false; return false;
} }
if (!Property.startsWith("without") && !hasStartOfUnHiddenKeyword(Property.substring(4))) { if (!property.startsWith("without") && !hasStartOfUnHiddenKeyword(property.substring(4))) {
return false; return false;
} }
} else if (Property.startsWith("tapped")) { } else if (property.startsWith("tapped")) {
if (!isTapped()) { if (!isTapped()) {
return false; return false;
} }
} else if (Property.startsWith("untapped")) { } else if (property.startsWith("untapped")) {
if (!isUntapped()) { if (!isUntapped()) {
return false; return false;
} }
} else if (Property.startsWith("faceDown")) { } else if (property.startsWith("faceDown")) {
if (!isFaceDown()) { if (!isFaceDown()) {
return false; return false;
} }
} else if (Property.startsWith("faceUp")) { } else if (property.startsWith("faceUp")) {
if (isFaceDown()) { if (isFaceDown()) {
return false; return false;
} }
} else if (Property.startsWith("hasLevelUp")) { } else if (property.startsWith("hasLevelUp")) {
if (!hasLevelUp()) { if (!hasLevelUp()) {
return false; return false;
} }
} else if (Property.startsWith("enteredBattlefieldThisTurn")) { } else if (property.startsWith("enteredBattlefieldThisTurn")) {
if (!(getTurnInZone() == AllZone.getPhase().getTurn())) { if (!(getTurnInZone() == AllZone.getPhase().getTurn())) {
return false; return false;
} }
} else if (Property.startsWith("dealtDamageToYouThisTurn")) { } else if (property.startsWith("dealtDamageToYouThisTurn")) {
if (!(dealtDmgToHumanThisTurn && getController().isPlayer(AllZone.getComputerPlayer())) if (!(dealtDmgToHumanThisTurn && getController().isPlayer(AllZone.getComputerPlayer()))
&& !(dealtDmgToComputerThisTurn && getController().isPlayer(AllZone.getHumanPlayer()))) { && !(dealtDmgToComputerThisTurn && getController().isPlayer(AllZone.getHumanPlayer()))) {
return false; return false;
} }
} else if (Property.startsWith("wasDealtDamageThisTurn")) { } else if (property.startsWith("wasDealtDamageThisTurn")) {
if ((getReceivedDamageFromThisTurn().keySet()).isEmpty()) { if ((getReceivedDamageFromThisTurn().keySet()).isEmpty()) {
return false; return false;
} }
} else if (Property.startsWith("greatestPower")) { } else if (property.startsWith("greatestPower")) {
CardList list = AllZoneUtil.getCreaturesInPlay(); CardList list = AllZoneUtil.getCreaturesInPlay();
for (Card crd : list) { for (Card crd : list) {
if (crd.getNetAttack() > getNetAttack()) { if (crd.getNetAttack() > getNetAttack()) {
return false; return false;
} }
} }
} else if (Property.startsWith("leastPower")) { } else if (property.startsWith("leastPower")) {
CardList list = AllZoneUtil.getCreaturesInPlay(); CardList list = AllZoneUtil.getCreaturesInPlay();
for (Card crd : list) { for (Card crd : list) {
if (crd.getNetAttack() < getNetAttack()) { if (crd.getNetAttack() < getNetAttack()) {
return false; return false;
} }
} }
} else if (Property.startsWith("greatestCMC")) { } else if (property.startsWith("greatestCMC")) {
CardList list = AllZoneUtil.getCreaturesInPlay(); CardList list = AllZoneUtil.getCreaturesInPlay();
for (Card crd : list) { for (Card crd : list) {
if (crd.getCMC() > getCMC()) { if (crd.getCMC() > getCMC()) {
return false; return false;
} }
} }
} else if (Property.startsWith("enchanted")) { } else if (property.startsWith("enchanted")) {
if (!isEnchanted()) { if (!isEnchanted()) {
return false; return false;
} }
} else if (Property.startsWith("unenchanted")) { } else if (property.startsWith("unenchanted")) {
if (isEnchanted()) { if (isEnchanted()) {
return false; return false;
} }
} else if (Property.startsWith("enchanting")) { } else if (property.startsWith("enchanting")) {
if (!isEnchanting()) { if (!isEnchanting()) {
return false; return false;
} }
} else if (Property.startsWith("equipped")) { } else if (property.startsWith("equipped")) {
if (!isEquipped()) { if (!isEquipped()) {
return false; return false;
} }
} else if (Property.startsWith("unequipped")) { } else if (property.startsWith("unequipped")) {
if (isEquipped()) { if (isEquipped()) {
return false; return false;
} }
} else if (Property.startsWith("equipping")) { } else if (property.startsWith("equipping")) {
if (!isEquipping()) { if (!isEquipping()) {
return false; return false;
} }
} else if (Property.startsWith("token")) { } else if (property.startsWith("token")) {
if (!isToken()) { if (!isToken()) {
return false; return false;
} }
} else if (Property.startsWith("nonToken")) { } else if (property.startsWith("nonToken")) {
if (isToken()) { if (isToken()) {
return false; return false;
} }
} else if (Property.startsWith("hasXCost")) { } else if (property.startsWith("hasXCost")) {
if (getSpellAbility().length > 0) { if (getSpellAbility().length > 0) {
if (!getSpellAbility()[0].isXCost()) { if (!getSpellAbility()[0].isXCost()) {
return false; return false;
} }
} }
} else if (Property.startsWith("power") || // 8/10 } else if (property.startsWith("power") || // 8/10
Property.startsWith("toughness") || Property.startsWith("cmc")) { property.startsWith("toughness") || property.startsWith("cmc")) {
int x = 0; int x = 0;
int y = 0; int y = 0;
int z = 0; int z = 0;
if (Property.startsWith("power")) { if (property.startsWith("power")) {
z = 7; z = 7;
y = getNetAttack(); y = getNetAttack();
} else if (Property.startsWith("toughness")) { } else if (property.startsWith("toughness")) {
z = 11; z = 11;
y = getNetDefense(); y = getNetDefense();
} else if (Property.startsWith("cmc")) { } else if (property.startsWith("cmc")) {
z = 5; z = 5;
y = getCMC(); y = getCMC();
} }
if (Property.substring(z).equals("X")) { if (property.substring(z).equals("X")) {
x = CardFactoryUtil.xCount(source, source.getSVar("X")); x = CardFactoryUtil.xCount(source, source.getSVar("X"));
} else if (Property.substring(z).equals("Y")) { } else if (property.substring(z).equals("Y")) {
x = CardFactoryUtil.xCount(source, source.getSVar("Y")); x = CardFactoryUtil.xCount(source, source.getSVar("Y"));
} else { } else {
x = Integer.parseInt(Property.substring(z)); x = Integer.parseInt(property.substring(z));
} }
if (!AllZoneUtil.compare(y, Property, x)) { if (!AllZoneUtil.compare(y, property, x)) {
return false; return false;
} }
} }
@@ -6647,7 +6654,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* SVar:X:Number$12 to get two digits. This will need a better fix, and * SVar:X:Number$12 to get two digits. This will need a better fix, and
* I have the beginnings of a regex below * I have the beginnings of a regex below
*/ */
else if (Property.startsWith("counters")) { else if (property.startsWith("counters")) {
/* /*
* Pattern p = Pattern.compile("[a-z]*[A-Z][A-Z][X0-9]+.*$"); * Pattern p = Pattern.compile("[a-z]*[A-Z][A-Z][X0-9]+.*$");
* String[] parse = ??? * String[] parse = ???
@@ -6659,7 +6666,7 @@ public class Card extends GameEntity implements Comparable<Card> {
// TODO get a working regex out of this pattern so the amount of // TODO get a working regex out of this pattern so the amount of
// digits doesn't matter // digits doesn't matter
int number = 0; int number = 0;
String[] splitProperty = Property.split("_"); String[] splitProperty = property.split("_");
String strNum = splitProperty[1].substring(2); String strNum = splitProperty[1].substring(2);
String comparator = splitProperty[1].substring(0, 2); String comparator = splitProperty[1].substring(0, 2);
String counterType = ""; String counterType = "";
@@ -6675,78 +6682,78 @@ public class Card extends GameEntity implements Comparable<Card> {
if (!AllZoneUtil.compare(actualnumber, comparator, number)) { if (!AllZoneUtil.compare(actualnumber, comparator, number)) {
return false; return false;
} }
} else if (Property.startsWith("attacking")) { } else if (property.startsWith("attacking")) {
if (!isAttacking()) { if (!isAttacking()) {
return false; return false;
} }
} else if (Property.startsWith("notattacking")) { } else if (property.startsWith("notattacking")) {
if (isAttacking()) { if (isAttacking()) {
return false; return false;
} }
} else if (Property.equals("blocking")) { } else if (property.equals("blocking")) {
if (!isBlocking()) { if (!isBlocking()) {
return false; return false;
} }
} else if (Property.startsWith("blockingSource")) { } else if (property.startsWith("blockingSource")) {
if (!isBlocking(source)) { if (!isBlocking(source)) {
return false; return false;
} }
} else if (Property.startsWith("notblocking")) { } else if (property.startsWith("notblocking")) {
if (isBlocking()) { if (isBlocking()) {
return false; return false;
} }
} else if (Property.equals("blocked")) { } else if (property.equals("blocked")) {
if (!AllZone.getCombat().isBlocked(this)) { if (!AllZone.getCombat().isBlocked(this)) {
return false; return false;
} }
} else if (Property.startsWith("blockedBySource")) { } else if (property.startsWith("blockedBySource")) {
if (!isBlockedBy(source)) { if (!isBlockedBy(source)) {
return false; return false;
} }
} else if (Property.startsWith("unblocked")) { } else if (property.startsWith("unblocked")) {
if (!AllZone.getCombat().isUnblocked(this)) { if (!AllZone.getCombat().isUnblocked(this)) {
return false; return false;
} }
} else if (Property.startsWith("kicked")) { } else if (property.startsWith("kicked")) {
if (!isKicked()) { if (!isKicked()) {
return false; return false;
} }
} else if (Property.startsWith("notkicked")) { } else if (property.startsWith("notkicked")) {
if (isKicked()) { if (isKicked()) {
return false; return false;
} }
} else if (Property.startsWith("evoked")) { } else if (property.startsWith("evoked")) {
if (!isEvoked()) { if (!isEvoked()) {
return false; return false;
} }
} else if (Property.equals("HasDevoured")) { } else if (property.equals("HasDevoured")) {
if (devouredCards.size() == 0) { if (devouredCards.size() == 0) {
return false; return false;
} }
} else if (Property.equals("HasNotDevoured")) { } else if (property.equals("HasNotDevoured")) {
if (devouredCards.size() != 0) { if (devouredCards.size() != 0) {
return false; return false;
} }
} else if (Property.startsWith("non")) { } else if (property.startsWith("non")) {
// ... Other Card types // ... Other Card types
if (isType(Property.substring(3))) { if (isType(property.substring(3))) {
return false; return false;
} }
} else if (Property.equals("CostsPhyrexianMana")) { } else if (property.equals("CostsPhyrexianMana")) {
if (!getCharacteristics().getManaCost().contains("P")) { if (!getCharacteristics().getManaCost().contains("P")) {
return false; return false;
} }
} else if (Property.equals("IsRemembered")) { } else if (property.equals("IsRemembered")) {
if (!source.getRemembered().contains(this)) { if (!source.getRemembered().contains(this)) {
return false; return false;
} }
} else { } else {
if (Property.equals("ChosenType")) { if (property.equals("ChosenType")) {
if (!isType(source.getChosenType())) { if (!isType(source.getChosenType())) {
return false; return false;
} }
} else { } else {
if (!isType(Property)) { if (!isType(property)) {
return false; return false;
} }
} }
@@ -7453,7 +7460,8 @@ public class Card extends GameEntity implements Comparable<Card> {
return 0; return 0;
} }
if (this.hasKeyword("If damage would be dealt to CARDNAME, prevent that damage. Remove a +1/+1 counter from CARDNAME.")) { if (this.hasKeyword("If damage would be dealt to CARDNAME, "
+ "prevent that damage. Remove a +1/+1 counter from CARDNAME.")) {
restDamage = 0; restDamage = 0;
this.subtractCounter(Counters.P1P1, 1); this.subtractCounter(Counters.P1P1, 1);
} }

View File

@@ -60,7 +60,7 @@ public class CardFilter {
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public final CardList CardListTextFilter(final CardList all, final String name) { public final CardList cardListTextFilter(final CardList all, final String name) {
Card cardName; Card cardName;
String s; String s;
s = ""; s = "";
@@ -92,15 +92,15 @@ public class CardFilter {
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public final CardList CardListColorFilter(final CardList all, final String name) { public final CardList cardListColorFilter(final CardList all, final String name) {
Card CardName = new Card(); Card cardName = new Card();
CardList listFilter = new CardList(); CardList listFilter = new CardList();
if (name == "black") { if (name == "black") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardUtil.getColors(CardName).contains(Constant.Color.Black)) { if (!CardUtil.getColors(cardName).contains(Constant.Color.Black)) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -108,9 +108,9 @@ public class CardFilter {
if (name == "blue") { if (name == "blue") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardUtil.getColors(CardName).contains(Constant.Color.Blue)) { if (!CardUtil.getColors(cardName).contains(Constant.Color.Blue)) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -118,9 +118,9 @@ public class CardFilter {
if (name == "green") { if (name == "green") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardUtil.getColors(CardName).contains(Constant.Color.Green)) { if (!CardUtil.getColors(cardName).contains(Constant.Color.Green)) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -128,9 +128,9 @@ public class CardFilter {
if (name == "red") { if (name == "red") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardUtil.getColors(CardName).contains(Constant.Color.Red)) { if (!CardUtil.getColors(cardName).contains(Constant.Color.Red)) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -138,9 +138,9 @@ public class CardFilter {
if (name == "white") { if (name == "white") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardUtil.getColors(CardName).contains(Constant.Color.White)) { if (!CardUtil.getColors(cardName).contains(Constant.Color.White)) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -148,9 +148,9 @@ public class CardFilter {
if (name.equals("colorless")) { if (name.equals("colorless")) {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardUtil.getColors(CardName).contains(Constant.Color.Colorless)) { if (!CardUtil.getColors(cardName).contains(Constant.Color.Colorless)) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -172,15 +172,15 @@ public class CardFilter {
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public final CardList CardListTypeFilter(final CardList all, final String name) { public final CardList cardListTypeFilter(final CardList all, final String name) {
Card CardName = new Card(); Card cardName = new Card();
CardList listFilter = new CardList(); CardList listFilter = new CardList();
if (name == "artifact") { if (name == "artifact") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardName.isArtifact()) { if (!cardName.isArtifact()) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -188,9 +188,9 @@ public class CardFilter {
if (name == "creature") { if (name == "creature") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardName.isCreature()) { if (!cardName.isCreature()) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -198,9 +198,9 @@ public class CardFilter {
if (name == "enchantment") { if (name == "enchantment") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardName.isEnchantment()) { if (!cardName.isEnchantment()) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -208,9 +208,9 @@ public class CardFilter {
if (name == "instant") { if (name == "instant") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardName.isInstant()) { if (!cardName.isInstant()) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -218,9 +218,9 @@ public class CardFilter {
if (name == "land") { if (name == "land") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardName.isLand()) { if (!cardName.isLand()) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -228,9 +228,9 @@ public class CardFilter {
if (name == "planeswalker") { if (name == "planeswalker") {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardName.isPlaneswalker()) { if (!cardName.isPlaneswalker()) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }
@@ -238,9 +238,9 @@ public class CardFilter {
if (name.equals("sorcery")) { if (name.equals("sorcery")) {
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {
CardName = all.getCard(i); cardName = all.getCard(i);
if (!CardName.isSorcery()) { if (!cardName.isSorcery()) {
listFilter.add(CardName); listFilter.add(cardName);
} }
} }

View File

@@ -23,7 +23,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all cards that are tapped. * a CardListFilter to get all cards that are tapped.
*/ */
CardListFilter tapped = new CardListFilter() { CardListFilter TAPPED = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isTapped(); return c.isTapped();
} }
@@ -32,7 +32,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all cards that are untapped. * a CardListFilter to get all cards that are untapped.
*/ */
CardListFilter untapped = new CardListFilter() { CardListFilter UNTAPPED = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isUntapped(); return c.isUntapped();
} }
@@ -41,7 +41,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all creatures. * a CardListFilter to get all creatures.
*/ */
CardListFilter creatures = new CardListFilter() { CardListFilter CREATURES = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isCreature(); return c.isCreature();
} }
@@ -50,7 +50,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all enchantments. * a CardListFilter to get all enchantments.
*/ */
CardListFilter enchantments = new CardListFilter() { CardListFilter ENCHANTMENTS = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isEnchantment(); return c.isEnchantment();
} }
@@ -59,7 +59,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all equipment. * a CardListFilter to get all equipment.
*/ */
CardListFilter equipment = new CardListFilter() { CardListFilter EQUIPMENT = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isEquipment(); return c.isEquipment();
} }
@@ -68,7 +68,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all unenchanted cards in a list. * a CardListFilter to get all unenchanted cards in a list.
*/ */
CardListFilter unenchanted = new CardListFilter() { CardListFilter UNENCHANTED = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return !c.isEnchanted(); return !c.isEnchanted();
} }
@@ -77,7 +77,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all enchanted cards in a list. * a CardListFilter to get all enchanted cards in a list.
*/ */
CardListFilter enchanted = new CardListFilter() { CardListFilter ENCHANTED = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isEnchanted(); return c.isEnchanted();
} }
@@ -86,7 +86,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all nontoken cards. * a CardListFilter to get all nontoken cards.
*/ */
CardListFilter nonToken = new CardListFilter() { CardListFilter NON_TOKEN = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return !c.isToken(); return !c.isToken();
} }
@@ -95,7 +95,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all token cards. * a CardListFilter to get all token cards.
*/ */
CardListFilter token = new CardListFilter() { CardListFilter TOKEN = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isToken(); return c.isToken();
} }
@@ -104,7 +104,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all nonbasic lands. * a CardListFilter to get all nonbasic lands.
*/ */
CardListFilter nonBasicLand = new CardListFilter() { CardListFilter NON_BASIC_LAND = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return !c.isBasicLand(); return !c.isBasicLand();
} }
@@ -113,7 +113,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all basicLands. * a CardListFilter to get all basicLands.
*/ */
CardListFilter basicLands = new CardListFilter() { CardListFilter BASIC_LANDS = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
// the isBasicLand() check here may be sufficient... // the isBasicLand() check here may be sufficient...
return c.isLand() && c.isBasicLand(); return c.isLand() && c.isBasicLand();
@@ -123,7 +123,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all artifacts. * a CardListFilter to get all artifacts.
*/ */
CardListFilter artifacts = new CardListFilter() { CardListFilter ARTIFACTS = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isArtifact(); return c.isArtifact();
} }
@@ -132,7 +132,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all nonartifacts. * a CardListFilter to get all nonartifacts.
*/ */
CardListFilter nonartifacts = new CardListFilter() { CardListFilter NON_ARTIFACTS = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return !c.isArtifact(); return !c.isArtifact();
} }
@@ -141,7 +141,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all lands. * a CardListFilter to get all lands.
*/ */
CardListFilter lands = new CardListFilter() { CardListFilter LANDS = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isLand(); return c.isLand();
} }
@@ -150,7 +150,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all nonlands. * a CardListFilter to get all nonlands.
*/ */
CardListFilter nonlands = new CardListFilter() { CardListFilter NON_LANDS = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return !c.isLand(); return !c.isLand();
} }
@@ -159,7 +159,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all cards that are black. * a CardListFilter to get all cards that are black.
*/ */
CardListFilter black = new CardListFilter() { CardListFilter BLACK = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isBlack(); return c.isBlack();
} }
@@ -168,7 +168,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all cards that are blue. * a CardListFilter to get all cards that are blue.
*/ */
CardListFilter blue = new CardListFilter() { CardListFilter BLUE = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isBlue(); return c.isBlue();
} }
@@ -177,7 +177,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all cards that are green. * a CardListFilter to get all cards that are green.
*/ */
CardListFilter green = new CardListFilter() { CardListFilter GREEN = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isGreen(); return c.isGreen();
} }
@@ -186,7 +186,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all cards that are red. * a CardListFilter to get all cards that are red.
*/ */
CardListFilter red = new CardListFilter() { CardListFilter RED = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isRed(); return c.isRed();
} }
@@ -195,7 +195,7 @@ public interface CardListFilter {
/** /**
* a CardListFilter to get all cards that are white. * a CardListFilter to get all cards that are white.
*/ */
CardListFilter white = new CardListFilter() { CardListFilter WHITE = new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.isWhite(); return c.isWhite();
} }

View File

@@ -411,7 +411,8 @@ public final class CardUtil {
return c.getEquipping().get(0); return c.getEquipping().get(0);
// else if(relation.startsWith("target ")) return c.getTargetCard(); // else if(relation.startsWith("target ")) return c.getTargetCard();
} else { } else {
throw new IllegalArgumentException("Error at CardUtil.getRelative: " + relation + "is not a valid relation"); throw new IllegalArgumentException("Error at CardUtil.getRelative: "
+ relation + "is not a valid relation");
} }
} }
@@ -439,7 +440,7 @@ public final class CardUtil {
ArrayList<String> types = new ArrayList<String>(); ArrayList<String> types = new ArrayList<String>();
// types.addAll(getCardTypes()); // types.addAll(getCardTypes());
types.addAll(Constant.CardTypes.cardTypes[0].list); types.addAll(Constant.CardTypes.CARD_TYPES[0].getList());
// not currently used by Forge // not currently used by Forge
types.add("Plane"); types.add("Plane");
@@ -468,7 +469,7 @@ public final class CardUtil {
// types.add("Sorcery"); // types.add("Sorcery");
// types.add("Tribal"); // types.add("Tribal");
types.addAll(Constant.CardTypes.cardTypes[0].list); types.addAll(Constant.CardTypes.CARD_TYPES[0].getList());
return types; return types;
} }
@@ -484,7 +485,7 @@ public final class CardUtil {
public static ArrayList<String> getBasicTypes() { public static ArrayList<String> getBasicTypes() {
ArrayList<String> types = new ArrayList<String>(); ArrayList<String> types = new ArrayList<String>();
types.addAll(Constant.CardTypes.basicTypes[0].list); types.addAll(Constant.CardTypes.BASIC_TYPES[0].getList());
return types; return types;
} }
@@ -497,8 +498,8 @@ public final class CardUtil {
public static ArrayList<String> getLandTypes() { public static ArrayList<String> getLandTypes() {
ArrayList<String> types = new ArrayList<String>(); ArrayList<String> types = new ArrayList<String>();
types.addAll(Constant.CardTypes.basicTypes[0].list); types.addAll(Constant.CardTypes.BASIC_TYPES[0].getList());
types.addAll(Constant.CardTypes.landTypes[0].list); types.addAll(Constant.CardTypes.LAND_TYPES[0].getList());
return types; return types;
} }
@@ -514,7 +515,7 @@ public final class CardUtil {
public static ArrayList<String> getCreatureTypes() { public static ArrayList<String> getCreatureTypes() {
ArrayList<String> types = new ArrayList<String>(); ArrayList<String> types = new ArrayList<String>();
types.addAll(Constant.CardTypes.creatureTypes[0].list); types.addAll(Constant.CardTypes.CREATURE_TYPES[0].getList());
return types; return types;
} }
@@ -530,7 +531,7 @@ public final class CardUtil {
*/ */
public static boolean isASuperType(final String cardType) { public static boolean isASuperType(final String cardType) {
return (Constant.CardTypes.superTypes[0].list.contains(cardType)); return (Constant.CardTypes.SUPER_TYPES[0].getList().contains(cardType));
} }
/** /**
@@ -556,7 +557,7 @@ public final class CardUtil {
* @return a boolean. * @return a boolean.
*/ */
public static boolean isACreatureType(final String cardType) { public static boolean isACreatureType(final String cardType) {
return (Constant.CardTypes.creatureTypes[0].list.contains(cardType)); return (Constant.CardTypes.CREATURE_TYPES[0].getList().contains(cardType));
} }
/** /**
@@ -569,7 +570,7 @@ public final class CardUtil {
* @return a boolean. * @return a boolean.
*/ */
public static boolean isALandType(final String cardType) { public static boolean isALandType(final String cardType) {
return (Constant.CardTypes.landTypes[0].list.contains(cardType)); return (Constant.CardTypes.LAND_TYPES[0].getList().contains(cardType));
} }
/** /**
@@ -580,7 +581,7 @@ public final class CardUtil {
* @return true, if is a planeswalker type * @return true, if is a planeswalker type
*/ */
public static boolean isAPlaneswalkerType(final String cardType) { public static boolean isAPlaneswalkerType(final String cardType) {
return (Constant.CardTypes.walkerTypes[0].list.contains(cardType)); return (Constant.CardTypes.WALKER_TYPES[0].getList().contains(cardType));
} }
/** /**
@@ -593,7 +594,7 @@ public final class CardUtil {
* @return a boolean. * @return a boolean.
*/ */
public static boolean isABasicLandType(final String cardType) { public static boolean isABasicLandType(final String cardType) {
return (Constant.CardTypes.basicTypes[0].list.contains(cardType)); return (Constant.CardTypes.BASIC_TYPES[0].getList().contains(cardType));
} }
// this function checks, if duplicates of a keyword are not necessary (like // this function checks, if duplicates of a keyword are not necessary (like
@@ -608,7 +609,7 @@ public final class CardUtil {
* @return a boolean. * @return a boolean.
*/ */
public static boolean isNonStackingKeyword(final String keyword) { public static boolean isNonStackingKeyword(final String keyword) {
return Constant.Keywords.NonStackingList[0].list.contains(keyword); return Constant.Keywords.NON_STACKING_LIST[0].getList().contains(keyword);
} }
/** /**

View File

@@ -76,7 +76,7 @@ public class Card_Color {
*/ */
Card_Color(final ManaCost mc, final Card c, final boolean addToColors, final boolean baseColor) { Card_Color(final ManaCost mc, final Card c, final boolean addToColors, final boolean baseColor) {
additional = addToColors; additional = addToColors;
col = Color.ConvertManaCostToColor(mc); col = Color.convertManaCostToColor(mc);
effectingCard = c; effectingCard = c;
if (baseColor) { if (baseColor) {
stamp = 0; stamp = 0;
@@ -94,7 +94,7 @@ public class Card_Color {
* a {@link forge.Card} object. * a {@link forge.Card} object.
*/ */
public Card_Color(final Card c) { public Card_Color(final Card c) {
col = Color.Colorless(); col = Color.colorless();
additional = false; additional = false;
stamp = 0; stamp = 0;
effectingCard = c; effectingCard = c;
@@ -110,7 +110,7 @@ public class Card_Color {
* @return a boolean. * @return a boolean.
*/ */
final boolean addToCardColor(final String s) { final boolean addToCardColor(final String s) {
Color c = Color.ConvertFromString(s); Color c = Color.convertFromString(s);
if (!col.contains(c)) { if (!col.contains(c)) {
col.add(c); col.add(c);
return true; return true;

View File

@@ -49,7 +49,7 @@ public enum Color {
* *
* @return a {@link java.util.EnumSet} object. * @return a {@link java.util.EnumSet} object.
*/ */
public static EnumSet<Color> Colorless() { public static EnumSet<Color> colorless() {
EnumSet<Color> colors = EnumSet.of(Color.Colorless); EnumSet<Color> colors = EnumSet.of(Color.Colorless);
return colors; return colors;
} }
@@ -63,11 +63,11 @@ public enum Color {
* an array of {@link java.lang.String} objects. * an array of {@link java.lang.String} objects.
* @return a {@link java.util.EnumSet} object. * @return a {@link java.util.EnumSet} object.
*/ */
public static EnumSet<Color> ConvertStringsToColor(final String[] s) { public static EnumSet<Color> convertStringsToColor(final String[] s) {
EnumSet<Color> colors = EnumSet.of(Color.Colorless); EnumSet<Color> colors = EnumSet.of(Color.Colorless);
for (int i = 0; i < s.length; i++) { for (int i = 0; i < s.length; i++) {
colors.add(ConvertFromString(s[i])); colors.add(convertFromString(s[i]));
} }
if (colors.size() > 1) { if (colors.size() > 1) {
@@ -86,7 +86,7 @@ public enum Color {
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
* @return a {@link forge.Color} object. * @return a {@link forge.Color} object.
*/ */
public static Color ConvertFromString(final String s) { public static Color convertFromString(final String s) {
if (s.equals(Constant.Color.White)) { if (s.equals(Constant.Color.White)) {
return Color.White; return Color.White;
@@ -113,7 +113,7 @@ public enum Color {
* a {@link forge.card.mana.ManaCost} object. * a {@link forge.card.mana.ManaCost} object.
* @return a {@link java.util.EnumSet} object. * @return a {@link java.util.EnumSet} object.
*/ */
public static EnumSet<Color> ConvertManaCostToColor(final ManaCost m) { public static EnumSet<Color> convertManaCostToColor(final ManaCost m) {
EnumSet<Color> colors = EnumSet.of(Color.Colorless); EnumSet<Color> colors = EnumSet.of(Color.Colorless);
if (m.isColor("W")) { if (m.isColor("W")) {

View File

@@ -26,7 +26,8 @@ public class ColorChanger {
* a boolean. * a boolean.
* @return a long. * @return a long.
*/ */
public final long addColorChanges(final String s, final Card c, final boolean addToColors, final boolean bIncrease) { public final long addColorChanges(final String s, final Card c,
final boolean addToColors, final boolean bIncrease) {
if (bIncrease) { if (bIncrease) {
Card_Color.increaseTimestamp(); Card_Color.increaseTimestamp();
} }

View File

@@ -160,7 +160,8 @@ public class CombatUtil {
if (attacker.hasKeyword("Islandwalk")) { if (attacker.hasKeyword("Islandwalk")) {
temp = blkCL.getType("Island"); temp = blkCL.getType("Island");
if (!AllZoneUtil.isCardInPlay("Undertow") && !AllZoneUtil.isCardInPlay("Gosta Dirk") && !temp.isEmpty()) { if (!AllZoneUtil.isCardInPlay("Undertow")
&& !AllZoneUtil.isCardInPlay("Gosta Dirk") && !temp.isEmpty()) {
return false; return false;
} }
} }
@@ -312,7 +313,8 @@ public class CombatUtil {
} }
// "CARDNAME blocks each turn if able." // "CARDNAME blocks each turn if able."
if (!combat.getAllBlockers().contains(blocker) && blocker.hasKeyword("CARDNAME blocks each turn if able.")) { if (!combat.getAllBlockers().contains(blocker)
&& blocker.hasKeyword("CARDNAME blocks each turn if able.")) {
for (Card attacker : attackers) { for (Card attacker : attackers) {
if (canBlock(attacker, blocker, combat)) { if (canBlock(attacker, blocker, combat)) {
return false; return false;
@@ -433,9 +435,9 @@ public class CombatUtil {
for (String kw : blocker.getKeyword()) { for (String kw : blocker.getKeyword()) {
if (kw.startsWith("CARDNAME can't block ")) { if (kw.startsWith("CARDNAME can't block ")) {
String unblockableCard = kw.substring(21); String unblockableCard = kw.substring(21);
int ID = Integer.parseInt(unblockableCard.substring(unblockableCard.lastIndexOf("(") + 1, int id = Integer.parseInt(unblockableCard.substring(unblockableCard.lastIndexOf("(") + 1,
unblockableCard.length() - 1)); unblockableCard.length() - 1));
if (attacker.getUniqueNumber() == ID) { if (attacker.getUniqueNumber() == id) {
return false; return false;
} }
} }
@@ -463,18 +465,20 @@ public class CombatUtil {
} }
if (blocker.getNetAttack() > attacker.getNetAttack() if (blocker.getNetAttack() > attacker.getNetAttack()
&& blocker && blocker
.hasKeyword("CARDNAME can't be blocked by creatures with power greater than CARDNAME's power.")) { .hasKeyword("CARDNAME can't be blocked by creatures "
+ "with power greater than CARDNAME's power.")) {
return false; return false;
} }
if (blocker.getNetAttack() >= attacker.getNetDefense() if (blocker.getNetAttack() >= attacker.getNetDefense()
&& blocker && blocker
.hasKeyword("CARDNAME can't be blocked by creatures with power equal to or greater than CARDNAME's toughness.")) { .hasKeyword("CARDNAME can't be blocked by creatures with "
+ "power equal to or greater than CARDNAME's toughness.")) {
return false; return false;
} }
if (attacker.hasStartOfKeyword("CantBeBlockedBy")) { if (attacker.hasStartOfKeyword("CantBeBlockedBy")) {
int KeywordPosition = attacker.getKeywordPosition("CantBeBlockedBy"); int keywordPosition = attacker.getKeywordPosition("CantBeBlockedBy");
String parse = attacker.getKeyword().get(KeywordPosition).toString(); String parse = attacker.getKeyword().get(keywordPosition).toString();
String[] k = parse.split(" ", 2); String[] k = parse.split(" ", 2);
final String[] restrictions = k[1].split(","); final String[] restrictions = k[1].split(",");
if (blocker.isValid(restrictions, attacker.getController(), attacker)) { if (blocker.isValid(restrictions, attacker.getController(), attacker)) {
@@ -483,8 +487,8 @@ public class CombatUtil {
} }
if (blocker.hasStartOfKeyword("CantBlock")) { if (blocker.hasStartOfKeyword("CantBlock")) {
int KeywordPosition = blocker.getKeywordPosition("CantBlock"); int keywordPosition = blocker.getKeywordPosition("CantBlock");
String parse = blocker.getKeyword().get(KeywordPosition).toString(); String parse = blocker.getKeyword().get(keywordPosition).toString();
String[] k = parse.split(" ", 2); String[] k = parse.split(" ", 2);
final String[] restrictions = k[1].split(","); final String[] restrictions = k[1].split(",");
if (attacker.isValid(restrictions, blocker.getController(), blocker)) { if (attacker.isValid(restrictions, blocker.getController(), blocker)) {
@@ -572,7 +576,8 @@ public class CombatUtil {
*/ */
public static boolean canAttack(final Card c, final Combat combat) { public static boolean canAttack(final Card c, final Combat combat) {
if (combat.getAttackers().length > 1 && AllZoneUtil.isCardInPlay("Crawlspace", c.getController().getOpponent())) { if (combat.getAttackers().length > 1
&& AllZoneUtil.isCardInPlay("Crawlspace", c.getController().getOpponent())) {
return false; return false;
} }
@@ -654,7 +659,8 @@ public class CombatUtil {
list = list.filter(new CardListFilter() { list = list.filter(new CardListFilter() {
public boolean addCard(final Card ct) { public boolean addCard(final Card ct) {
return ((ct.isUntapped() && ct.getNetAttack() >= powerLimit[0] && asSeparateWords[14] return ((ct.isUntapped() && ct.getNetAttack() >= powerLimit[0] && asSeparateWords[14]
.contains("greater")) || (ct.isUntapped() && ct.getNetAttack() <= powerLimit[0] && asSeparateWords[14] .contains("greater"))
|| (ct.isUntapped() && ct.getNetAttack() <= powerLimit[0] && asSeparateWords[14]
.contains("less"))); .contains("less")));
} }
}); });
@@ -1088,7 +1094,8 @@ public class CombatUtil {
} }
} // flanking } // flanking
if (attacker.hasKeyword("Indestructible") && !(defender.hasKeyword("Wither") || defender.hasKeyword("Infect"))) { if (attacker.hasKeyword("Indestructible") && !(defender.hasKeyword("Wither")
|| defender.hasKeyword("Infect"))) {
return 0; return 0;
} }
@@ -1346,8 +1353,8 @@ public class CombatUtil {
continue; continue;
} }
String ability = source.getSVar(trigParams.get("Execute")); String ability = source.getSVar(trigParams.get("Execute"));
AbilityFactory AF = new AbilityFactory(); AbilityFactory abilityFactory = new AbilityFactory();
HashMap<String, String> abilityParams = AF.getMapParams(ability, source); HashMap<String, String> abilityParams = abilityFactory.getMapParams(ability, source);
if (abilityParams.containsKey("AB") && !abilityParams.get("AB").equals("Pump")) { if (abilityParams.containsKey("AB") && !abilityParams.get("AB").equals("Pump")) {
continue; continue;
} }
@@ -1417,8 +1424,8 @@ public class CombatUtil {
continue; continue;
} }
String ability = source.getSVar(trigParams.get("Execute")); String ability = source.getSVar(trigParams.get("Execute"));
AbilityFactory AF = new AbilityFactory(); AbilityFactory abilityFactory = new AbilityFactory();
HashMap<String, String> abilityParams = AF.getMapParams(ability, source); HashMap<String, String> abilityParams = abilityFactory.getMapParams(ability, source);
if (abilityParams.containsKey("AB") && !abilityParams.get("AB").equals("Pump")) { if (abilityParams.containsKey("AB") && !abilityParams.get("AB").equals("Pump")) {
continue; continue;
} }
@@ -1497,8 +1504,8 @@ public class CombatUtil {
continue; continue;
} }
String ability = source.getSVar(trigParams.get("Execute")); String ability = source.getSVar(trigParams.get("Execute"));
AbilityFactory AF = new AbilityFactory(); AbilityFactory abilityFactory = new AbilityFactory();
HashMap<String, String> abilityParams = AF.getMapParams(ability, source); HashMap<String, String> abilityParams = abilityFactory.getMapParams(ability, source);
if (abilityParams.containsKey("ValidTgts") || abilityParams.containsKey("Tgt")) { if (abilityParams.containsKey("ValidTgts") || abilityParams.containsKey("Tgt")) {
continue; // targeted pumping not supported continue; // targeted pumping not supported
} }
@@ -1580,8 +1587,8 @@ public class CombatUtil {
continue; continue;
} }
String ability = source.getSVar(trigParams.get("Execute")); String ability = source.getSVar(trigParams.get("Execute"));
AbilityFactory AF = new AbilityFactory(); AbilityFactory abilityFactory = new AbilityFactory();
HashMap<String, String> abilityParams = AF.getMapParams(ability, source); HashMap<String, String> abilityParams = abilityFactory.getMapParams(ability, source);
if (abilityParams.containsKey("ValidTgts") || abilityParams.containsKey("Tgt")) { if (abilityParams.containsKey("ValidTgts") || abilityParams.containsKey("Tgt")) {
continue; // targeted pumping not supported continue; // targeted pumping not supported
} }
@@ -1589,7 +1596,8 @@ public class CombatUtil {
// DealDamage triggers // DealDamage triggers
if ((abilityParams.containsKey("AB") && abilityParams.get("AB").equals("DealDamage")) if ((abilityParams.containsKey("AB") && abilityParams.get("AB").equals("DealDamage"))
|| (abilityParams.containsKey("DB") && abilityParams.get("DB").equals("DealDamage"))) { || (abilityParams.containsKey("DB") && abilityParams.get("DB").equals("DealDamage"))) {
if (!abilityParams.containsKey("Defined") || !abilityParams.get("Defined").equals("TriggeredAttacker")) { if (!abilityParams.containsKey("Defined")
|| !abilityParams.get("Defined").equals("TriggeredAttacker")) {
continue; continue;
} }
int damage = 0; int damage = 0;
@@ -2212,7 +2220,7 @@ public class CombatUtil {
} else if (c.getName().equals("Spectral Force")) { } else if (c.getName().equals("Spectral Force")) {
Player opp = c.getController().getOpponent(); Player opp = c.getController().getOpponent();
CardList list = opp.getCardsIn(Zone.Battlefield); CardList list = opp.getCardsIn(Zone.Battlefield);
list = list.filter(CardListFilter.black); list = list.filter(CardListFilter.BLACK);
if (list.size() == 0) { if (list.size() == 0) {
c.addExtrinsicKeyword("This card doesn't untap during your next untap step."); c.addExtrinsicKeyword("This card doesn't untap during your next untap step.");
} }
@@ -2547,25 +2555,25 @@ public class CombatUtil {
} }
}); });
Player player = attacker.getController(); Player player = attacker.getController();
Card Enchantment = null; Card enchantment = null;
if (player.isHuman()) { if (player.isHuman()) {
Card[] Target = new Card[enchantments.size()]; Card[] target = new Card[enchantments.size()];
for (int j = 0; j < enchantments.size(); j++) { for (int j = 0; j < enchantments.size(); j++) {
Card crd = enchantments.get(j); Card crd = enchantments.get(j);
Target[j] = crd; target[j] = crd;
} }
Object check = GuiUtils.getChoiceOptional("Select enchantment to enchant exalted creature", Object check = GuiUtils.getChoiceOptional("Select enchantment to enchant exalted creature",
Target); target);
if (check != null) { if (check != null) {
Enchantment = ((Card) check); enchantment = ((Card) check);
} }
} else { } else {
Enchantment = CardFactoryUtil.AI_getBestEnchantment(enchantments, attacker, false); enchantment = CardFactoryUtil.AI_getBestEnchantment(enchantments, attacker, false);
} }
if (Enchantment != null && AllZoneUtil.isCardInPlay(attacker)) { if (enchantment != null && AllZoneUtil.isCardInPlay(attacker)) {
GameAction.changeZone(AllZone.getZoneOf(Enchantment), GameAction.changeZone(AllZone.getZoneOf(enchantment),
Enchantment.getOwner().getZone(Constant.Zone.Battlefield), Enchantment); enchantment.getOwner().getZone(Constant.Zone.Battlefield), enchantment);
Enchantment.enchantEntity(attacker); enchantment.enchantEntity(attacker);
} }
attacker.getController().shuffle(); attacker.getController().shuffle();
} // resolve } // resolve

View File

@@ -10,7 +10,7 @@ package forge;
*/ */
public interface Command extends java.io.Serializable { public interface Command extends java.io.Serializable {
/** Constant <code>Blank</code>. */ /** Constant <code>Blank</code>. */
Command Blank = new Command() { Command BLANK = new Command() {
private static final long serialVersionUID = 2689172297036001710L; private static final long serialVersionUID = 2689172297036001710L;

View File

@@ -21,28 +21,28 @@ public interface Computer {
* begin_combat. * begin_combat.
* </p> * </p>
*/ */
void begin_combat(); void beginCombat();
/** /**
* <p> * <p>
* declare_attackers. * declare_attackers.
* </p> * </p>
*/ */
void declare_attackers(); void declareAttackers();
/** /**
* <p> * <p>
* declare_attackers_after. * declare_attackers_after.
* </p> * </p>
*/ */
void declare_attackers_after(); // can play Instants and Abilities void declareAttackersAfter(); // can play Instants and Abilities
/** /**
* <p> * <p>
* declare_blockers. * declare_blockers.
* </p> * </p>
*/ */
void declare_blockers(); // this is called after when the Human or Computer void declareBlockers(); // this is called after when the Human or Computer
// blocks // blocks
/** /**
@@ -50,14 +50,14 @@ public interface Computer {
* declare_blockers_after. * declare_blockers_after.
* </p> * </p>
*/ */
void declare_blockers_after(); // can play Instants and Abilities void declareBlockersAfter(); // can play Instants and Abilities
/** /**
* <p> * <p>
* end_of_combat. * end_of_combat.
* </p> * </p>
*/ */
void end_of_combat(); void endOfCombat();
/** /**
* <p> * <p>
@@ -71,13 +71,13 @@ public interface Computer {
* end_of_turn. * end_of_turn.
* </p> * </p>
*/ */
void end_of_turn();// end of Human's turn void endOfTurn(); // end of Human's turn
/** /**
* <p> * <p>
* stack_not_empty. * stack_not_empty.
* </p> * </p>
*/ */
void stack_not_empty(); void stackNotEmpty();
} }

View File

@@ -39,7 +39,7 @@ public class ComputerAI_General implements Computer {
ComputerUtil.chooseLandsToPlay(); ComputerUtil.chooseLandsToPlay();
if (AllZone.getStack().size() == 0) { if (AllZone.getStack().size() == 0) {
playCards(Constant.Phase.Main1); playCards(Constant.Phase.MAIN1);
} else { } else {
stackResponse(); stackResponse();
} }
@@ -69,7 +69,7 @@ public class ComputerAI_General implements Computer {
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
*/ */
private void playCards(final String phase) { private void playCards(final String phase) {
SpellAbility[] sp = phase.equals(Constant.Phase.Main1) ? getMain1() : getMain2(); SpellAbility[] sp = phase.equals(Constant.Phase.MAIN1) ? getMain1() : getMain2();
boolean nextPhase = ComputerUtil.playCards(sp); boolean nextPhase = ComputerUtil.playCards(sp);
@@ -146,7 +146,8 @@ public class ComputerAI_General implements Computer {
creatures2.add(creatures.get(i)); creatures2.add(creatures.get(i));
} }
} }
if (creatures2.size() + CardUtil.getThisTurnCast("Creature.YouCtrl", vengevines.get(0)).size() > 1 if (creatures2.size() + CardUtil.getThisTurnCast("Creature.YouCtrl",
vengevines.get(0)).size() > 1
&& c.isCreature() && CardUtil.getConvertedManaCost(c.getManaCost()) <= 3) { && c.isCreature() && CardUtil.getConvertedManaCost(c.getManaCost()) <= 3) {
return true; return true;
} }
@@ -367,7 +368,7 @@ public class ComputerAI_General implements Computer {
* begin_combat. * begin_combat.
* </p> * </p>
*/ */
public final void begin_combat() { public final void beginCombat() {
stackResponse(); stackResponse();
} }
@@ -376,7 +377,7 @@ public class ComputerAI_General implements Computer {
* declare_attackers. * declare_attackers.
* </p> * </p>
*/ */
public final void declare_attackers() { public final void declareAttackers() {
// 12/2/10(sol) the decision making here has moved to getAttackers() // 12/2/10(sol) the decision making here has moved to getAttackers()
AllZone.setCombat(ComputerUtil.getAttackers()); AllZone.setCombat(ComputerUtil.getAttackers());
@@ -403,7 +404,7 @@ public class ComputerAI_General implements Computer {
* declare_attackers_after. * declare_attackers_after.
* </p> * </p>
*/ */
public final void declare_attackers_after() { public final void declareAttackersAfter() {
stackResponse(); stackResponse();
} }
@@ -412,7 +413,7 @@ public class ComputerAI_General implements Computer {
* declare_blockers. * declare_blockers.
* </p> * </p>
*/ */
public final void declare_blockers() { public final void declareBlockers() {
CardList blockers = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); CardList blockers = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
AllZone.setCombat(ComputerUtil_Block2.getBlockers(AllZone.getCombat(), blockers)); AllZone.setCombat(ComputerUtil_Block2.getBlockers(AllZone.getCombat(), blockers));
@@ -427,7 +428,7 @@ public class ComputerAI_General implements Computer {
* declare_blockers_after. * declare_blockers_after.
* </p> * </p>
*/ */
public final void declare_blockers_after() { public final void declareBlockersAfter() {
stackResponse(); stackResponse();
} }
@@ -436,7 +437,7 @@ public class ComputerAI_General implements Computer {
* end_of_combat. * end_of_combat.
* </p> * </p>
*/ */
public final void end_of_combat() { public final void endOfCombat() {
stackResponse(); stackResponse();
} }
@@ -446,7 +447,7 @@ public class ComputerAI_General implements Computer {
* end_of_turn. * end_of_turn.
* </p> * </p>
*/ */
public final void end_of_turn() { public final void endOfTurn() {
stackResponse(); stackResponse();
} }
@@ -455,7 +456,7 @@ public class ComputerAI_General implements Computer {
* stack_not_empty. * stack_not_empty.
* </p> * </p>
*/ */
public final void stack_not_empty() { public final void stackNotEmpty() {
stackResponse(); stackResponse();
} }

View File

@@ -38,7 +38,7 @@ public class ComputerAI_Input extends Input {
* </p> * </p>
*/ */
public final void stackNotEmpty() { public final void stackNotEmpty() {
computer.stack_not_empty(); computer.stackNotEmpty();
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@@ -75,25 +75,25 @@ public class ComputerAI_Input extends Input {
final String phase = AllZone.getPhase().getPhase(); final String phase = AllZone.getPhase().getPhase();
if (AllZone.getStack().size() > 0) { if (AllZone.getStack().size() > 0) {
computer.stack_not_empty(); computer.stackNotEmpty();
} else if (phase.equals(Constant.Phase.Main1)) { } else if (phase.equals(Constant.Phase.MAIN1)) {
Log.debug("Computer main1"); Log.debug("Computer main1");
computer.main1(); computer.main1();
} else if (phase.equals(Constant.Phase.Combat_Begin)) { } else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
computer.begin_combat(); computer.beginCombat();
} else if (phase.equals(Constant.Phase.Combat_Declare_Attackers)) { } else if (phase.equals(Constant.Phase.Combat_Declare_Attackers)) {
computer.declare_attackers(); computer.declareAttackers();
} else if (phase.equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)) { } else if (phase.equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)) {
computer.declare_attackers_after(); computer.declareAttackersAfter();
} else if (phase.equals(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) { } else if (phase.equals(Constant.Phase.Combat_Declare_Blockers_InstantAbility)) {
computer.declare_blockers_after(); computer.declareBlockersAfter();
} else if (phase.equals(Constant.Phase.Combat_End)) { } else if (phase.equals(Constant.Phase.Combat_End)) {
computer.end_of_combat(); computer.endOfCombat();
} else if (phase.equals(Constant.Phase.Main2)) { } else if (phase.equals(Constant.Phase.Main2)) {
Log.debug("Computer main2"); Log.debug("Computer main2");
computer.main2(); computer.main2();
} else { } else {
computer.stack_not_empty(); computer.stackNotEmpty();
} }
} // think } // think

View File

@@ -65,15 +65,14 @@ public class ComputerUtil {
} }
sa.setActivatingPlayer(AllZone.getComputerPlayer()); sa.setActivatingPlayer(AllZone.getComputerPlayer());
if (canBePlayedAndPayedByAI(sa)) // checks everything necessary if (canBePlayedAndPayedByAI(sa)) {
{
handlePlayingSpellAbility(sa); handlePlayingSpellAbility(sa);
return false; return false;
} }
} }
return true; return true;
}// playCards() } // playCards()
/** /**
* <p> * <p>
@@ -261,7 +260,7 @@ public class ComputerUtil {
} }
return true; return true;
}// playCounterSpell() } // playCounterSpell()
// this is used for AI's counterspells // this is used for AI's counterspells
/** /**
@@ -338,7 +337,7 @@ public class ComputerUtil {
// destroys creatures if they have lethal damage, etc.. // destroys creatures if they have lethal damage, etc..
AllZone.getGameAction().checkStateEffects(); AllZone.getGameAction().checkStateEffects();
} }
}// play() } // play()
// gets Spells of cards in hand and Abilities of cards in play // gets Spells of cards in hand and Abilities of cards in play
// checks to see // checks to see
@@ -370,7 +369,7 @@ public class ComputerUtil {
for (int outer = 0; outer < all.size(); outer++) { for (int outer = 0; outer < all.size(); outer++) {
SpellAbility[] sa = all.get(outer).getSpellAbility(); SpellAbility[] sa = all.get(outer).getSpellAbility();
for (int i = 0; i < sa.length; i++) { for (int i = 0; i < sa.length; i++) {
spellAbility.add(sa[i]);// this seems like it needs to be spellAbility.add(sa[i]); // this seems like it needs to be
// copied, not sure though // copied, not sure though
} }
} }
@@ -406,7 +405,7 @@ public class ComputerUtil {
*/ */
public static boolean canPayCost(final SpellAbility sa) { public static boolean canPayCost(final SpellAbility sa) {
return canPayCost(sa, AllZone.getComputerPlayer()); return canPayCost(sa, AllZone.getComputerPlayer());
}// canPayCost() } // canPayCost()
/** /**
* <p> * <p>
@@ -425,7 +424,7 @@ public class ComputerUtil {
} }
return canPayAdditionalCosts(sa, player); return canPayAdditionalCosts(sa, player);
}// canPayCost() } // canPayCost()
/** /**
* <p> * <p>
@@ -647,7 +646,8 @@ public class ComputerUtil {
if (sourceCard.getName().equals("Rainbow Vale")) { if (sourceCard.getName().equals("Rainbow Vale")) {
sourceCard sourceCard
.addExtrinsicKeyword("An opponent gains control of CARDNAME at the beginning of the next end step."); .addExtrinsicKeyword("An opponent gains control of CARDNAME "
+ "at the beginning of the next end step.");
} }
// System.out.println("just subtracted " + // System.out.println("just subtracted " +
@@ -667,7 +667,7 @@ public class ComputerUtil {
// just // just
// paid? // paid?
AllZone.getTriggerHandler().runTrigger("TapsForMana", runParams); AllZone.getTriggerHandler().runTrigger("TapsForMana", runParams);
}// not a test } // not a test
} }
if (cost.isPaid()) { if (cost.isPaid()) {
// if (sa instanceof Spell_Permanent) // should probably // if (sa instanceof Spell_Permanent) // should probably
@@ -689,7 +689,7 @@ public class ComputerUtil {
return false; return false;
}// payManaCost() } // payManaCost()
/** /**
* <p> * <p>
@@ -743,7 +743,7 @@ public class ComputerUtil {
*/ */
public static CardList getAvailableMana() { public static CardList getAvailableMana() {
return getAvailableMana(AllZone.getComputerPlayer()); return getAvailableMana(AllZone.getComputerPlayer());
}// getAvailableMana() } // getAvailableMana()
// gets available mana sources and sorts them // gets available mana sources and sorts them
/** /**
@@ -768,7 +768,7 @@ public class ComputerUtil {
return false; return false;
} }
});// CardListFilter }); // CardListFilter
CardList sortedManaSources = new CardList(); CardList sortedManaSources = new CardList();
@@ -867,7 +867,7 @@ public class ComputerUtil {
} }
return sortedManaSources; return sortedManaSources;
}// getAvailableMana() } // getAvailableMana()
// sorts the most needed mana abilities to come first // sorts the most needed mana abilities to come first
/** /**
@@ -948,7 +948,7 @@ public class ComputerUtil {
public static boolean chooseLandsToPlay() { public static boolean chooseLandsToPlay() {
Player computer = AllZone.getComputerPlayer(); Player computer = AllZone.getComputerPlayer();
CardList landList = computer.getCardsIn(Zone.Hand); CardList landList = computer.getCardsIn(Zone.Hand);
landList = landList.filter(CardListFilter.lands); landList = landList.filter(CardListFilter.LANDS);
CardList lands = computer.getCardsIn(Zone.Graveyard).getType("Land"); CardList lands = computer.getCardsIn(Zone.Graveyard).getType("Land");
for (Card crd : lands) { for (Card crd : lands) {
@@ -978,7 +978,7 @@ public class ComputerUtil {
// don't play the land if it has cycling and enough lands are // don't play the land if it has cycling and enough lands are
// available // available
ArrayList<SpellAbility> spellAbilities = c.getSpellAbilities(); ArrayList<SpellAbility> spellAbilities = c.getSpellAbilities();
for (SpellAbility sa : spellAbilities) for (SpellAbility sa : spellAbilities) {
if (sa.isCycling()) { if (sa.isCycling()) {
CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand); CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
CardList lands = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); CardList lands = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
@@ -989,7 +989,7 @@ public class ComputerUtil {
return false; return false;
} }
} }
}
return true; return true;
} }
}); });
@@ -1043,14 +1043,14 @@ public class ComputerUtil {
for (int ip = 0; ip < 9; ip++) { // priority 0 is the lowest, for (int ip = 0; ip < 9; ip++) { // priority 0 is the lowest,
// priority 5 the highest // priority 5 the highest
final int priority = 9 - ip; final int priority = 9 - ip;
CardList SacMeList = typeList.filter(new CardListFilter() { CardList sacMeList = typeList.filter(new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return (!c.getSVar("SacMe").equals("") && Integer.parseInt(c.getSVar("SacMe")) == priority); return (!c.getSVar("SacMe").equals("") && Integer.parseInt(c.getSVar("SacMe")) == priority);
} }
}); });
if (SacMeList.size() != 0) { if (sacMeList.size() != 0) {
SacMeList.shuffle(); sacMeList.shuffle();
return SacMeList.get(0); return sacMeList.get(0);
} }
} }
} }
@@ -1060,14 +1060,15 @@ public class ComputerUtil {
for (int ip = 0; ip < 9; ip++) { // priority 0 is the lowest, for (int ip = 0; ip < 9; ip++) { // priority 0 is the lowest,
// priority 5 the highest // priority 5 the highest
final int priority = 9 - ip; final int priority = 9 - ip;
CardList SacMeList = typeList.filter(new CardListFilter() { CardList sacMeList = typeList.filter(new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return (!c.getSVar("DiscardMe").equals("") && Integer.parseInt(c.getSVar("DiscardMe")) == priority); return (!c.getSVar("DiscardMe").equals("")
&& Integer.parseInt(c.getSVar("DiscardMe")) == priority);
} }
}); });
if (SacMeList.size() != 0) { if (sacMeList.size() != 0) {
SacMeList.shuffle(); sacMeList.shuffle();
return SacMeList.get(0); return sacMeList.get(0);
} }
} }
} }
@@ -1138,7 +1139,7 @@ public class ComputerUtil {
* a {@link forge.card.spellability.SpellAbility} object. * a {@link forge.card.spellability.SpellAbility} object.
* @return a CardList of discarded cards. * @return a CardList of discarded cards.
*/ */
public static CardList AI_discardNumType(final int numDiscard, final String[] uTypes, final SpellAbility sa) { public static CardList discardNumTypeAI(final int numDiscard, final String[] uTypes, final SpellAbility sa) {
CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand); CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
Card sourceCard = null; Card sourceCard = null;
@@ -1212,7 +1213,8 @@ public class ComputerUtil {
* a int. * a int.
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public static CardList chooseExileType(final String type, final Card activate, final Card target, final int amount) { public static CardList chooseExileType(final String type,
final Card activate, final Card target, final int amount) {
return chooseExileFrom(Constant.Zone.Battlefield, type, activate, target, amount); return chooseExileFrom(Constant.Zone.Battlefield, type, activate, target, amount);
} }
@@ -1314,7 +1316,7 @@ public class ComputerUtil {
typeList = typeList.getValidCards(type.split(","), activate.getController(), activate); typeList = typeList.getValidCards(type.split(","), activate.getController(), activate);
// is this needed? // is this needed?
typeList = typeList.filter(CardListFilter.untapped); typeList = typeList.filter(CardListFilter.UNTAPPED);
if (tap) { if (tap) {
typeList.remove(activate); typeList.remove(activate);
@@ -1349,7 +1351,8 @@ public class ComputerUtil {
* a int. * a int.
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public static CardList chooseReturnType(final String type, final Card activate, final Card target, final int amount) { public static CardList chooseReturnType(final String type,
final Card activate, final Card target, final int amount) {
CardList typeList = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); CardList typeList = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
typeList = typeList.getValidCards(type.split(","), activate.getController(), activate); typeList = typeList.getValidCards(type.split(","), activate.getController(), activate);
if (target != null && target.getController().isComputer() && typeList.contains(target)) { if (target != null && target.getController().isComputer() && typeList.contains(target)) {
@@ -1456,9 +1459,9 @@ public class ComputerUtil {
return b1 - a1; return b1 - a1;
} }
};// Comparator }; // Comparator
Arrays.sort(sa, c); Arrays.sort(sa, c);
}// sortSpellAbilityByCost() } // sortSpellAbilityByCost()
/** /**
* <p> * <p>
@@ -1531,7 +1534,7 @@ public class ComputerUtil {
Player controller = card.getController(); Player controller = card.getController();
CardList l = controller.getCardsIn(Zone.Battlefield); CardList l = controller.getCardsIn(Zone.Battlefield);
for (Card c : l) for (Card c : l) {
for (SpellAbility sa : c.getSpellAbility()) { for (SpellAbility sa : c.getSpellAbility()) {
// This try/catch should fix the "computer is thinking" bug // This try/catch should fix the "computer is thinking" bug
try { try {
@@ -1563,7 +1566,7 @@ public class ComputerUtil {
showError(ex, "There is an error in the card code for %s:%n", c.getName(), ex.getMessage()); showError(ex, "There is an error in the card code for %s:%n", c.getName(), ex.getMessage());
} }
} }
}
return false; return false;
} }
@@ -1582,8 +1585,8 @@ public class ComputerUtil {
Player controller = card.getController(); Player controller = card.getController();
CardList l = controller.getCardsIn(Zone.Battlefield); CardList l = controller.getCardsIn(Zone.Battlefield);
for (Card c : l) for (Card c : l) {
for (SpellAbility sa : c.getSpellAbility()) for (SpellAbility sa : c.getSpellAbility()) {
// if SA is from AF_Counter don't add to getPlayable // if SA is from AF_Counter don't add to getPlayable
// This try/catch should fix the "computer is thinking" bug // This try/catch should fix the "computer is thinking" bug
try { try {
@@ -1600,7 +1603,8 @@ public class ComputerUtil {
Target tgt = sa.getTarget(); Target tgt = sa.getTarget();
if (tgt != null) { if (tgt != null) {
if (AllZoneUtil.getCardsIn(Zone.Battlefield) if (AllZoneUtil.getCardsIn(Zone.Battlefield)
.getValidCards(tgt.getValidTgts(), controller, af.getHostCard()).contains(card)) { .getValidCards(tgt.getValidTgts(),
controller, af.getHostCard()).contains(card)) {
prevented += AbilityFactory.calculateAmount(af.getHostCard(), prevented += AbilityFactory.calculateAmount(af.getHostCard(),
mapParams.get("Amount"), sa); mapParams.get("Amount"), sa);
} }
@@ -1611,7 +1615,8 @@ public class ComputerUtil {
} catch (Exception ex) { } catch (Exception ex) {
showError(ex, "There is an error in the card code for %s:%n", c.getName(), ex.getMessage()); showError(ex, "There is an error in the card code for %s:%n", c.getName(), ex.getMessage());
} }
}
}
return prevented; return prevented;
} }
} }

View File

@@ -62,7 +62,8 @@ public class ComputerUtil_Attack2 {
* @param blockerLife * @param blockerLife
* a int. * a int.
*/ */
public ComputerUtil_Attack2(final CardList possibleAttackers, final CardList possibleBlockers, final int blockerLife) { public ComputerUtil_Attack2(final CardList possibleAttackers,
final CardList possibleBlockers, final int blockerLife) {
humanList = new CardList(possibleBlockers.toArray()); humanList = new CardList(possibleBlockers.toArray());
humanList = humanList.getType("Creature"); humanList = humanList.getType("Creature");
@@ -253,7 +254,8 @@ public class ComputerUtil_Attack2 {
// bonus TWICE // bonus TWICE
humanBaseAttack = humanBaseAttack + humanExaltedBonus; humanBaseAttack = humanBaseAttack + humanExaltedBonus;
} }
int totalExaltedAttack = AllZoneUtil.isCardInPlay("Rafiq of the Many", AllZone.getHumanPlayer()) ? 2 * humanBaseAttack int totalExaltedAttack = AllZoneUtil.isCardInPlay("Rafiq of the Many",
AllZone.getHumanPlayer()) ? 2 * humanBaseAttack
: humanBaseAttack; : humanBaseAttack;
if ((AllZone.getComputerPlayer().getLife() - 3) <= totalExaltedAttack) { if ((AllZone.getComputerPlayer().getLife() - 3) <= totalExaltedAttack) {
// We will lose if there is an Exalted attack -- keep one // We will lose if there is an Exalted attack -- keep one
@@ -453,7 +455,7 @@ public class ComputerUtil_Attack2 {
// find the potential counter attacking damage compared to AI life total // find the potential counter attacking damage compared to AI life total
double aiLifeToPlayerDamageRatio = 1000000; double aiLifeToPlayerDamageRatio = 1000000;
if (candidateCounterAttackDamage > 0) { if (candidateCounterAttackDamage > 0) {
aiLifeToPlayerDamageRatio = (double) AllZone.getComputerPlayer().life / candidateCounterAttackDamage; aiLifeToPlayerDamageRatio = (double) AllZone.getComputerPlayer().getLife() / candidateCounterAttackDamage;
} }
// get the potential damage and strength of the AI forces // get the potential damage and strength of the AI forces
@@ -476,7 +478,7 @@ public class ComputerUtil_Attack2 {
// find the potential damage ratio the AI can cause // find the potential damage ratio the AI can cause
double playerLifeToDamageRatio = 1000000; double playerLifeToDamageRatio = 1000000;
if (candidateUnblockedDamage > 0) { if (candidateUnblockedDamage > 0) {
playerLifeToDamageRatio = (double) AllZone.getHumanPlayer().life / candidateUnblockedDamage; playerLifeToDamageRatio = (double) AllZone.getHumanPlayer().getLife() / candidateUnblockedDamage;
} }
/* /*
@@ -511,7 +513,7 @@ public class ComputerUtil_Attack2 {
// get list of attackers ordered from low power to high // get list of attackers ordered from low power to high
CardListUtil.sortAttackLowFirst(attackers); CardListUtil.sortAttackLowFirst(attackers);
// get player life total // get player life total
int playerLife = AllZone.getHumanPlayer().life; int playerLife = AllZone.getHumanPlayer().getLife();
// get the list of attackers up to the first blocked one // get the list of attackers up to the first blocked one
CardList attritionalAttackers = new CardList(); CardList attritionalAttackers = new CardList();
for (int x = 0; x < attackers.size() - playerForces; x++) { for (int x = 0; x < attackers.size() - playerForces; x++) {
@@ -564,9 +566,9 @@ public class ComputerUtil_Attack2 {
} }
} }
if (unblockableDamage > 0) { if (unblockableDamage > 0) {
turnsUntilDeathByUnblockable = AllZone.getHumanPlayer().life / unblockableDamage; turnsUntilDeathByUnblockable = AllZone.getHumanPlayer().getLife() / unblockableDamage;
} }
if (unblockableDamage > AllZone.getHumanPlayer().life) { if (unblockableDamage > AllZone.getHumanPlayer().getLife()) {
doUnblockableAttack = true; doUnblockableAttack = true;
} }
// ***************** // *****************
@@ -581,7 +583,8 @@ public class ComputerUtil_Attack2 {
// <= 1 && ratioDiff >= 1 // <= 1 && ratioDiff >= 1
// && outNumber > 0) || // && outNumber > 0) ||
aiAggression = 5; // attack at all costs aiAggression = 5; // attack at all costs
} else if ((playerLifeToDamageRatio < 2 && ratioDiff >= 0) || ratioDiff > 3 || (ratioDiff > 0 && outNumber > 0)) { } else if ((playerLifeToDamageRatio < 2 && ratioDiff >= 0)
|| ratioDiff > 3 || (ratioDiff > 0 && outNumber > 0)) {
aiAggression = 3; // attack expecting to kill creatures or damage aiAggression = 3; // attack expecting to kill creatures or damage
// player. // player.
} else if (ratioDiff >= 0 || ratioDiff + outNumber >= -1) { } else if (ratioDiff >= 0 || ratioDiff + outNumber >= -1) {
@@ -613,7 +616,8 @@ public class ComputerUtil_Attack2 {
if (combat.getAttackers().length == 0 if (combat.getAttackers().length == 0
&& (countExaltedBonus(AllZone.getComputerPlayer()) >= 3 && (countExaltedBonus(AllZone.getComputerPlayer()) >= 3
|| AllZoneUtil.isCardInPlay("Rafiq of the Many", AllZone.getComputerPlayer()) || AllZoneUtil.isCardInPlay("Rafiq of the Many", AllZone.getComputerPlayer())
|| AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield, "Battlegrace Angel").size() >= 2 || (AllZone || AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield,
"Battlegrace Angel").size() >= 2 || (AllZone
.getComputerPlayer().getCardsIn(Zone.Battlefield, "Finest Hour").size() >= 1) .getComputerPlayer().getCardsIn(Zone.Battlefield, "Finest Hour").size() >= 1)
&& AllZone.getPhase().isFirstCombat()) && !bAssault) { && AllZone.getPhase().isFirstCombat()) && !bAssault) {
int biggest = 0; int biggest = 0;

View File

@@ -15,8 +15,8 @@ import forge.game.GameType;
* @version $Id$ * @version $Id$
*/ */
public interface Constant { public interface Constant {
/** Constant <code>ProgramName="Forge - http://cardforge.org"</code> */ /** Constant <code>ProgramName="Forge - http://cardforge.org"</code>. */
String ProgramName = "Forge - http://cardforge.org"; String PROGRAM_NAME = "Forge - http://cardforge.org";
// used to pass information between the GUI screens // used to pass information between the GUI screens
/** /**
@@ -25,19 +25,19 @@ public interface Constant {
public abstract class Runtime { public abstract class Runtime {
/** The Constant HumanDeck. */ /** The Constant HumanDeck. */
public static final Deck[] HumanDeck = new Deck[1]; public static final Deck[] HUMAN_DECK = new Deck[1];
/** The Constant ComputerDeck. */ /** The Constant ComputerDeck. */
public static final Deck[] ComputerDeck = new Deck[1]; public static final Deck[] COMPUTER_DECK = new Deck[1];
/** The game type. */ /** The game type. */
public static GameType gameType = GameType.Constructed; private static GameType gameType = GameType.Constructed;
/** The Constant Smooth. */ /** The Constant Smooth. */
public static final boolean[] Smooth = new boolean[1]; public static final boolean[] SMOOTH = new boolean[1];
/** The Constant Mill. */ /** The Constant Mill. */
public static final boolean[] Mill = new boolean[1]; public static final boolean[] MILL = new boolean[1];
/** The Constant DevMode. */ /** The Constant DevMode. */
public static final boolean[] DevMode = new boolean[1]; // one for public static final boolean[] DevMode = new boolean[1]; // one for
@@ -65,6 +65,20 @@ public interface Constant {
/** The Constant stackOffset. */ /** The Constant stackOffset. */
public static final int[] stackOffset = new int[1]; public static final int[] stackOffset = new int[1];
/**
* @return the gameType
*/
public static GameType getGameType() {
return gameType;
}
/**
* @param gameType the gameType to set
*/
public static void setGameType(GameType gameType) {
Runtime.gameType = gameType; // TODO: Add 0 to parameter's name.
}
} }
// public interface IO { // public interface IO {
@@ -87,10 +101,10 @@ public interface Constant {
public interface Ability { public interface Ability {
/** The Triggered. */ /** The Triggered. */
String Triggered = "Triggered"; String TRIGGERED = "Triggered";
/** The Activated. */ /** The Activated. */
String Activated = "Activated"; String ACTIVATED = "Activated";
} }
/** /**
@@ -99,19 +113,19 @@ public interface Constant {
public interface Phase { public interface Phase {
/** The Constant Untap. */ /** The Constant Untap. */
String Untap = "Untap"; String UNTAP = "Untap";
/** The Constant Upkeep. */ /** The Constant Upkeep. */
String Upkeep = "Upkeep"; String UPKEEP = "Upkeep";
/** The Constant Draw. */ /** The Constant Draw. */
String Draw = "Draw"; String DRAW = "Draw";
/** The Constant Main1. */ /** The Constant Main1. */
String Main1 = "Main1"; String MAIN1 = "Main1";
/** The Constant Combat_Begin. */ /** The Constant Combat_Begin. */
String Combat_Begin = "BeginCombat"; String COMBAT_BEGIN = "BeginCombat";
/** The Constant Combat_Declare_Attackers. */ /** The Constant Combat_Declare_Attackers. */
String Combat_Declare_Attackers = "Declare Attackers"; String Combat_Declare_Attackers = "Declare Attackers";
@@ -250,7 +264,7 @@ public interface Constant {
// Constant_StringHashMap[1]; // Constant_StringHashMap[1];
/** The Basic lands. */ /** The Basic lands. */
String[] BasicLands = { "Plains", "Island", "Swamp", "Mountain", "Forest" }; String[] BASIC_LANDS = { "Plains", "Island", "Swamp", "Mountain", "Forest" };
} }
/** /**
@@ -259,21 +273,21 @@ public interface Constant {
public interface Quest { public interface Quest {
/** The fantasy quest. */ /** The fantasy quest. */
boolean[] fantasyQuest = new boolean[1]; boolean[] FANTASY_QUEST = new boolean[1];
// public static final Quest_Assignment[] qa = new Quest_Assignment[1]; // public static final Quest_Assignment[] qa = new Quest_Assignment[1];
/** The human list. */ /** The human list. */
CardList[] humanList = new CardList[1]; CardList[] HUMAN_LIST = new CardList[1];
/** The computer list. */ /** The computer list. */
CardList[] computerList = new CardList[1]; CardList[] COMPUTER_LIST = new CardList[1];
/** The human life. */ /** The human life. */
int[] humanLife = new int[1]; int[] humanLife = new int[1];
/** The computer life. */ /** The computer life. */
int[] computerLife = new int[1]; int[] COMPUTER_LIFE = new int[1];
/** The opp icon name. */ /** The opp icon name. */
String[] oppIconName = new String[1]; String[] oppIconName = new String[1];
@@ -285,37 +299,37 @@ public interface Constant {
public interface CardTypes { public interface CardTypes {
/** The loaded. */ /** The loaded. */
boolean[] loaded = { false }; boolean[] LOADED = { false };
/** The card types. */ /** The card types. */
Constant_StringArrayList[] cardTypes = new Constant_StringArrayList[1]; Constant_StringArrayList[] CARD_TYPES = new Constant_StringArrayList[1];
/** The super types. */ /** The super types. */
Constant_StringArrayList[] superTypes = new Constant_StringArrayList[1]; Constant_StringArrayList[] SUPER_TYPES = new Constant_StringArrayList[1];
/** The basic types. */ /** The basic types. */
Constant_StringArrayList[] basicTypes = new Constant_StringArrayList[1]; Constant_StringArrayList[] BASIC_TYPES = new Constant_StringArrayList[1];
/** The land types. */ /** The land types. */
Constant_StringArrayList[] landTypes = new Constant_StringArrayList[1]; Constant_StringArrayList[] LAND_TYPES = new Constant_StringArrayList[1];
/** The creature types. */ /** The creature types. */
Constant_StringArrayList[] creatureTypes = new Constant_StringArrayList[1]; Constant_StringArrayList[] CREATURE_TYPES = new Constant_StringArrayList[1];
/** The instant types. */ /** The instant types. */
Constant_StringArrayList[] instantTypes = new Constant_StringArrayList[1]; Constant_StringArrayList[] INSTANT_TYPES = new Constant_StringArrayList[1];
/** The sorcery types. */ /** The sorcery types. */
Constant_StringArrayList[] sorceryTypes = new Constant_StringArrayList[1]; Constant_StringArrayList[] SORCERY_TYPES = new Constant_StringArrayList[1];
/** The enchantment types. */ /** The enchantment types. */
Constant_StringArrayList[] enchantmentTypes = new Constant_StringArrayList[1]; Constant_StringArrayList[] ENCHANTMENT_TYPES = new Constant_StringArrayList[1];
/** The artifact types. */ /** The artifact types. */
Constant_StringArrayList[] artifactTypes = new Constant_StringArrayList[1]; Constant_StringArrayList[] ARTIFACT_TYPES = new Constant_StringArrayList[1];
/** The walker types. */ /** The walker types. */
Constant_StringArrayList[] walkerTypes = new Constant_StringArrayList[1]; Constant_StringArrayList[] WALKER_TYPES = new Constant_StringArrayList[1];
} }
/** /**
@@ -324,10 +338,10 @@ public interface Constant {
public interface Keywords { public interface Keywords {
/** The loaded. */ /** The loaded. */
boolean[] loaded = { false }; boolean[] LOADED = { false };
/** The Non stacking list. */ /** The Non stacking list. */
Constant_StringArrayList[] NonStackingList = new Constant_StringArrayList[1]; Constant_StringArrayList[] NON_STACKING_LIST = new Constant_StringArrayList[1];
} }
} // Constant } // Constant

View File

@@ -8,6 +8,22 @@ import java.util.ArrayList;
public class Constant_StringArrayList { public class Constant_StringArrayList {
/** The list. */ /** The list. */
public ArrayList<String> list = new ArrayList<String>(); private ArrayList<String> list = new ArrayList<String>();
/**
* @return the list
*/
public ArrayList<String> getList() {
return list;
}
/**
* Sets the list.
*
* @param list the list to set
*/
public void setList(ArrayList<String> list) {
this.list = list; // TODO: Add 0 to parameter's name.
}
} }

View File

@@ -9,6 +9,6 @@ import java.util.Map;
public class Constant_StringHashMap { public class Constant_StringHashMap {
/** The map. */ /** The map. */
public Map<String, String> map = new HashMap<String, String>(); private Map<String, String> map = new HashMap<String, String>();
} }

View File

@@ -1284,7 +1284,7 @@ public class GameAction {
AllZone.getComputerPlayer().getZone(Zone.Battlefield).add(c); AllZone.getComputerPlayer().getZone(Zone.Battlefield).add(c);
c.setSickness(true); c.setSickness(true);
} }
Constant.Quest.fantasyQuest[0] = true; Constant.Quest.FANTASY_QUEST[0] = true;
} }
private boolean Start_Cut = false; private boolean Start_Cut = false;
@@ -1302,7 +1302,7 @@ public class GameAction {
public final void newGame(final Deck humanDeck, final Deck computerDeck) { public final void newGame(final Deck humanDeck, final Deck computerDeck) {
// AllZone.getComputer() = new ComputerAI_Input(new // AllZone.getComputer() = new ComputerAI_Input(new
// ComputerAI_General()); // ComputerAI_General());
Constant.Quest.fantasyQuest[0] = false; Constant.Quest.FANTASY_QUEST[0] = false;
AllZone.newGameCleanup(); AllZone.newGameCleanup();
canShowWinLose = true; canShowWinLose = true;
@@ -1313,7 +1313,7 @@ public class GameAction {
CardFactoryInterface c = AllZone.getCardFactory(); CardFactoryInterface c = AllZone.getCardFactory();
Card.resetUniqueNumber(); Card.resetUniqueNumber();
boolean canRandomFoil = Constant.Runtime.RndCFoil[0] boolean canRandomFoil = Constant.Runtime.RndCFoil[0]
&& Constant.Runtime.gameType.equals(GameType.Constructed); && Constant.Runtime.getGameType().equals(GameType.Constructed);
Random generator = MyRandom.random; Random generator = MyRandom.random;
for (Entry<CardPrinted, Integer> stackOfCards : humanDeck.getMain()) { for (Entry<CardPrinted, Integer> stackOfCards : humanDeck.getMain()) {
CardPrinted cardPrinted = stackOfCards.getKey(); CardPrinted cardPrinted = stackOfCards.getKey();
@@ -1403,7 +1403,7 @@ public class GameAction {
} }
// do this instead of shuffling Computer's deck // do this instead of shuffling Computer's deck
boolean smoothLand = Constant.Runtime.Smooth[0]; boolean smoothLand = Constant.Runtime.SMOOTH[0];
if (smoothLand) { if (smoothLand) {
Card[] c1 = smoothComputerManaCurve(AllZone.getComputerPlayer().getCardsIn(Zone.Library).toArray()); Card[] c1 = smoothComputerManaCurve(AllZone.getComputerPlayer().getCardsIn(Zone.Library).toArray());
@@ -1640,9 +1640,9 @@ public class GameAction {
public final void seeWhoPlaysFirst() { public final void seeWhoPlaysFirst() {
CardList HLibrary = AllZone.getHumanPlayer().getCardsIn(Zone.Library); CardList HLibrary = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
HLibrary = HLibrary.filter(CardListFilter.nonlands); HLibrary = HLibrary.filter(CardListFilter.NON_LANDS);
CardList CLibrary = AllZone.getComputerPlayer().getCardsIn(Zone.Library); CardList CLibrary = AllZone.getComputerPlayer().getCardsIn(Zone.Library);
CLibrary = CLibrary.filter(CardListFilter.nonlands); CLibrary = CLibrary.filter(CardListFilter.NON_LANDS);
boolean Starter_Determined = false; boolean Starter_Determined = false;
int Cut_Count = 0; int Cut_Count = 0;
@@ -2452,7 +2452,7 @@ public class GameAction {
if (originalCard.getName().equals("Khalni Hydra") && spell.isSpell()) { if (originalCard.getName().equals("Khalni Hydra") && spell.isSpell()) {
Player player = AllZone.getPhase().getPlayerTurn(); Player player = AllZone.getPhase().getPlayerTurn();
CardList playerCreature = AllZoneUtil.getCreaturesInPlay(player); CardList playerCreature = AllZoneUtil.getCreaturesInPlay(player);
playerCreature = playerCreature.filter(CardListFilter.green); playerCreature = playerCreature.filter(CardListFilter.GREEN);
String manaC = manaCost + " "; String manaC = manaCost + " ";
if (playerCreature.size() > 0) { if (playerCreature.size() > 0) {
for (int i = 0; i < playerCreature.size(); i++) { for (int i = 0; i < playerCreature.size(); i++) {

View File

@@ -803,7 +803,7 @@ public final class GameActionUtil {
public void resolve() { public void resolve() {
for (int i = 0; i < damage; i++) { for (int i = 0; i < damage; i++) {
CardList nonTokens = player.getCardsIn(Zone.Battlefield); CardList nonTokens = player.getCardsIn(Zone.Battlefield);
nonTokens = nonTokens.filter(CardListFilter.nonToken); nonTokens = nonTokens.filter(CardListFilter.NON_TOKEN);
if (nonTokens.size() == 0) { if (nonTokens.size() == 0) {
player.loseConditionMet(GameLossReason.SpellEffect, lich.getName()); player.loseConditionMet(GameLossReason.SpellEffect, lich.getName());
} else { } else {
@@ -1471,7 +1471,7 @@ public final class GameActionUtil {
produces.put("Swamp", "B"); produces.put("Swamp", "B");
CardList lands = AllZoneUtil.getCardsInGame(); CardList lands = AllZoneUtil.getCardsInGame();
lands = lands.filter(CardListFilter.lands); lands = lands.filter(CardListFilter.LANDS);
// remove all abilities granted by this Command // remove all abilities granted by this Command
for (Card land : lands) { for (Card land : lands) {

View File

@@ -249,7 +249,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
devMenu.setEnabled(Constant.Runtime.DevMode[0]); devMenu.setEnabled(Constant.Runtime.DevMode[0]);
if (Constant.Runtime.DevMode[0]) { if (Constant.Runtime.DevMode[0]) {
canLoseByDecking.setSelected(Constant.Runtime.Mill[0]); canLoseByDecking.setSelected(Constant.Runtime.MILL[0]);
Action viewAIHand = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Hand), COMPUTER_HAND.BASE); Action viewAIHand = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Hand), COMPUTER_HAND.BASE);
Action viewAILibrary = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Library), Action viewAILibrary = new ZoneAction(AllZone.getComputerPlayer().getZone(Zone.Library),
@@ -1429,11 +1429,11 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
if (turn.isComputer()) { if (turn.isComputer()) {
if (phase.equals(Constant.Phase.End_Of_Turn)) { if (phase.equals(Constant.Phase.End_Of_Turn)) {
return cbAIEndOfTurn.isSelected(); return cbAIEndOfTurn.isSelected();
} else if (phase.equals(Constant.Phase.Upkeep)) { } else if (phase.equals(Constant.Phase.UPKEEP)) {
return cbAIUpkeep.isSelected(); return cbAIUpkeep.isSelected();
} else if (phase.equals(Constant.Phase.Draw)) { } else if (phase.equals(Constant.Phase.DRAW)) {
return cbAIDraw.isSelected(); return cbAIDraw.isSelected();
} else if (phase.equals(Constant.Phase.Combat_Begin)) { } else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
return cbAIBeginCombat.isSelected(); return cbAIBeginCombat.isSelected();
} else if (phase.equals(Constant.Phase.Combat_End)) { } else if (phase.equals(Constant.Phase.Combat_End)) {
return cbAIEndCombat.isSelected(); return cbAIEndCombat.isSelected();
@@ -1441,11 +1441,11 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
} else { } else {
if (phase.equals(Constant.Phase.End_Of_Turn)) { if (phase.equals(Constant.Phase.End_Of_Turn)) {
return cbHumanEndOfTurn.isSelected(); return cbHumanEndOfTurn.isSelected();
} else if (phase.equals(Constant.Phase.Upkeep)) { } else if (phase.equals(Constant.Phase.UPKEEP)) {
return cbHumanUpkeep.isSelected(); return cbHumanUpkeep.isSelected();
} else if (phase.equals(Constant.Phase.Draw)) { } else if (phase.equals(Constant.Phase.DRAW)) {
return cbHumanDraw.isSelected(); return cbHumanDraw.isSelected();
} else if (phase.equals(Constant.Phase.Combat_Begin)) { } else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
return cbHumanBeginCombat.isSelected(); return cbHumanBeginCombat.isSelected();
} else if (phase.equals(Constant.Phase.Combat_End)) { } else if (phase.equals(Constant.Phase.Combat_End)) {
return cbHumanEndCombat.isSelected(); return cbHumanEndCombat.isSelected();
@@ -1489,7 +1489,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
* @return a boolean. * @return a boolean.
*/ */
public final boolean savePrefs() { public final boolean savePrefs() {
Constant.Runtime.Mill[0] = canLoseByDecking.isSelected(); Constant.Runtime.MILL[0] = canLoseByDecking.isSelected();
ForgePreferences fp = Singletons.getModel().getPreferences(); ForgePreferences fp = Singletons.getModel().getPreferences();
fp.bAIUpkeep = cbAIUpkeep.isSelected(); fp.bAIUpkeep = cbAIUpkeep.isSelected();
@@ -1662,16 +1662,16 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
private static final long serialVersionUID = 9874492387239847L; private static final long serialVersionUID = 9874492387239847L;
public void actionPerformed(final ActionEvent e) { public void actionPerformed(final ActionEvent e) {
if (Constant.Runtime.HumanDeck[0].countMain() > 1) { if (Constant.Runtime.HUMAN_DECK[0].countMain() > 1) {
HashMap<String, Integer> deckMap = new HashMap<String, Integer>(); HashMap<String, Integer> deckMap = new HashMap<String, Integer>();
for (Entry<CardPrinted, Integer> s : Constant.Runtime.HumanDeck[0].getMain()) { for (Entry<CardPrinted, Integer> s : Constant.Runtime.HUMAN_DECK[0].getMain()) {
deckMap.put(s.getKey().getName(), s.getValue()); deckMap.put(s.getKey().getName(), s.getValue());
} }
String nl = System.getProperty("line.separator"); String nl = System.getProperty("line.separator");
StringBuilder deckList = new StringBuilder(); StringBuilder deckList = new StringBuilder();
String dName = Constant.Runtime.HumanDeck[0].getName(); String dName = Constant.Runtime.HUMAN_DECK[0].getName();
if (dName == null) { if (dName == null) {
dName = ""; dName = "";

View File

@@ -152,7 +152,7 @@ public class HumanPlayer extends Player {
* *
* @see forge.Player#discard_Chains_of_Mephistopheles() * @see forge.Player#discard_Chains_of_Mephistopheles()
*/ */
protected final void discard_Chains_of_Mephistopheles() { protected final void discardChainsOfMephistopheles() {
AllZone.getInputControl().setInput(PlayerUtil.input_chainsDiscard(), true); AllZone.getInputControl().setInput(PlayerUtil.input_chainsDiscard(), true);
} }

View File

@@ -737,7 +737,7 @@ public class MagicStack extends MyObservable {
if (sp.isSpell() && AllZoneUtil.isCardInPlay("Bazaar of Wonders")) { if (sp.isSpell() && AllZoneUtil.isCardInPlay("Bazaar of Wonders")) {
boolean found = false; boolean found = false;
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield); CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
all = all.filter(CardListFilter.nonToken); all = all.filter(CardListFilter.NON_TOKEN);
CardList graves = AllZoneUtil.getCardsIn(Zone.Graveyard); CardList graves = AllZoneUtil.getCardsIn(Zone.Graveyard);
all.addAll(graves); all.addAll(graves);

View File

@@ -239,8 +239,8 @@ public class Phase extends MyObservable implements java.io.Serializable {
} }
/** The phase order. */ /** The phase order. */
String[] phaseOrder = { Constant.Phase.Untap, Constant.Phase.Upkeep, Constant.Phase.Draw, Constant.Phase.Main1, 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_BEGIN, Constant.Phase.Combat_Declare_Attackers,
Constant.Phase.Combat_Declare_Attackers_InstantAbility, Constant.Phase.Combat_Declare_Blockers, Constant.Phase.Combat_Declare_Attackers_InstantAbility, Constant.Phase.Combat_Declare_Blockers,
Constant.Phase.Combat_Declare_Blockers_InstantAbility, Constant.Phase.Combat_FirstStrikeDamage, 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.Combat_Damage, Constant.Phase.Combat_End, Constant.Phase.Main2, Constant.Phase.End_Of_Turn,
@@ -299,13 +299,13 @@ public class Phase extends MyObservable implements java.io.Serializable {
AllZone.getPhase().setSkipPhase(true); AllZone.getPhase().setSkipPhase(true);
AllZone.getGameAction().checkStateEffects(); AllZone.getGameAction().checkStateEffects();
if (phase.equals(Constant.Phase.Untap)) { if (phase.equals(Constant.Phase.UNTAP)) {
PhaseUtil.handleUntap(); PhaseUtil.handleUntap();
} else if (phase.equals(Constant.Phase.Upkeep)) { } else if (phase.equals(Constant.Phase.UPKEEP)) {
PhaseUtil.handleUpkeep(); PhaseUtil.handleUpkeep();
} else if (phase.equals(Constant.Phase.Draw)) { } else if (phase.equals(Constant.Phase.DRAW)) {
PhaseUtil.handleDraw(); PhaseUtil.handleDraw();
} else if (phase.equals(Constant.Phase.Combat_Begin)) { } else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
PhaseUtil.verifyCombat(); PhaseUtil.verifyCombat();
} else if (phase.equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)) { } else if (phase.equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)) {
if (inCombat()) { if (inCombat()) {
@@ -407,7 +407,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
// This line fixes Combat Damage triggers not going off when they should // This line fixes Combat Damage triggers not going off when they should
AllZone.getStack().unfreezeStack(); AllZone.getStack().unfreezeStack();
if (!phase.equals(Constant.Phase.Untap)) { if (!phase.equals(Constant.Phase.UNTAP)) {
// during untap // during untap
resetPriority(); resetPriority();
} }
@@ -450,7 +450,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
if (getPhase().equals(Constant.Phase.Combat_Declare_Attackers)) { if (getPhase().equals(Constant.Phase.Combat_Declare_Attackers)) {
AllZone.getStack().unfreezeStack(); AllZone.getStack().unfreezeStack();
nCombatsThisTurn++; nCombatsThisTurn++;
} else if (getPhase().equals(Constant.Phase.Untap)) { } else if (getPhase().equals(Constant.Phase.UNTAP)) {
nCombatsThisTurn = 0; nCombatsThisTurn = 0;
} }
@@ -497,7 +497,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
// **** Anything BELOW Here is actually in the next phase. Maybe move // **** Anything BELOW Here is actually in the next phase. Maybe move
// this to handleBeginPhase // this to handleBeginPhase
if (getPhase().equals(Constant.Phase.Untap)) { if (getPhase().equals(Constant.Phase.UNTAP)) {
turn++; turn++;
} }
@@ -874,7 +874,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
public static boolean canCastSorcery(final Player player) { public static boolean canCastSorcery(final Player player) {
return AllZone.getPhase().isPlayerTurn(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; .equals(Constant.Phase.MAIN1)) && AllZone.getStack().size() == 0;
} }
/** /**

View File

@@ -65,7 +65,7 @@ public class PhaseUtil {
AllZone.getGameAction().resetActivationsPerTurn(); AllZone.getGameAction().resetActivationsPerTurn();
CardList lands = AllZoneUtil.getPlayerLandsInPlay(turn).filter(CardListFilter.untapped); CardList lands = AllZoneUtil.getPlayerLandsInPlay(turn).filter(CardListFilter.UNTAPPED);
turn.setNumPowerSurgeLands(lands.size()); turn.setNumPowerSurgeLands(lands.size());
// anything before this point happens regardless of whether the Untap // anything before this point happens regardless of whether the Untap
@@ -217,7 +217,7 @@ public class PhaseUtil {
if (AllZone.getPhase().getPlayerTurn().isComputer()) { if (AllZone.getPhase().getPlayerTurn().isComputer()) {
// search for lands the computer has and only untap 1 // search for lands the computer has and only untap 1
CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer()); CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
landList = landList.filter(CardListFilter.tapped).filter(new CardListFilter() { landList = landList.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
@Override @Override
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return canUntap(c); return canUntap(c);
@@ -247,7 +247,7 @@ public class PhaseUtil {
}// selectCard() }// selectCard()
};// Input };// Input
CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()); CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
landList = landList.filter(CardListFilter.tapped).filter(new CardListFilter() { landList = landList.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
@Override @Override
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return canUntap(c); return canUntap(c);
@@ -261,8 +261,8 @@ public class PhaseUtil {
if (AllZoneUtil.isCardInPlay("Damping Field") || AllZoneUtil.isCardInPlay("Imi Statue")) { if (AllZoneUtil.isCardInPlay("Damping Field") || AllZoneUtil.isCardInPlay("Imi Statue")) {
if (AllZone.getPhase().getPlayerTurn().isComputer()) { if (AllZone.getPhase().getPlayerTurn().isComputer()) {
CardList artList = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); CardList artList = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
artList = artList.filter(CardListFilter.artifacts); artList = artList.filter(CardListFilter.ARTIFACTS);
artList = artList.filter(CardListFilter.tapped).filter(new CardListFilter() { artList = artList.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
@Override @Override
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return canUntap(c); return canUntap(c);
@@ -293,8 +293,8 @@ public class PhaseUtil {
}// selectCard() }// selectCard()
};// Input };// Input
CardList artList = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield); CardList artList = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
artList = artList.filter(CardListFilter.artifacts); artList = artList.filter(CardListFilter.ARTIFACTS);
artList = artList.filter(CardListFilter.tapped).filter(new CardListFilter() { artList = artList.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
@Override @Override
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return canUntap(c); return canUntap(c);
@@ -308,7 +308,7 @@ public class PhaseUtil {
if ((AllZoneUtil.isCardInPlay("Smoke") || AllZoneUtil.isCardInPlay("Stoic Angel"))) { if ((AllZoneUtil.isCardInPlay("Smoke") || AllZoneUtil.isCardInPlay("Stoic Angel"))) {
if (AllZone.getPhase().getPlayerTurn().isComputer()) { if (AllZone.getPhase().getPlayerTurn().isComputer()) {
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
creatures = creatures.filter(CardListFilter.tapped).filter(new CardListFilter() { creatures = creatures.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
@Override @Override
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return canUntap(c); return canUntap(c);
@@ -339,7 +339,7 @@ public class PhaseUtil {
}// selectCard() }// selectCard()
};// Input };// Input
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
creatures = creatures.filter(CardListFilter.tapped).filter(new CardListFilter() { creatures = creatures.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
@Override @Override
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return canUntap(c); return canUntap(c);
@@ -617,8 +617,8 @@ public class PhaseUtil {
*/ */
public static boolean isBeforeAttackersAreDeclared() { public static boolean isBeforeAttackersAreDeclared() {
String phase = AllZone.getPhase().getPhase(); String phase = AllZone.getPhase().getPhase();
return phase.equals(Constant.Phase.Untap) || phase.equals(Constant.Phase.Upkeep) return phase.equals(Constant.Phase.UNTAP) || phase.equals(Constant.Phase.UPKEEP)
|| phase.equals(Constant.Phase.Draw) || phase.equals(Constant.Phase.Main1) || phase.equals(Constant.Phase.DRAW) || phase.equals(Constant.Phase.MAIN1)
|| phase.equals(Constant.Phase.Combat_Begin); || phase.equals(Constant.Phase.COMBAT_BEGIN);
} }
} }

View File

@@ -30,67 +30,67 @@ import forge.game.GameLossReason;
public abstract class Player extends GameEntity { public abstract class Player extends GameEntity {
/** The poison counters. */ /** The poison counters. */
protected int poisonCounters; private int poisonCounters;
/** The life. */ /** The life. */
protected int life; private int life;
/** The assigned damage. */ /** The assigned damage. */
protected int assignedDamage; private int assignedDamage;
/** The num power surge lands. */ /** The num power surge lands. */
protected int numPowerSurgeLands; private int numPowerSurgeLands;
/** The alt win. */ /** The alt win. */
protected boolean altWin = false; private boolean altWin = false;
/** The alt win source name. */ /** The alt win source name. */
protected String altWinSourceName; private String altWinSourceName;
/** The alt lose. */ /** The alt lose. */
protected boolean altLose = false; private boolean altLose = false;
/** The loss state. */ /** The loss state. */
protected GameLossReason lossState = GameLossReason.DidNotLoseYet; private GameLossReason lossState = GameLossReason.DidNotLoseYet;
/** The lose condition spell. */ /** The lose condition spell. */
protected String loseConditionSpell; private String loseConditionSpell;
/** The n turns. */ /** The n turns. */
protected int nTurns = 0; private int nTurns = 0;
/** The skip next untap. */ /** The skip next untap. */
protected boolean skipNextUntap = false; private boolean skipNextUntap = false;
/** The prowl. */ /** The prowl. */
protected ArrayList<String> prowl = new ArrayList<String>(); private ArrayList<String> prowl = new ArrayList<String>();
/** The max lands to play. */ /** The max lands to play. */
protected int maxLandsToPlay = 1; private int maxLandsToPlay = 1;
/** The num lands played. */ /** The num lands played. */
protected int numLandsPlayed = 0; private int numLandsPlayed = 0;
/** The last drawn card. */ /** The last drawn card. */
protected Card lastDrawnCard; private Card lastDrawnCard;
/** The num drawn this turn. */ /** The num drawn this turn. */
protected int numDrawnThisTurn = 0; private int numDrawnThisTurn = 0;
/** The slowtrip list. */ /** The slowtrip list. */
protected CardList slowtripList = new CardList(); private CardList slowtripList = new CardList();
/** The keywords. */ /** The keywords. */
protected ArrayList<String> keywords = new ArrayList<String>(); private ArrayList<String> keywords = new ArrayList<String>();
/** The mana pool. */ /** The mana pool. */
protected ManaPool manaPool = null; private ManaPool manaPool = null;
/** The must attack entity. */ /** The must attack entity. */
protected Object mustAttackEntity = null; private Object mustAttackEntity = null;
/** The zones. */ /** The zones. */
Map<Constant.Zone, PlayerZone> zones = new EnumMap<Constant.Zone, PlayerZone>(Constant.Zone.class); private Map<Constant.Zone, PlayerZone> zones = new EnumMap<Constant.Zone, PlayerZone>(Constant.Zone.class);
/** The Constant ALL_ZONES. */ /** The Constant ALL_ZONES. */
public static final List<Zone> ALL_ZONES = Collections.unmodifiableList(Arrays.asList(Zone.Battlefield, public static final List<Zone> ALL_ZONES = Collections.unmodifiableList(Arrays.asList(Zone.Battlefield,
@@ -473,8 +473,9 @@ public abstract class Player extends GameEntity {
if (isCombat) { if (isCombat) {
ArrayList<String> types = source.getType(); ArrayList<String> types = source.getType();
for (String type : types) for (String type : types) {
source.getController().addProwlType(type); source.getController().addProwlType(type);
}
} }
// Run triggers // Run triggers
@@ -906,6 +907,10 @@ public abstract class Player extends GameEntity {
* *
* @see forge.GameEntity#hasKeyword(java.lang.String) * @see forge.GameEntity#hasKeyword(java.lang.String)
*/ */
/**
* @param keyword String
* @return boolean
*/
public final boolean hasKeyword(final String keyword) { public final boolean hasKeyword(final String keyword) {
return this.keywords.contains(keyword); return this.keywords.contains(keyword);
} }
@@ -1061,7 +1066,7 @@ public abstract class Player extends GameEntity {
if (!firstFromDraw && AllZoneUtil.isCardInPlay("Chains of Mephistopheles")) { if (!firstFromDraw && AllZoneUtil.isCardInPlay("Chains of Mephistopheles")) {
if (!this.getZone(Zone.Hand).isEmpty()) { if (!this.getZone(Zone.Hand).isEmpty()) {
if (isHuman()) { if (isHuman()) {
discard_Chains_of_Mephistopheles(); discardChainsOfMephistopheles();
} else { // Computer } else { // Computer
discard(1, null, false); discard(1, null, false);
// true causes this code not to be run again // true causes this code not to be run again
@@ -1225,7 +1230,7 @@ public abstract class Player extends GameEntity {
} }
} }
return dredge; return dredge;
}// hasDredge() } // hasDredge()
/** /**
* <p> * <p>
@@ -1246,7 +1251,7 @@ public abstract class Player extends GameEntity {
} }
throw new RuntimeException("Input_Draw : getDredgeNumber() card doesn't have dredge - " + c.getName()); throw new RuntimeException("Input_Draw : getDredgeNumber() card doesn't have dredge - " + c.getName());
}// getDredgeNumber() } // getDredgeNumber()
/** /**
* <p> * <p>
@@ -1277,7 +1282,7 @@ public abstract class Player extends GameEntity {
/** /**
* Discard_ chains_of_ mephistopheles. * Discard_ chains_of_ mephistopheles.
*/ */
protected abstract void discard_Chains_of_Mephistopheles(); protected abstract void discardChainsOfMephistopheles();
/** /**
* <p> * <p>
@@ -1348,19 +1353,24 @@ public abstract class Player extends GameEntity {
sa.getSourceCard().getController().loseLife(5, c); sa.getSourceCard().getController().loseLife(5, c);
} }
}; };
ability.setStackDescription(c.getName() + " - " + sa.getSourceCard().getController() + " loses 5 life."); ability.setStackDescription(c.getName() + " - "
+ sa.getSourceCard().getController() + " loses 5 life.");
AllZone.getStack().add(ability); AllZone.getStack().add(ability);
} }
} }
AllZone.getGameAction().discard_madness(c); AllZone.getGameAction().discard_madness(c);
if ((c.hasKeyword("If a spell or ability an opponent controls causes you to discard CARDNAME, put it onto the battlefield instead of putting it into your graveyard.") || c if ((c.hasKeyword("If a spell or ability an opponent controls causes "
.hasKeyword("If a spell or ability an opponent controls causes you to discard CARDNAME, put it onto the battlefield with two +1/+1 counters on it instead of putting it into your graveyard.")) + "you to discard CARDNAME, put it onto the battlefield instead of putting it into your graveyard.")
|| c.hasKeyword("If a spell or ability an opponent controls causes "
+ "you to discard CARDNAME, put it onto the battlefield with two +1/+1 "
+ "counters on it instead of putting it into your graveyard."))
&& null != sa && !c.getController().equals(sa.getSourceCard().getController())) { && null != sa && !c.getController().equals(sa.getSourceCard().getController())) {
AllZone.getGameAction().discard_PutIntoPlayInstead(c); AllZone.getGameAction().discard_PutIntoPlayInstead(c);
} else if (c } else if (c
.hasKeyword("If a spell or ability an opponent controls causes you to discard CARDNAME, return it to your hand.")) { .hasKeyword("If a spell or ability an opponent controls "
+ "causes you to discard CARDNAME, return it to your hand.")) {
} else { } else {
AllZone.getGameAction().moveToGraveyard(c); AllZone.getGameAction().moveToGraveyard(c);
} }
@@ -1376,7 +1386,7 @@ public abstract class Player extends GameEntity {
runParams.put("Cause", cause); runParams.put("Cause", cause);
AllZone.getTriggerHandler().runTrigger("Discarded", runParams); AllZone.getTriggerHandler().runTrigger("Discarded", runParams);
}// end doDiscard } // end doDiscard
/** /**
* <p> * <p>
@@ -1558,7 +1568,7 @@ public abstract class Player extends GameEntity {
runParams.put("Player", this); runParams.put("Player", this);
AllZone.getTriggerHandler().runTrigger("Shuffled", runParams); AllZone.getTriggerHandler().runTrigger("Shuffled", runParams);
}// shuffle } // shuffle
// ////////////////////////////// // //////////////////////////////
// ////////////////////////////// // //////////////////////////////
@@ -1569,10 +1579,10 @@ public abstract class Player extends GameEntity {
* *
* @param topN * @param topN
* a {@link forge.CardList} object. * a {@link forge.CardList} object.
* @param N * @param n
* a int. * a int.
*/ */
protected abstract void doScry(CardList topN, int N); protected abstract void doScry(CardList topN, int n);
/** /**
* <p> * <p>
@@ -2129,9 +2139,9 @@ public abstract class Player extends GameEntity {
* @see forge.GameEntity#isValid(java.lang.String, forge.Player, forge.Card) * @see forge.GameEntity#isValid(java.lang.String, forge.Player, forge.Card)
*/ */
@Override @Override
public final boolean isValid(final String Restriction, final Player sourceController, final Card source) { public final boolean isValid(final String restriction, final Player sourceController, final Card source) {
String[] incR = Restriction.split("\\."); String[] incR = restriction.split("\\.");
if (!incR[0].equals("Player") && !(incR[0].equals("Opponent") && !this.equals(sourceController)) if (!incR[0].equals("Player") && !(incR[0].equals("Opponent") && !this.equals(sourceController))
&& !(incR[0].equals("You") && this.equals(sourceController))) { && !(incR[0].equals("You") && this.equals(sourceController))) {
@@ -2142,7 +2152,7 @@ public abstract class Player extends GameEntity {
final String excR = incR[1]; final String excR = incR[1];
String[] exR = excR.split("\\+"); // Exclusive Restrictions are ... String[] exR = excR.split("\\+"); // Exclusive Restrictions are ...
for (int j = 0; j < exR.length; j++) { for (int j = 0; j < exR.length; j++) {
if (hasProperty(exR[j], sourceController, source) == false) { if (!hasProperty(exR[j], sourceController, source)) {
return false; return false;
} }
} }
@@ -2158,13 +2168,13 @@ public abstract class Player extends GameEntity {
* forge.Card) * forge.Card)
*/ */
@Override @Override
public final boolean hasProperty(final String Property, final Player sourceController, final Card source) { public final boolean hasProperty(final String property, final Player sourceController, final Card source) {
if (Property.equals("You")) { if (property.equals("You")) {
if (!this.equals(sourceController)) { if (!this.equals(sourceController)) {
return false; return false;
} }
} else if (Property.equals("Opponent")) { } else if (property.equals("Opponent")) {
if (this.equals(sourceController)) { if (this.equals(sourceController)) {
return false; return false;
} }
@@ -2263,8 +2273,8 @@ public abstract class Player extends GameEntity {
handSizeOperations.clear(); handSizeOperations.clear();
} }
/** Constant <code>NextHandSizeStamp=0</code> */ /** Constant <code>NextHandSizeStamp=0</code>. */
private static int NextHandSizeStamp = 0; private static int nextHandSizeStamp = 0;
/** /**
* <p> * <p>
@@ -2274,7 +2284,7 @@ public abstract class Player extends GameEntity {
* @return a int. * @return a int.
*/ */
public static int getHandSizeStamp() { public static int getHandSizeStamp() {
return NextHandSizeStamp++; return nextHandSizeStamp++;
} }
/** /**

View File

@@ -133,7 +133,7 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone {
@Override @Override
public void resolve() { public void resolve() {
CardList lands = tisLand.getController().getCardsIn(Zone.Battlefield); CardList lands = tisLand.getController().getCardsIn(Zone.Battlefield);
lands = lands.filter(CardListFilter.lands); lands = lands.filter(CardListFilter.LANDS);
for (Card land : lands) { for (Card land : lands) {
land.tap(); land.tap();
} }

View File

@@ -201,7 +201,7 @@ public class Upkeep implements java.io.Serializable {
final Card c = list.get(i); final Card c = list.get(i);
if (c.getIntrinsicKeyword().contains("(Echo unpaid)")) { if (c.getIntrinsicKeyword().contains("(Echo unpaid)")) {
final Command paidCommand = Command.Blank; final Command paidCommand = Command.BLANK;
final Command unpaidCommand = new Command() { final Command unpaidCommand = new Command() {
private static final long serialVersionUID = -7354791599039157375L; private static final long serialVersionUID = -7354791599039157375L;
@@ -325,7 +325,7 @@ public class Upkeep implements java.io.Serializable {
} }
}; };
final Command paidCommand = Command.Blank; final Command paidCommand = Command.BLANK;
final Ability aiPaid = upkeepAIPayment(c, upkeepCost); final Ability aiPaid = upkeepAIPayment(c, upkeepCost);
@@ -381,7 +381,7 @@ public class Upkeep implements java.io.Serializable {
} }
}; };
final Command paidCommand = Command.Blank; final Command paidCommand = Command.BLANK;
final Ability aiPaid = upkeepAIPayment(c, upkeepCost); final Ability aiPaid = upkeepAIPayment(c, upkeepCost);
@@ -422,7 +422,7 @@ public class Upkeep implements java.io.Serializable {
} }
}; };
final Command paidCommand = Command.Blank; final Command paidCommand = Command.BLANK;
final Ability aiPaid = upkeepAIPayment(c, upkeepCost); final Ability aiPaid = upkeepAIPayment(c, upkeepCost);
@@ -564,7 +564,7 @@ public class Upkeep implements java.io.Serializable {
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
private static CardList abyss_getTargets(final Player player, final Card card) { private static CardList abyss_getTargets(final Player player, final Card card) {
CardList creats = AllZoneUtil.getCreaturesInPlay(player).filter(CardListFilter.nonartifacts); CardList creats = AllZoneUtil.getCreaturesInPlay(player).filter(CardListFilter.NON_ARTIFACTS);
creats = creats.getTargetableCards(card); creats = creats.getTargetableCards(card);
return creats; return creats;
} }
@@ -588,7 +588,7 @@ public class Upkeep implements java.io.Serializable {
final Ability sacrificeArtifact = new Ability(c, "") { final Ability sacrificeArtifact = new Ability(c, "") {
@Override @Override
public void resolve() { public void resolve() {
CardList artifacts = player.getCardsIn(Zone.Battlefield).filter(CardListFilter.artifacts); CardList artifacts = player.getCardsIn(Zone.Battlefield).filter(CardListFilter.ARTIFACTS);
if (player.isHuman()) { if (player.isHuman()) {
AllZone.getInputControl().setInput(new Input() { AllZone.getInputControl().setInput(new Input() {
@@ -836,7 +836,7 @@ public class Upkeep implements java.io.Serializable {
StringBuilder cost = new StringBuilder(); StringBuilder cost = new StringBuilder();
cost.append("Pay cost for ").append(c).append("\r\n"); cost.append("Pay cost for ").append(c).append("\r\n");
GameActionUtil.payManaDuringAbilityResolve(cost.toString(), noPay.getManaCost(), GameActionUtil.payManaDuringAbilityResolve(cost.toString(), noPay.getManaCost(),
Command.Blank, Command.Blank); Command.BLANK, Command.BLANK);
} }
} // end resolve() } // end resolve()
}; // end pay ability }; // end pay ability
@@ -2347,8 +2347,8 @@ public class Upkeep implements java.io.Serializable {
public void resolve() { public void resolve() {
int gain = 0; int gain = 0;
CardList play = player.getCardsIn(Zone.Battlefield); CardList play = player.getCardsIn(Zone.Battlefield);
CardList black = play.filter(CardListFilter.black); CardList black = play.filter(CardListFilter.BLACK);
CardList red = play.filter(CardListFilter.red); CardList red = play.filter(CardListFilter.RED);
if (black.size() > 0 && red.size() > 0) { if (black.size() > 0 && red.size() > 0) {
gain = 4; gain = 4;
} else if (black.size() > 0 || red.size() > 0) { } else if (black.size() > 0 || red.size() > 0) {
@@ -2384,8 +2384,8 @@ public class Upkeep implements java.io.Serializable {
public void resolve() { public void resolve() {
int draw = 0; int draw = 0;
CardList play = player.getCardsIn(Zone.Battlefield); CardList play = player.getCardsIn(Zone.Battlefield);
CardList green = play.filter(CardListFilter.green); CardList green = play.filter(CardListFilter.GREEN);
CardList red = play.filter(CardListFilter.red); CardList red = play.filter(CardListFilter.RED);
if (green.size() > 0 && red.size() > 0) { if (green.size() > 0 && red.size() > 0) {
draw = 2; draw = 2;

View File

@@ -301,7 +301,7 @@ public final class AbilityFactory_Animate {
// don't use instant speed animate abilities outside computers // don't use instant speed animate abilities outside computers
// Combat_Begin step // Combat_Begin step
if (!AllZone.getPhase().is(Constant.Phase.Combat_Begin) if (!AllZone.getPhase().is(Constant.Phase.COMBAT_BEGIN)
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer()) && !AbilityFactory.isSorcerySpeed(sa) && AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer()) && !AbilityFactory.isSorcerySpeed(sa)
&& !params.containsKey("ActivationPhases") && !params.containsKey("Permanent")) { && !params.containsKey("ActivationPhases") && !params.containsKey("Permanent")) {
return false; return false;

View File

@@ -847,7 +847,7 @@ public class AbilityFactory_Attach {
} }
if (AbilityFactory.isSorcerySpeed(sa)) { if (AbilityFactory.isSorcerySpeed(sa)) {
if (AllZone.getPhase().is(Constant.Phase.Main1)) { if (AllZone.getPhase().is(Constant.Phase.MAIN1)) {
chance = r.nextFloat() <= .75; chance = r.nextFloat() <= .75;
} else { } else {
// Don't Attach Sorcery Speed stuff after Main1 // Don't Attach Sorcery Speed stuff after Main1

View File

@@ -2004,7 +2004,7 @@ public final class AbilityFactory_ChangeZone {
} }
// Don't cast during main1? // Don't cast during main1?
if (AllZone.getPhase().is(Constant.Phase.Main1, AllZone.getComputerPlayer())) { if (AllZone.getPhase().is(Constant.Phase.MAIN1, AllZone.getComputerPlayer())) {
return false; return false;
} }
} else if (origin.equals(Zone.Graveyard)) { } else if (origin.equals(Zone.Graveyard)) {

View File

@@ -214,7 +214,7 @@ public final class AbilityFactory_Copy {
// TODO - I'm sure someone can do this AI better // TODO - I'm sure someone can do this AI better
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
if (params.containsKey("AtEOT") && !AllZone.getPhase().is(Constant.Phase.Main1)) { if (params.containsKey("AtEOT") && !AllZone.getPhase().is(Constant.Phase.MAIN1)) {
return false; return false;
} else { } else {
double chance = .4; // 40 percent chance with instant speed stuff double chance = .4; // 40 percent chance with instant speed stuff
@@ -276,7 +276,7 @@ public final class AbilityFactory_Copy {
} }
Card choice; Card choice;
if (list.filter(CardListFilter.creatures).size() > 0) { if (list.filter(CardListFilter.CREATURES).size() > 0) {
choice = CardFactoryUtil.AI_getBestCreature(list); choice = CardFactoryUtil.AI_getBestCreature(list);
} else { } else {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, source, true); choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, source, true);

View File

@@ -271,7 +271,7 @@ public final class AbilityFactory_Debuff {
SpellAbility_Restriction restrict = sa.getRestrictions(); SpellAbility_Restriction restrict = sa.getRestrictions();
// Phase Restrictions // Phase Restrictions
if (AllZone.getStack().size() == 0 && AllZone.getPhase().isBefore(Constant.Phase.Combat_Begin)) { if (AllZone.getStack().size() == 0 && AllZone.getPhase().isBefore(Constant.Phase.COMBAT_BEGIN)) {
// Instant-speed pumps should not be cast outside of combat when the // Instant-speed pumps should not be cast outside of combat when the
// stack is empty // stack is empty
if (!AbilityFactory.isSorcerySpeed(sa)) { if (!AbilityFactory.isSorcerySpeed(sa)) {
@@ -733,7 +733,7 @@ public final class AbilityFactory_Debuff {
}); });
// don't use DebuffAll after Combat_Begin until AI is improved // don't use DebuffAll after Combat_Begin until AI is improved
if (AllZone.getPhase().isAfter(Constant.Phase.Combat_Begin)) { if (AllZone.getPhase().isAfter(Constant.Phase.COMBAT_BEGIN)) {
return false; return false;
} }

View File

@@ -349,7 +349,7 @@ public class AbilityFactory_PermanentState {
untapList = untapList.getTargetableCards(source); untapList = untapList.getTargetableCards(source);
untapList = untapList.getValidCards(tgt.getValidTgts(), source.getController(), source); untapList = untapList.getValidCards(tgt.getValidTgts(), source.getController(), source);
untapList = untapList.filter(CardListFilter.tapped); untapList = untapList.filter(CardListFilter.TAPPED);
// filter out enchantments and planeswalkers, their tapped state doesn't // filter out enchantments and planeswalkers, their tapped state doesn't
// matter. // matter.
String[] tappablePermanents = { "Creature", "Land", "Artifact" }; String[] tappablePermanents = { "Creature", "Land", "Artifact" };
@@ -431,7 +431,7 @@ public class AbilityFactory_PermanentState {
} }
// try to just tap already tapped things // try to just tap already tapped things
tapList = list.filter(CardListFilter.untapped); tapList = list.filter(CardListFilter.UNTAPPED);
if (untapTargetList(source, tgt, af, sa, mandatory, tapList)) { if (untapTargetList(source, tgt, af, sa, mandatory, tapList)) {
return true; return true;
@@ -578,7 +578,7 @@ public class AbilityFactory_PermanentState {
} else { } else {
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
list = list.getType(valid); list = list.getType(valid);
list = list.filter(CardListFilter.tapped); list = list.filter(CardListFilter.TAPPED);
int count = 0; int count = 0;
while (list.size() != 0 && count < num) { while (list.size() != 0 && count < num) {
@@ -910,7 +910,7 @@ public class AbilityFactory_PermanentState {
private static boolean tapPrefTargeting(final Card source, final Target tgt, final AbilityFactory af, final SpellAbility sa, private static boolean tapPrefTargeting(final Card source, final Target tgt, final AbilityFactory af, final SpellAbility sa,
final boolean mandatory) { final boolean mandatory) {
CardList tapList = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield); CardList tapList = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
tapList = tapList.filter(CardListFilter.untapped); tapList = tapList.filter(CardListFilter.UNTAPPED);
tapList = tapList.getValidCards(tgt.getValidTgts(), source.getController(), source); tapList = tapList.getValidCards(tgt.getValidTgts(), source.getController(), source);
// filter out enchantments and planeswalkers, their tapped state doesn't // filter out enchantments and planeswalkers, their tapped state doesn't
// matter. // matter.
@@ -997,7 +997,7 @@ public class AbilityFactory_PermanentState {
} }
// try to just tap already tapped things // try to just tap already tapped things
tapList = list.filter(CardListFilter.tapped); tapList = list.filter(CardListFilter.TAPPED);
if (tapTargetList(af, sa, tapList, mandatory)) { if (tapTargetList(af, sa, tapList, mandatory)) {
return true; return true;
@@ -1503,7 +1503,7 @@ public class AbilityFactory_PermanentState {
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
if (AllZone.getPhase().isAfter(Constant.Phase.Combat_Begin)) { if (AllZone.getPhase().isAfter(Constant.Phase.COMBAT_BEGIN)) {
return false; return false;
} }
@@ -1523,7 +1523,7 @@ public class AbilityFactory_PermanentState {
} }
validTappables = validTappables.getValidCards(valid, source.getController(), source); validTappables = validTappables.getValidCards(valid, source.getController(), source);
validTappables = validTappables.filter(CardListFilter.untapped); validTappables = validTappables.filter(CardListFilter.UNTAPPED);
Random r = MyRandom.random; Random r = MyRandom.random;
boolean rr = false; boolean rr = false;
@@ -1563,7 +1563,7 @@ public class AbilityFactory_PermanentState {
private static CardList getTapAllTargets(final String valid, final Card source) { private static CardList getTapAllTargets(final String valid, final Card source) {
CardList tmpList = AllZoneUtil.getCardsIn(Zone.Battlefield); CardList tmpList = AllZoneUtil.getCardsIn(Zone.Battlefield);
tmpList = tmpList.getValidCards(valid, source.getController(), source); tmpList = tmpList.getValidCards(valid, source.getController(), source);
tmpList = tmpList.filter(CardListFilter.untapped); tmpList = tmpList.filter(CardListFilter.UNTAPPED);
return tmpList; return tmpList;
} }

View File

@@ -421,7 +421,7 @@ public class AbilityFactory_Pump {
SpellAbility_Restriction restrict = sa.getRestrictions(); SpellAbility_Restriction restrict = sa.getRestrictions();
// Phase Restrictions // Phase Restrictions
if (AllZone.getStack().size() == 0 && AllZone.getPhase().isBefore(Constant.Phase.Combat_Begin)) { if (AllZone.getStack().size() == 0 && AllZone.getPhase().isBefore(Constant.Phase.COMBAT_BEGIN)) {
// Instant-speed pumps should not be cast outside of combat when the // Instant-speed pumps should not be cast outside of combat when the
// stack is empty // stack is empty
if (!AF.isCurse() && !AbilityFactory.isSorcerySpeed(sa)) { if (!AF.isCurse() && !AbilityFactory.isSorcerySpeed(sa)) {
@@ -1119,7 +1119,7 @@ public class AbilityFactory_Pump {
}// end Curse }// end Curse
// don't use non curse PumpAll after Combat_Begin until AI is improved // don't use non curse PumpAll after Combat_Begin until AI is improved
if (AllZone.getPhase().isAfter(Constant.Phase.Combat_Begin)) { if (AllZone.getPhase().isAfter(Constant.Phase.COMBAT_BEGIN)) {
return false; return false;
} }

View File

@@ -265,7 +265,7 @@ public class AbilityFactory_Token extends AbilityFactory {
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer()) && !haste) { && AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer()) && !haste) {
return false; return false;
} }
if ((AllZone.getPhase().isAfter(Constant.Phase.Combat_Begin) || AllZone.getPhase().isPlayerTurn( if ((AllZone.getPhase().isAfter(Constant.Phase.COMBAT_BEGIN) || AllZone.getPhase().isPlayerTurn(
AllZone.getHumanPlayer())) AllZone.getHumanPlayer()))
&& oneShot) { && oneShot) {
return false; return false;

View File

@@ -217,7 +217,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
out.setOwner(in.getOwner()); out.setOwner(in.getOwner());
CardList all = new CardList(getAllCards()); CardList all = new CardList(getAllCards());
CardList tokens = AllZoneUtil.getCardsIn(Zone.Battlefield); CardList tokens = AllZoneUtil.getCardsIn(Zone.Battlefield);
tokens = tokens.filter(CardListFilter.token); tokens = tokens.filter(CardListFilter.TOKEN);
all.addAll(tokens); all.addAll(tokens);
out.setCopiedSpell(true); out.setCopiedSpell(true);
copiedList.add(out); copiedList.add(out);
@@ -1057,7 +1057,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
final Player player = getTargetPlayer(); final Player player = getTargetPlayer();
CardList lands = player.getCardsIn(Zone.Graveyard); CardList lands = player.getCardsIn(Zone.Graveyard);
lands = lands.filter(CardListFilter.basicLands); lands = lands.filter(CardListFilter.BASIC_LANDS);
if (card.getController().isHuman()) { if (card.getController().isHuman()) {
// now, select up to four lands // now, select up to four lands
int end = -1; int end = -1;
@@ -1202,7 +1202,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
// may return null // may return null
public Card getCreature() { public Card getCreature() {
CardList tappedCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); CardList tappedCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
tappedCreatures = tappedCreatures.filter(CardListFilter.tapped); tappedCreatures = tappedCreatures.filter(CardListFilter.TAPPED);
tappedCreatures = tappedCreatures.getTargetableCards(card); tappedCreatures = tappedCreatures.getTargetableCards(card);
if (tappedCreatures.isEmpty()) { if (tappedCreatures.isEmpty()) {
return null; return null;
@@ -1683,14 +1683,14 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
CardList arts = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.artifacts); CardList arts = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.ARTIFACTS);
return !arts.isEmpty(); return !arts.isEmpty();
} }
@Override @Override
public void resolve() { public void resolve() {
if (card.getController().isComputer()) { if (card.getController().isComputer()) {
CardList arts = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.artifacts); CardList arts = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.ARTIFACTS);
if (!arts.isEmpty()) { if (!arts.isEmpty()) {
copyTarget[0] = CardFactoryUtil.AI_getBestArtifact(arts); copyTarget[0] = CardFactoryUtil.AI_getBestArtifact(arts);
} }

View File

@@ -968,7 +968,7 @@ public class CardFactoryUtil {
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
if (AllZone.getPhase().isAfter(Constant.Phase.Main1) if (AllZone.getPhase().isAfter(Constant.Phase.MAIN1)
|| AllZone.getPhase().isPlayerTurn(AllZone.getHumanPlayer())) { || AllZone.getPhase().isPlayerTurn(AllZone.getHumanPlayer())) {
return false; return false;
} }
@@ -1812,7 +1812,7 @@ public class CardFactoryUtil {
*/ */
public static Input input_targetSpecific(final SpellAbility spell, final CardList choices, final String message, public static Input input_targetSpecific(final SpellAbility spell, final CardList choices, final String message,
final boolean targeted, final boolean free) { final boolean targeted, final boolean free) {
return CardFactoryUtil.input_targetSpecific(spell, choices, message, Command.Blank, targeted, free); return CardFactoryUtil.input_targetSpecific(spell, choices, message, Command.BLANK, targeted, free);
} }
// CardList choices are the only cards the user can successful select // CardList choices are the only cards the user can successful select
@@ -3213,7 +3213,7 @@ public class CardFactoryUtil {
// Count$IfMainPhase.<numMain>.<numNotMain> // 7/10 // Count$IfMainPhase.<numMain>.<numNotMain> // 7/10
if (sq[0].contains("IfMainPhase")) { if (sq[0].contains("IfMainPhase")) {
final String cPhase = AllZone.getPhase().getPhase(); 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)) { && AllZone.getPhase().getPlayerTurn().equals(cardController)) {
return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c); return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
} else { } else {
@@ -3411,32 +3411,32 @@ public class CardFactoryUtil {
// "Untapped Lands" - Count$UntappedTypeYouCtrl.Land // "Untapped Lands" - Count$UntappedTypeYouCtrl.Land
if (sq[0].contains("Untapped")) { if (sq[0].contains("Untapped")) {
someCards = someCards.filter(CardListFilter.untapped); someCards = someCards.filter(CardListFilter.UNTAPPED);
} }
if (sq[0].contains("Tapped")) { if (sq[0].contains("Tapped")) {
someCards = someCards.filter(CardListFilter.tapped); someCards = someCards.filter(CardListFilter.TAPPED);
} }
// "White Creatures" - Count$WhiteTypeYouCtrl.Creature // "White Creatures" - Count$WhiteTypeYouCtrl.Creature
if (sq[0].contains("White")) { if (sq[0].contains("White")) {
someCards = someCards.filter(CardListFilter.white); someCards = someCards.filter(CardListFilter.WHITE);
} }
if (sq[0].contains("Blue")) { if (sq[0].contains("Blue")) {
someCards = someCards.filter(CardListFilter.blue); someCards = someCards.filter(CardListFilter.BLUE);
} }
if (sq[0].contains("Black")) { if (sq[0].contains("Black")) {
someCards = someCards.filter(CardListFilter.black); someCards = someCards.filter(CardListFilter.BLACK);
} }
if (sq[0].contains("Red")) { if (sq[0].contains("Red")) {
someCards = someCards.filter(CardListFilter.red); someCards = someCards.filter(CardListFilter.RED);
} }
if (sq[0].contains("Green")) { if (sq[0].contains("Green")) {
someCards = someCards.filter(CardListFilter.green); someCards = someCards.filter(CardListFilter.GREEN);
} }
if (sq[0].contains("Multicolor")) { if (sq[0].contains("Multicolor")) {

View File

@@ -422,7 +422,7 @@ class CardFactory_Auras {
// This includes creatures Animate Dead can't enchant once // This includes creatures Animate Dead can't enchant once
// in play. // in play.
// The human may try to Animate them, the AI will not. // The human may try to Animate them, the AI will not.
return AllZoneUtil.getCardsIn(Zone.Graveyard).filter(CardListFilter.creatures); return AllZoneUtil.getCardsIn(Zone.Graveyard).filter(CardListFilter.CREATURES);
} }
public boolean canPlay() { public boolean canPlay() {

View File

@@ -593,7 +593,7 @@ public class CardFactory_Creatures {
@Override @Override
public boolean canPlay() { public boolean canPlay() {
CardList possible = card.getController().getCardsIn(Zone.Hand); CardList possible = card.getController().getCardsIn(Zone.Hand);
possible = possible.filter(CardListFilter.nonlands); possible = possible.filter(CardListFilter.NON_LANDS);
return !possible.isEmpty() && super.canPlay(); return !possible.isEmpty() && super.canPlay();
} }
@@ -967,7 +967,7 @@ public class CardFactory_Creatures {
@Override @Override
public void resolve() { public void resolve() {
CardList allTokens = AllZoneUtil.getCreaturesInPlay(card.getController()); CardList allTokens = AllZoneUtil.getCreaturesInPlay(card.getController());
allTokens = allTokens.filter(CardListFilter.token); allTokens = allTokens.filter(CardListFilter.TOKEN);
CardFactoryUtil.copyTokens(allTokens); CardFactoryUtil.copyTokens(allTokens);
} }
@@ -975,7 +975,7 @@ public class CardFactory_Creatures {
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
CardList allTokens = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); CardList allTokens = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
allTokens = allTokens.filter(CardListFilter.token); allTokens = allTokens.filter(CardListFilter.TOKEN);
return allTokens.size() >= 2; return allTokens.size() >= 2;
} }
@@ -1796,7 +1796,7 @@ public class CardFactory_Creatures {
public boolean canPlayAI() { public boolean canPlayAI() {
// get all creatures // get all creatures
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Graveyard); CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Graveyard);
list = list.filter(CardListFilter.creatures); list = list.filter(CardListFilter.CREATURES);
return 0 < list.size(); return 0 < list.size();
} }
}); });
@@ -1819,12 +1819,12 @@ public class CardFactory_Creatures {
Player opp = player.getOpponent(); Player opp = player.getOpponent();
int max = 0; int max = 0;
CardList play = opp.getCardsIn(Zone.Battlefield); CardList play = opp.getCardsIn(Zone.Battlefield);
play = play.filter(CardListFilter.nonToken); play = play.filter(CardListFilter.NON_TOKEN);
play = play.filter(CardListFilter.white); play = play.filter(CardListFilter.WHITE);
max += play.size(); max += play.size();
CardList grave = opp.getCardsIn(Zone.Graveyard); CardList grave = opp.getCardsIn(Zone.Graveyard);
grave = grave.filter(CardListFilter.white); grave = grave.filter(CardListFilter.WHITE);
max += grave.size(); max += grave.size();
String[] life = new String[max + 1]; String[] life = new String[max + 1];

View File

@@ -915,7 +915,7 @@ public class CardFactory_Instants {
@Override @Override
public void resolve() { public void resolve() {
final Player you = card.getController(); final Player you = card.getController();
final CardList ens = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.enchantments); final CardList ens = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.ENCHANTMENTS);
final CardList toReturn = ens.filter(new CardListFilter() { final CardList toReturn = ens.filter(new CardListFilter() {
@Override @Override
public boolean addCard(final Card c) { public boolean addCard(final Card c) {

View File

@@ -209,7 +209,7 @@ class CardFactory_Lands {
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
if (!(AllZone.getPhase().getPhase().equals(Constant.Phase.Main1) && AllZone.getPhase() if (!(AllZone.getPhase().getPhase().equals(Constant.Phase.MAIN1) && AllZone.getPhase()
.getPlayerTurn().isComputer())) { .getPlayerTurn().isComputer())) {
return false; return false;
} }
@@ -277,7 +277,7 @@ class CardFactory_Lands {
} }
} // selectCard() } // selectCard()
}; // Input }; // Input
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.untapped) if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.UNTAPPED)
.size() < 2)) { .size() < 2)) {
AllZone.getGameAction().sacrifice(card); AllZone.getGameAction().sacrifice(card);
return; return;
@@ -322,7 +322,7 @@ class CardFactory_Lands {
if (player.isComputer()) { if (player.isComputer()) {
if (land.size() > 0) { if (land.size() > 0) {
CardList tappedLand = new CardList(land.toArray()); CardList tappedLand = new CardList(land.toArray());
tappedLand = tappedLand.filter(CardListFilter.tapped); tappedLand = tappedLand.filter(CardListFilter.TAPPED);
// if any are tapped, sacrifice it // if any are tapped, sacrifice it
// else sacrifice random // else sacrifice random
if (tappedLand.size() > 0) { if (tappedLand.size() > 0) {
@@ -393,7 +393,7 @@ class CardFactory_Lands {
public void execute() { public void execute() {
CardList plains = AllZoneUtil.getPlayerLandsInPlay(card.getController()); CardList plains = AllZoneUtil.getPlayerLandsInPlay(card.getController());
plains = plains.filter(CardListFilter.untapped); plains = plains.filter(CardListFilter.UNTAPPED);
if (player.isComputer()) { if (player.isComputer()) {
if (plains.size() > 1) { if (plains.size() > 1) {
@@ -412,7 +412,7 @@ class CardFactory_Lands {
} }
} else { // this is the human resolution } else { // this is the human resolution
final int[] paid = { 0 }; final int[] paid = { 0 };
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.untapped) if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.UNTAPPED)
.size() < 2)) { .size() < 2)) {
AllZone.getGameAction().sacrifice(card); AllZone.getGameAction().sacrifice(card);
return; return;
@@ -676,7 +676,7 @@ class CardFactory_Lands {
if (player.isComputer()) { if (player.isComputer()) {
if (land.size() > 0) { if (land.size() > 0) {
CardList tappedLand = new CardList(land.toArray()); CardList tappedLand = new CardList(land.toArray());
tappedLand = tappedLand.filter(CardListFilter.tapped); tappedLand = tappedLand.filter(CardListFilter.TAPPED);
if (tappedLand.size() > 0) { if (tappedLand.size() > 0) {
AllZone.getGameAction().moveToHand(CardFactoryUtil.getWorstLand(tappedLand)); AllZone.getGameAction().moveToHand(CardFactoryUtil.getWorstLand(tappedLand));
} else { } else {

View File

@@ -251,7 +251,7 @@ public class CardFactory_Sorceries {
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
return creatures.size() > 0 && AllZone.getPhase().getPhase().equals(Constant.Phase.Main1); return creatures.size() > 0 && AllZone.getPhase().getPhase().equals(Constant.Phase.MAIN1);
} // canPlayAI() } // canPlayAI()
}; // SpellAbility }; // SpellAbility
@@ -698,7 +698,7 @@ public class CardFactory_Sorceries {
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
CardList c = AllZone.getHumanPlayer().getCardsIn(Zone.Library); CardList c = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
c = c.filter(CardListFilter.nonlands); c = c.filter(CardListFilter.NON_LANDS);
return c.size() > 0; return c.size() > 0;
} }
}; // SpellAbility spell }; // SpellAbility spell
@@ -873,7 +873,7 @@ public class CardFactory_Sorceries {
// randomly choose a nonland card // randomly choose a nonland card
int getDamage() { int getDamage() {
CardList notLand = card.getController().getCardsIn(Zone.Library); CardList notLand = card.getController().getCardsIn(Zone.Library);
notLand = notLand.filter(CardListFilter.nonlands); notLand = notLand.filter(CardListFilter.NON_LANDS);
notLand.shuffle(); notLand.shuffle();
if (notLand.isEmpty()) { if (notLand.isEmpty()) {
@@ -937,10 +937,10 @@ public class CardFactory_Sorceries {
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
CardList humTokenCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); CardList humTokenCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
humTokenCreats = humTokenCreats.filter(CardListFilter.token); humTokenCreats = humTokenCreats.filter(CardListFilter.TOKEN);
CardList compTokenCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); CardList compTokenCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
compTokenCreats = compTokenCreats.filter(CardListFilter.token); compTokenCreats = compTokenCreats.filter(CardListFilter.TOKEN);
return compTokenCreats.size() > humTokenCreats.size(); return compTokenCreats.size() > humTokenCreats.size();
} // canPlayAI() } // canPlayAI()
@@ -948,7 +948,7 @@ public class CardFactory_Sorceries {
@Override @Override
public void resolve() { public void resolve() {
CardList tokens = AllZoneUtil.getCreaturesInPlay(); CardList tokens = AllZoneUtil.getCreaturesInPlay();
tokens = tokens.filter(CardListFilter.token); tokens = tokens.filter(CardListFilter.TOKEN);
CardFactoryUtil.copyTokens(tokens); CardFactoryUtil.copyTokens(tokens);
@@ -2226,7 +2226,7 @@ public class CardFactory_Sorceries {
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
CardList c = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); CardList c = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
c = c.filter(CardListFilter.nonlands); c = c.filter(CardListFilter.NON_LANDS);
return 2 >= c.size(); return 2 >= c.size();
} }
@@ -2279,7 +2279,7 @@ public class CardFactory_Sorceries {
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
CardList c = AllZone.getComputerPlayer().getCardsIn(Zone.Hand); CardList c = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
c = c.filter(CardListFilter.nonlands); c = c.filter(CardListFilter.NON_LANDS);
return 2 >= c.size() return 2 >= c.size()
|| (AllZone.getComputerPlayer().hasMetalcraft() && AllZone.getHumanPlayer().getLife() <= 3); || (AllZone.getComputerPlayer().hasMetalcraft() && AllZone.getHumanPlayer().getLife() <= 3);
} }
@@ -2536,7 +2536,7 @@ public class CardFactory_Sorceries {
@Override @Override
public void showMessage() { public void showMessage() {
CardList grave = card.getController().getCardsIn(Constant.Zone.Graveyard); CardList grave = card.getController().getCardsIn(Constant.Zone.Graveyard);
grave = grave.filter(CardListFilter.creatures); grave = grave.filter(CardListFilter.CREATURES);
grave = grave.filter(new CardListFilter() { grave = grave.filter(new CardListFilter() {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
return c.getCMC() <= x[0]; return c.getCMC() <= x[0];
@@ -2691,7 +2691,7 @@ public class CardFactory_Sorceries {
// get all // get all
CardList creatures = AllZoneUtil.getCreaturesInPlay(); CardList creatures = AllZoneUtil.getCreaturesInPlay();
CardList grave = card.getController().getCardsIn(Zone.Graveyard); CardList grave = card.getController().getCardsIn(Zone.Graveyard);
grave = grave.filter(CardListFilter.creatures); grave = grave.filter(CardListFilter.CREATURES);
if (AllZone.getHumanPlayer().canTarget(spell) || AllZone.getComputerPlayer().canTarget(spell)) { if (AllZone.getHumanPlayer().canTarget(spell) || AllZone.getComputerPlayer().canTarget(spell)) {
display.add("Target player loses X life"); display.add("Target player loses X life");
@@ -2803,7 +2803,7 @@ public class CardFactory_Sorceries {
// Sacrifice an artifact // Sacrifice an artifact
CardList arts = p.getCardsIn(Constant.Zone.Battlefield); CardList arts = p.getCardsIn(Constant.Zone.Battlefield);
arts = arts.filter(CardListFilter.artifacts); arts = arts.filter(CardListFilter.ARTIFACTS);
Object toSac = GuiUtils.getChoiceOptional("Sacrifice an artifact", arts.toArray()); Object toSac = GuiUtils.getChoiceOptional("Sacrifice an artifact", arts.toArray());
if (toSac != null) { if (toSac != null) {
Card c = (Card) toSac; Card c = (Card) toSac;
@@ -2816,7 +2816,7 @@ public class CardFactory_Sorceries {
// Search your library for an artifact // Search your library for an artifact
CardList lib = p.getCardsIn(Zone.Library); CardList lib = p.getCardsIn(Zone.Library);
GuiUtils.getChoiceOptional("Looking at Library", lib.toArray()); GuiUtils.getChoiceOptional("Looking at Library", lib.toArray());
CardList libArts = lib.filter(CardListFilter.artifacts); CardList libArts = lib.filter(CardListFilter.ARTIFACTS);
Object o = GuiUtils.getChoiceOptional("Search for artifact", libArts.toArray()); Object o = GuiUtils.getChoiceOptional("Search for artifact", libArts.toArray());
if (o != null) { if (o != null) {
newArtifact[0] = (Card) o; newArtifact[0] = (Card) o;

View File

@@ -126,8 +126,9 @@ public class CostDiscard extends CostPartWithList {
@Override @Override
public final void payAI(final SpellAbility ability, final Card source, final Cost_Payment payment) { public final void payAI(final SpellAbility ability, final Card source, final Cost_Payment payment) {
Player activator = ability.getActivatingPlayer(); Player activator = ability.getActivatingPlayer();
for (Card c : list) for (Card c : list) {
activator.discard(c, ability); activator.discard(c, ability);
}
} }
/* /*
@@ -247,7 +248,7 @@ public class CostDiscard extends CostPartWithList {
if (type.equals("Random")) { if (type.equals("Random")) {
list = CardListUtil.getRandomSubList(hand, c); list = CardListUtil.getRandomSubList(hand, c);
} else { } else {
list = ComputerUtil.AI_discardNumType(c, type.split(";"), ability); list = ComputerUtil.discardNumTypeAI(c, type.split(";"), ability);
} }
} }
return list != null; return list != null;
@@ -350,5 +351,5 @@ public class CostDiscard extends CostPartWithList {
}; };
return target; return target;
}// input_discard() } // input_discard()
} }

View File

@@ -42,7 +42,8 @@ public class CostReveal extends CostPartWithList {
* forge.Card, forge.Player, forge.card.cost.Cost) * forge.Card, forge.Player, forge.card.cost.Cost)
*/ */
@Override @Override
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) { public final boolean canPay(final SpellAbility ability,
final Card source, final Player activator, final Cost cost) {
CardList handList = activator.getCardsIn(Zone.Hand); CardList handList = activator.getCardsIn(Zone.Hand);
String type = getType(); String type = getType();
Integer amount = convertAmount(); Integer amount = convertAmount();
@@ -94,7 +95,7 @@ public class CostReveal extends CostPartWithList {
} }
} }
list = ComputerUtil.AI_discardNumType(c, type.split(";"), ability); list = ComputerUtil.discardNumTypeAI(c, type.split(";"), ability);
} }
return list != null; return list != null;
} }
@@ -141,7 +142,7 @@ public class CostReveal extends CostPartWithList {
} }
} }
CostUtil.setInput(input_revealCost(type, handList, payment, this, ability, c)); CostUtil.setInput(inputRevealCost(type, handList, payment, this, ability, c));
return false; return false;
} }
addListToHash(ability, "Revealed"); addListToHash(ability, "Revealed");
@@ -209,12 +210,12 @@ public class CostReveal extends CostPartWithList {
* a int. * a int.
* @return a {@link forge.gui.input.Input} object. * @return a {@link forge.gui.input.Input} object.
*/ */
public static Input input_revealCost(final String discType, final CardList handList, final Cost_Payment payment, public static Input inputRevealCost(final String discType, final CardList handList, final Cost_Payment payment,
final CostReveal part, final SpellAbility sa, final int nNeeded) { final CostReveal part, final SpellAbility sa, final int nNeeded) {
Input target = new Input() { Input target = new Input() {
private static final long serialVersionUID = -329993322080934435L; private static final long serialVersionUID = -329993322080934435L;
int nReveal = 0; private int nReveal = 0;
@Override @Override
public void showMessage() { public void showMessage() {
@@ -283,6 +284,6 @@ public class CostReveal extends CostPartWithList {
}; };
return target; return target;
}// input_discard() } // input_discard()
} }

View File

@@ -103,7 +103,7 @@ public class CostTapType extends CostPartWithList {
if (cost.getTap()) { if (cost.getTap()) {
typeList.remove(source); typeList.remove(source);
} }
typeList = typeList.filter(CardListFilter.untapped); typeList = typeList.filter(CardListFilter.UNTAPPED);
Integer amount = convertAmount(); Integer amount = convertAmount();
if (typeList.size() == 0 || (amount != null && typeList.size() < amount)) { if (typeList.size() == 0 || (amount != null && typeList.size() < amount)) {
@@ -136,7 +136,7 @@ public class CostTapType extends CostPartWithList {
public final boolean payHuman(final SpellAbility ability, final Card source, final Cost_Payment payment) { public final boolean payHuman(final SpellAbility ability, final Card source, final Cost_Payment payment) {
CardList typeList = ability.getActivatingPlayer().getCardsIn(Zone.Battlefield); CardList typeList = ability.getActivatingPlayer().getCardsIn(Zone.Battlefield);
typeList = typeList.getValidCards(getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); typeList = typeList.getValidCards(getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
typeList = typeList.filter(CardListFilter.untapped); typeList = typeList.filter(CardListFilter.UNTAPPED);
String amount = getAmount(); String amount = getAmount();
Integer c = convertAmount(); Integer c = convertAmount();
if (c == null) { if (c == null) {

View File

@@ -101,8 +101,8 @@ public abstract class SpellAbility {
private HashMap<String, Object> triggeringObjects = new HashMap<String, Object>(); private HashMap<String, Object> triggeringObjects = new HashMap<String, Object>();
private Command cancelCommand = Command.Blank; private Command cancelCommand = Command.BLANK;
private Command beforePayManaAI = Command.Blank; private Command beforePayManaAI = Command.BLANK;
private CommandArgs randomTarget = new CommandArgs() { private CommandArgs randomTarget = new CommandArgs() {

View File

@@ -66,9 +66,9 @@ public abstract class DeckGeneration {
} }
if (playerType.equals(PlayerType.HUMAN)) { if (playerType.equals(PlayerType.HUMAN)) {
Constant.Runtime.HumanDeck[0] = d; Constant.Runtime.HUMAN_DECK[0] = d;
} else if (playerType.equals(PlayerType.COMPUTER)) { } else if (playerType.equals(PlayerType.COMPUTER)) {
Constant.Runtime.ComputerDeck[0] = d; Constant.Runtime.COMPUTER_DECK[0] = d;
} }
} }

View File

@@ -286,7 +286,7 @@ public class DeckEditorDraft extends DeckEditorBase implements NewConstants, New
*/ */
private Deck getPlayersDeck() { private Deck getPlayersDeck() {
Deck deck = new Deck(GameType.Draft); Deck deck = new Deck(GameType.Draft);
Constant.Runtime.HumanDeck[0] = deck; Constant.Runtime.HUMAN_DECK[0] = deck;
// add sideboard to deck // add sideboard to deck
ItemPoolView<CardPrinted> list = ItemPool.createFrom(bottom.getCards(), CardPrinted.class); ItemPoolView<CardPrinted> list = ItemPool.createFrom(bottom.getCards(), CardPrinted.class);

View File

@@ -90,9 +90,9 @@ public final class DeckEditorQuest extends DeckEditorBase implements NewConstant
Deck deck = null; Deck deck = null;
// open deck that the player used if QuestData has it // open deck that the player used if QuestData has it
if (Constant.Runtime.HumanDeck[0] != null if (Constant.Runtime.HUMAN_DECK[0] != null
&& questData.getDeckNames().contains(Constant.Runtime.HumanDeck[0].getName())) { && questData.getDeckNames().contains(Constant.Runtime.HUMAN_DECK[0].getName())) {
deck = questData.getDeck(Constant.Runtime.HumanDeck[0].getName()); deck = questData.getDeck(Constant.Runtime.HUMAN_DECK[0].getName());
} else { } else {
deck = new Deck(GameType.Sealed); deck = new Deck(GameType.Sealed);
deck.setName(""); deck.setName("");

View File

@@ -201,7 +201,7 @@ public class InputControl extends MyObservable implements java.io.Serializable {
} else if (phase.equals(Constant.Phase.Combat_Declare_Blockers)) { } else if (phase.equals(Constant.Phase.Combat_Declare_Blockers)) {
model.getGameState().getStack().freezeStack(); model.getGameState().getStack().freezeStack();
if (playerTurn.isHuman()) { if (playerTurn.isHuman()) {
aiInput.getComputer().declare_blockers(); aiInput.getComputer().declareBlockers();
return null; return null;
} else { } else {
if (model.getGameState().getCombat().getAttackers().length == 0) { if (model.getGameState().getCombat().getAttackers().length == 0) {
@@ -238,7 +238,7 @@ public class InputControl extends MyObservable implements java.io.Serializable {
} else if (playerTurn.isComputer()) { } else if (playerTurn.isComputer()) {
return aiInput; return aiInput;
} else { } else {
aiInput.getComputer().stack_not_empty(); aiInput.getComputer().stackNotEmpty();
return null; return null;
} }
}// getInput() }// getInput()

View File

@@ -46,7 +46,7 @@ public class Input_PayManaCost_Ability extends Input {
* a {@link forge.Command} object. * a {@link forge.Command} object.
*/ */
public Input_PayManaCost_Ability(final String manaCost, final Command paid) { public Input_PayManaCost_Ability(final String manaCost, final Command paid) {
this(manaCost, paid, Command.Blank); this(manaCost, paid, Command.BLANK);
} }
/** /**

View File

@@ -73,7 +73,7 @@ public class FModel {
// PM // PM
} }
Constant.Runtime.Mill[0] = preferences.millingLossCondition; Constant.Runtime.MILL[0] = preferences.millingLossCondition;
Constant.Runtime.DevMode[0] = preferences.developerMode; Constant.Runtime.DevMode[0] = preferences.developerMode;
Constant.Runtime.UpldDrft[0] = preferences.uploadDraftAI; Constant.Runtime.UpldDrft[0] = preferences.uploadDraftAI;
Constant.Runtime.RndCFoil[0] = preferences.randCFoil; Constant.Runtime.RndCFoil[0] = preferences.randCFoil;

View File

@@ -506,7 +506,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
AllZone.getQuestData().saveData(); AllZone.getQuestData().saveData();
devModeCheckBox.setSelected(Constant.Runtime.DevMode[0]); devModeCheckBox.setSelected(Constant.Runtime.DevMode[0]);
smoothLandCheckBox.setSelected(Constant.Runtime.Smooth[0]); smoothLandCheckBox.setSelected(Constant.Runtime.SMOOTH[0]);
creditsLabel.setText(" " + questData.getCredits()); creditsLabel.setText(" " + questData.getCredits());
statsLabel.setText(questData.getWin() + " wins / " + questData.getLost() + " losses"); statsLabel.setText(questData.getWin() + " wins / " + questData.getLost() + " losses");
@@ -727,7 +727,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
Deck humanDeck = questData.getDeck(humanDeckName); Deck humanDeck = questData.getDeck(humanDeckName);
Constant.Runtime.HumanDeck[0] = humanDeck; Constant.Runtime.HUMAN_DECK[0] = humanDeck;
moveDeckToTop(humanDeckName); moveDeckToTop(humanDeckName);
Constant.Quest.oppIconName[0] = getEventIconFilename(); Constant.Quest.oppIconName[0] = getEventIconFilename();
@@ -743,7 +743,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
// AllZone.setDisplay(new GuiDisplay3()); // AllZone.setDisplay(new GuiDisplay3());
// } // }
Constant.Runtime.Smooth[0] = smoothLandCheckBox.isSelected(); Constant.Runtime.SMOOTH[0] = smoothLandCheckBox.isSelected();
AllZone.getMatchState().reset(); AllZone.getMatchState().reset();
if (isShowingChallenges) { if (isShowingChallenges) {
@@ -768,7 +768,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
*/ */
final void setupDuel(final Deck humanDeck) { final void setupDuel(final Deck humanDeck) {
Deck computer = selectedOpponent.getEvent().getEventDeck(); Deck computer = selectedOpponent.getEvent().getEventDeck();
Constant.Runtime.ComputerDeck[0] = computer; Constant.Runtime.COMPUTER_DECK[0] = computer;
QuestDuel selectedDuel = (QuestDuel) selectedOpponent.getEvent(); QuestDuel selectedDuel = (QuestDuel) selectedOpponent.getEvent();
AllZone.setQuestEvent(selectedDuel); AllZone.setQuestEvent(selectedDuel);
@@ -789,7 +789,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
QuestChallenge selectedChallenge = (QuestChallenge) selectedOpponent.getEvent(); QuestChallenge selectedChallenge = (QuestChallenge) selectedOpponent.getEvent();
Deck computer = selectedOpponent.getEvent().getEventDeck(); Deck computer = selectedOpponent.getEvent().getEventDeck();
Constant.Runtime.ComputerDeck[0] = computer; Constant.Runtime.COMPUTER_DECK[0] = computer;
AllZone.setQuestEvent(selectedChallenge); AllZone.setQuestEvent(selectedChallenge);

View File

@@ -81,7 +81,7 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
*/ */
@Override @Override
public final void startNextRound() { public final void startNextRound() {
if (Constant.Quest.fantasyQuest[0]) { if (Constant.Quest.FANTASY_QUEST[0]) {
int extraLife = 0; int extraLife = 0;
if (model.qEvent.getEventType().equals("challenge")) { if (model.qEvent.getEventType().equals("challenge")) {
@@ -99,7 +99,7 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
computerLife = ((QuestChallenge) model.qEvent).getAILife(); computerLife = ((QuestChallenge) model.qEvent).getAILife();
} }
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0], humanList, AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0], humanList,
computerList, humanLife, computerLife, model.qEvent); computerList, humanLife, computerLife, model.qEvent);
} else { } else {
super.startNextRound(); super.startNextRound();

View File

@@ -145,7 +145,7 @@ public class ApplicationView implements FView {
try { try {
ManaSymbols.loadImages(); ManaSymbols.loadImages();
Constant.Runtime.gameType = GameType.Constructed; Constant.Runtime.setGameType(GameType.Constructed);
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids
// on 8/7/11 1:07 // on 8/7/11 1:07
// PM: this isn't a // PM: this isn't a

View File

@@ -802,10 +802,10 @@ public class Gui_HomeScreen {
Deck rDeck = chooseRandomDeck(); Deck rDeck = chooseRandomDeck();
if (rDeck != null) { if (rDeck != null) {
String msg = String.format("You are using deck: %s.", Constant.Runtime.HumanDeck[0].getName()); String msg = String.format("You are using deck: %s.", Constant.Runtime.HUMAN_DECK[0].getName());
JOptionPane.showMessageDialog(null, msg, "Random Deck Name", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, msg, "Random Deck Name", JOptionPane.INFORMATION_MESSAGE);
Constant.Runtime.HumanDeck[0] = rDeck; Constant.Runtime.HUMAN_DECK[0] = rDeck;
} else { } else {
JOptionPane.showMessageDialog(null, "No decks available.", "Random Deck Name", JOptionPane.showMessageDialog(null, "No decks available.", "Random Deck Name",
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
@@ -813,7 +813,7 @@ public class Gui_HomeScreen {
} }
} else { } else {
Constant.Runtime.HumanDeck[0] = deckManager.getDeck(HumanDeckSelected); Constant.Runtime.HUMAN_DECK[0] = deckManager.getDeck(HumanDeckSelected);
} }
if (AIDeckSelected.equals("Generate Deck")) { if (AIDeckSelected.equals("Generate Deck")) {
@@ -824,10 +824,10 @@ public class Gui_HomeScreen {
if (rDeck != null) { if (rDeck != null) {
String msg = String.format("The computer is using deck: %s.", String msg = String.format("The computer is using deck: %s.",
Constant.Runtime.ComputerDeck[0].getName()); Constant.Runtime.COMPUTER_DECK[0].getName());
JOptionPane.showMessageDialog(null, msg, "Random Deck Name", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, msg, "Random Deck Name", JOptionPane.INFORMATION_MESSAGE);
Constant.Runtime.ComputerDeck[0] = rDeck; Constant.Runtime.COMPUTER_DECK[0] = rDeck;
} else { } else {
JOptionPane.showMessageDialog(null, "No decks available.", "Random Deck Name", JOptionPane.showMessageDialog(null, "No decks available.", "Random Deck Name",
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
@@ -835,7 +835,7 @@ public class Gui_HomeScreen {
} }
} else { } else {
Constant.Runtime.ComputerDeck[0] = deckManager.getDeck(AIDeckSelected); Constant.Runtime.COMPUTER_DECK[0] = deckManager.getDeck(AIDeckSelected);
} }
} else if (GameTypeSelected.equals(GameType.Sealed)) { } else if (GameTypeSelected.equals(GameType.Sealed)) {
@@ -848,8 +848,8 @@ public class Gui_HomeScreen {
} else { } else {
if (!HumanDeckSelected.equals("") && !AIDeckSelected.equals("")) { if (!HumanDeckSelected.equals("") && !AIDeckSelected.equals("")) {
Constant.Runtime.HumanDeck[0] = deckManager.getDeck(HumanDeckSelected); Constant.Runtime.HUMAN_DECK[0] = deckManager.getDeck(HumanDeckSelected);
Constant.Runtime.ComputerDeck[0] = deckManager.getDeck(AIDeckSelected); Constant.Runtime.COMPUTER_DECK[0] = deckManager.getDeck(AIDeckSelected);
} }
} }
} else if (GameTypeSelected.equals(GameType.Draft)) { } else if (GameTypeSelected.equals(GameType.Draft)) {
@@ -861,13 +861,13 @@ public class Gui_HomeScreen {
return false; return false;
} else { } else {
if (!HumanDeckSelected.equals("") && !AIDeckSelected.equals("")) { if (!HumanDeckSelected.equals("") && !AIDeckSelected.equals("")) {
Constant.Runtime.HumanDeck[0] = deckManager.getDraftDeck(HumanDeckSelected)[0]; Constant.Runtime.HUMAN_DECK[0] = deckManager.getDraftDeck(HumanDeckSelected)[0];
String[] aiDeck = AIDeckSelected.split(" - "); String[] aiDeck = AIDeckSelected.split(" - ");
int AIDeckNum = Integer.parseInt(aiDeck[1]); int AIDeckNum = Integer.parseInt(aiDeck[1]);
String AIDeckName = aiDeck[0]; String AIDeckName = aiDeck[0];
Constant.Runtime.ComputerDeck[0] = deckManager.getDraftDeck(AIDeckName)[AIDeckNum]; Constant.Runtime.COMPUTER_DECK[0] = deckManager.getDraftDeck(AIDeckName)[AIDeckNum];
} }
} }
} }
@@ -933,9 +933,9 @@ public class Gui_HomeScreen {
deck.addSideboard(sDeck); deck.addSideboard(sDeck);
for (int i = 0; i < Constant.Color.BasicLands.length; i++) { for (int i = 0; i < Constant.Color.BASIC_LANDS.length; i++) {
for (int j = 0; j < 18; j++) { for (int j = 0; j < 18; j++) {
deck.addSideboard(Constant.Color.BasicLands[i] + "|" + sd.LandSetCode[0]); deck.addSideboard(Constant.Color.BASIC_LANDS[i] + "|" + sd.LandSetCode[0]);
} }
} }
@@ -946,7 +946,7 @@ public class Gui_HomeScreen {
deck.setPlayerType(PlayerType.HUMAN); deck.setPlayerType(PlayerType.HUMAN);
HumanDeckSelected = sDeckName; HumanDeckSelected = sDeckName;
Constant.Runtime.HumanDeck[0] = deck; Constant.Runtime.HUMAN_DECK[0] = deck;
AIDeckSelected = "AI_" + sDeckName; AIDeckSelected = "AI_" + sDeckName;
// Deck aiDeck = sd.buildAIDeck(sDeck.toForgeCardList()); // Deck aiDeck = sd.buildAIDeck(sDeck.toForgeCardList());
@@ -960,7 +960,7 @@ public class Gui_HomeScreen {
aiDeck.setPlayerType(PlayerType.COMPUTER); aiDeck.setPlayerType(PlayerType.COMPUTER);
deckManager.addDeck(aiDeck); deckManager.addDeck(aiDeck);
DeckManager.writeDeck(aiDeck, DeckManager.makeFileName(aiDeck)); DeckManager.writeDeck(aiDeck, DeckManager.makeFileName(aiDeck));
Constant.Runtime.ComputerDeck[0] = aiDeck; Constant.Runtime.COMPUTER_DECK[0] = aiDeck;
showDecks(); showDecks();
@@ -1274,11 +1274,11 @@ public class Gui_HomeScreen {
} }
AllZone.setDisplay(new GuiDisplay4()); AllZone.setDisplay(new GuiDisplay4());
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]); AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
AllZone.getDisplay().setVisible(true); AllZone.getDisplay().setVisible(true);
} }
Constant.Runtime.gameType = GameTypeSelected; Constant.Runtime.setGameType(GameTypeSelected);
gHS.dispose(); gHS.dispose();
} }

View File

@@ -203,15 +203,15 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
ErrorViewer.showError(ex); ErrorViewer.showError(ex);
} }
if (Constant.Runtime.gameType.equals(GameType.Constructed)) { if (Constant.Runtime.getGameType().equals(GameType.Constructed)) {
singleRadioButton.setSelected(true); singleRadioButton.setSelected(true);
updateDeckComboBoxes(); updateDeckComboBoxes();
} }
if (Constant.Runtime.gameType.equals(GameType.Sealed)) { if (Constant.Runtime.getGameType().equals(GameType.Sealed)) {
sealedRadioButton.setSelected(true); sealedRadioButton.setSelected(true);
updateDeckComboBoxes(); updateDeckComboBoxes();
} }
if (Constant.Runtime.gameType.equals(GameType.Draft)) { if (Constant.Runtime.getGameType().equals(GameType.Draft)) {
draftRadioButton.setSelected(true); draftRadioButton.setSelected(true);
draftRadioButtonActionPerformed(null); draftRadioButtonActionPerformed(null);
} }
@@ -389,9 +389,9 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
deck.addSideboard(sDeck); deck.addSideboard(sDeck);
for (int i = 0; i < Constant.Color.BasicLands.length; i++) { for (int i = 0; i < Constant.Color.BASIC_LANDS.length; i++) {
for (int j = 0; j < 18; j++) { for (int j = 0; j < 18; j++) {
deck.addSideboard(Constant.Color.BasicLands[i] + "|" + sd.LandSetCode[0]); deck.addSideboard(Constant.Color.BASIC_LANDS[i] + "|" + sd.LandSetCode[0]);
} }
} }
@@ -402,8 +402,8 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
deck.setName(sDeckName); deck.setName(sDeckName);
deck.setPlayerType(PlayerType.HUMAN); deck.setPlayerType(PlayerType.HUMAN);
Constant.Runtime.HumanDeck[0] = deck; Constant.Runtime.HUMAN_DECK[0] = deck;
Constant.Runtime.gameType = GameType.Sealed; Constant.Runtime.setGameType(GameType.Sealed);
// Deck aiDeck = sd.buildAIDeck(sDeck.toForgeCardList()); // Deck aiDeck = sd.buildAIDeck(sDeck.toForgeCardList());
Deck aiDeck = sd.buildAIDeck(sd.getCardpool().toForgeCardList()); // AI Deck aiDeck = sd.buildAIDeck(sd.getCardpool().toForgeCardList()); // AI
@@ -419,7 +419,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
deckEditorButtonActionPerformed(GameType.Sealed, deck); deckEditorButtonActionPerformed(GameType.Sealed, deck);
Constant.Runtime.ComputerDeck[0] = aiDeck; Constant.Runtime.COMPUTER_DECK[0] = aiDeck;
} else { } else {
new OldGuiNewGame(); new OldGuiNewGame();
} }
@@ -757,10 +757,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
Deck[] deck = deckManager.getDraftDeck(human); Deck[] deck = deckManager.getDraftDeck(human);
int index = Integer.parseInt(computer); int index = Integer.parseInt(computer);
Constant.Runtime.HumanDeck[0] = deck[0]; Constant.Runtime.HUMAN_DECK[0] = deck[0];
Constant.Runtime.ComputerDeck[0] = deck[index]; Constant.Runtime.COMPUTER_DECK[0] = deck[index];
if (Constant.Runtime.ComputerDeck[0] == null) { if (Constant.Runtime.COMPUTER_DECK[0] == null) {
throw new IllegalStateException("OldGuiNewGame : startButton() error - computer deck is null"); throw new IllegalStateException("OldGuiNewGame : startButton() error - computer deck is null");
} }
} // else - load old draft } // else - load old draft
@@ -773,16 +773,16 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
return; return;
} else { } else {
Constant.Runtime.HumanDeck[0] = deckManager.getDeck(human); Constant.Runtime.HUMAN_DECK[0] = deckManager.getDeck(human);
} }
if (!computer.equals("New Sealed")) { if (!computer.equals("New Sealed")) {
Constant.Runtime.ComputerDeck[0] = deckManager.getDeck(computer); Constant.Runtime.COMPUTER_DECK[0] = deckManager.getDeck(computer);
} }
} else { } else {
// non-draft decks // non-draft decks
GameType format = Constant.Runtime.gameType; GameType format = Constant.Runtime.getGameType();
// boolean sealed = GameType.Sealed.equals(format); // boolean sealed = GameType.Sealed.equals(format);
boolean constructed = GameType.Constructed.equals(format); boolean constructed = GameType.Constructed.equals(format);
@@ -796,13 +796,13 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
// else if(sealed) // else if(sealed)
// Constant.Runtime.HumanDeck[0] = generateSealedDeck(); // Constant.Runtime.HumanDeck[0] = generateSealedDeck();
} else if (humanRandom) { } else if (humanRandom) {
Constant.Runtime.HumanDeck[0] = getRandomDeck(getDecks(format)); Constant.Runtime.HUMAN_DECK[0] = getRandomDeck(getDecks(format));
JOptionPane.showMessageDialog(null, JOptionPane.showMessageDialog(null,
String.format("You are using deck: %s", Constant.Runtime.HumanDeck[0].getName()), "Deck Name", String.format("You are using deck: %s", Constant.Runtime.HUMAN_DECK[0].getName()), "Deck Name",
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
} else { } else {
Constant.Runtime.HumanDeck[0] = deckManager.getDeck(human); Constant.Runtime.HUMAN_DECK[0] = deckManager.getDeck(human);
} }
assert computer != null; assert computer != null;
@@ -817,13 +817,13 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
// else if(sealed) // else if(sealed)
// Constant.Runtime.ComputerDeck[0] = generateSealedDeck(); // Constant.Runtime.ComputerDeck[0] = generateSealedDeck();
} else if (computerRandom) { } else if (computerRandom) {
Constant.Runtime.ComputerDeck[0] = getRandomDeck(getDecks(format)); Constant.Runtime.COMPUTER_DECK[0] = getRandomDeck(getDecks(format));
JOptionPane.showMessageDialog(null, JOptionPane.showMessageDialog(null,
String.format("The computer is using deck: %s", Constant.Runtime.ComputerDeck[0].getName()), String.format("The computer is using deck: %s", Constant.Runtime.COMPUTER_DECK[0].getName()),
"Deck Name", JOptionPane.INFORMATION_MESSAGE); "Deck Name", JOptionPane.INFORMATION_MESSAGE);
} else { } else {
Constant.Runtime.ComputerDeck[0] = deckManager.getDeck(computer); Constant.Runtime.COMPUTER_DECK[0] = deckManager.getDeck(computer);
} }
} // else } // else
@@ -835,9 +835,9 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
AllZone.setDisplay(new GuiDisplay4()); AllZone.setDisplay(new GuiDisplay4());
// else AllZone.setDisplay(new GuiDisplay3()); // else AllZone.setDisplay(new GuiDisplay3());
Constant.Runtime.Smooth[0] = smoothLandCheckBox.isSelected(); Constant.Runtime.SMOOTH[0] = smoothLandCheckBox.isSelected();
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]); AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
AllZone.getDisplay().setVisible(true); AllZone.getDisplay().setVisible(true);
dispose(); dispose();
@@ -852,7 +852,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
* a {@link java.awt.event.ActionEvent} object. * a {@link java.awt.event.ActionEvent} object.
*/ */
final void singleRadioButtonActionPerformed(final ActionEvent e) { final void singleRadioButtonActionPerformed(final ActionEvent e) {
Constant.Runtime.gameType = GameType.Constructed; Constant.Runtime.setGameType(GameType.Constructed);
updateDeckComboBoxes(); updateDeckComboBoxes();
} }
@@ -865,7 +865,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
* a {@link java.awt.event.ActionEvent} object. * a {@link java.awt.event.ActionEvent} object.
*/ */
final void sealedRadioButtonActionPerformed(final ActionEvent e) { final void sealedRadioButtonActionPerformed(final ActionEvent e) {
Constant.Runtime.gameType = GameType.Sealed; Constant.Runtime.setGameType(GameType.Sealed);
updateDeckComboBoxes(); updateDeckComboBoxes();
} }
@@ -879,7 +879,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
computerComboBox.removeAllItems(); computerComboBox.removeAllItems();
allDecks = getDecks(); allDecks = getDecks();
switch (Constant.Runtime.gameType) { switch (Constant.Runtime.getGameType()) {
case Sealed: case Sealed:
humanComboBox.addItem("New Sealed"); humanComboBox.addItem("New Sealed");
computerComboBox.addItem("New Sealed"); computerComboBox.addItem("New Sealed");
@@ -965,7 +965,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
* the e * the e
*/ */
final void draftRadioButtonActionPerformed(final ActionEvent e) { final void draftRadioButtonActionPerformed(final ActionEvent e) {
Constant.Runtime.gameType = GameType.Draft; Constant.Runtime.setGameType(GameType.Draft);
updateDeckComboBoxes(); updateDeckComboBoxes();
} }
@@ -1625,7 +1625,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
preferences.lafFonts = useLAFFonts.isSelected(); preferences.lafFonts = useLAFFonts.isSelected();
// preferences.newGui = newGuiCheckBox.isSelected(); // preferences.newGui = newGuiCheckBox.isSelected();
preferences.stackAiLand = smoothLandCheckBox.isSelected(); preferences.stackAiLand = smoothLandCheckBox.isSelected();
preferences.millingLossCondition = Constant.Runtime.Mill[0]; preferences.millingLossCondition = Constant.Runtime.MILL[0];
preferences.developerMode = Constant.Runtime.DevMode[0]; preferences.developerMode = Constant.Runtime.DevMode[0];
preferences.cardOverlay = cardOverlay.isSelected(); preferences.cardOverlay = cardOverlay.isSelected();
preferences.scaleLargerThanOriginal = ImageCache.scaleLargerThanOriginal; preferences.scaleLargerThanOriginal = ImageCache.scaleLargerThanOriginal;
@@ -1681,64 +1681,64 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
* Load dynamic gamedata. * Load dynamic gamedata.
*/ */
public static void loadDynamicGamedata() { public static void loadDynamicGamedata() {
if (!Constant.CardTypes.loaded[0]) { if (!Constant.CardTypes.LOADED[0]) {
ArrayList<String> typeListFile = FileUtil.readFile("res/gamedata/TypeLists.txt"); ArrayList<String> typeListFile = FileUtil.readFile("res/gamedata/TypeLists.txt");
ArrayList<String> tList = null; ArrayList<String> tList = null;
Constant.CardTypes.cardTypes[0] = new Constant_StringArrayList(); Constant.CardTypes.CARD_TYPES[0] = new Constant_StringArrayList();
Constant.CardTypes.superTypes[0] = new Constant_StringArrayList(); Constant.CardTypes.SUPER_TYPES[0] = new Constant_StringArrayList();
Constant.CardTypes.basicTypes[0] = new Constant_StringArrayList(); Constant.CardTypes.BASIC_TYPES[0] = new Constant_StringArrayList();
Constant.CardTypes.landTypes[0] = new Constant_StringArrayList(); Constant.CardTypes.LAND_TYPES[0] = new Constant_StringArrayList();
Constant.CardTypes.creatureTypes[0] = new Constant_StringArrayList(); Constant.CardTypes.CREATURE_TYPES[0] = new Constant_StringArrayList();
Constant.CardTypes.instantTypes[0] = new Constant_StringArrayList(); Constant.CardTypes.INSTANT_TYPES[0] = new Constant_StringArrayList();
Constant.CardTypes.sorceryTypes[0] = new Constant_StringArrayList(); Constant.CardTypes.SORCERY_TYPES[0] = new Constant_StringArrayList();
Constant.CardTypes.enchantmentTypes[0] = new Constant_StringArrayList(); Constant.CardTypes.ENCHANTMENT_TYPES[0] = new Constant_StringArrayList();
Constant.CardTypes.artifactTypes[0] = new Constant_StringArrayList(); Constant.CardTypes.ARTIFACT_TYPES[0] = new Constant_StringArrayList();
Constant.CardTypes.walkerTypes[0] = new Constant_StringArrayList(); Constant.CardTypes.WALKER_TYPES[0] = new Constant_StringArrayList();
if (typeListFile.size() > 0) { if (typeListFile.size() > 0) {
for (int i = 0; i < typeListFile.size(); i++) { for (int i = 0; i < typeListFile.size(); i++) {
String s = typeListFile.get(i); String s = typeListFile.get(i);
if (s.equals("[CardTypes]")) { if (s.equals("[CardTypes]")) {
tList = Constant.CardTypes.cardTypes[0].list; tList = Constant.CardTypes.CARD_TYPES[0].getList();
} }
else if (s.equals("[SuperTypes]")) { else if (s.equals("[SuperTypes]")) {
tList = Constant.CardTypes.superTypes[0].list; tList = Constant.CardTypes.SUPER_TYPES[0].getList();
} }
else if (s.equals("[BasicTypes]")) { else if (s.equals("[BasicTypes]")) {
tList = Constant.CardTypes.basicTypes[0].list; tList = Constant.CardTypes.BASIC_TYPES[0].getList();
} }
else if (s.equals("[LandTypes]")) { else if (s.equals("[LandTypes]")) {
tList = Constant.CardTypes.landTypes[0].list; tList = Constant.CardTypes.LAND_TYPES[0].getList();
} }
else if (s.equals("[CreatureTypes]")) { else if (s.equals("[CreatureTypes]")) {
tList = Constant.CardTypes.creatureTypes[0].list; tList = Constant.CardTypes.CREATURE_TYPES[0].getList();
} }
else if (s.equals("[InstantTypes]")) { else if (s.equals("[InstantTypes]")) {
tList = Constant.CardTypes.instantTypes[0].list; tList = Constant.CardTypes.INSTANT_TYPES[0].getList();
} }
else if (s.equals("[SorceryTypes]")) { else if (s.equals("[SorceryTypes]")) {
tList = Constant.CardTypes.sorceryTypes[0].list; tList = Constant.CardTypes.SORCERY_TYPES[0].getList();
} }
else if (s.equals("[EnchantmentTypes]")) { else if (s.equals("[EnchantmentTypes]")) {
tList = Constant.CardTypes.enchantmentTypes[0].list; tList = Constant.CardTypes.ENCHANTMENT_TYPES[0].getList();
} }
else if (s.equals("[ArtifactTypes]")) { else if (s.equals("[ArtifactTypes]")) {
tList = Constant.CardTypes.artifactTypes[0].list; tList = Constant.CardTypes.ARTIFACT_TYPES[0].getList();
} }
else if (s.equals("[WalkerTypes]")) { else if (s.equals("[WalkerTypes]")) {
tList = Constant.CardTypes.walkerTypes[0].list; tList = Constant.CardTypes.WALKER_TYPES[0].getList();
} }
else if (s.length() > 1) { else if (s.length() > 1) {
@@ -1746,7 +1746,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
} }
} }
} }
Constant.CardTypes.loaded[0] = true; Constant.CardTypes.LOADED[0] = true;
/* /*
* if (Constant.Runtime.DevMode[0]) { * if (Constant.Runtime.DevMode[0]) {
* System.out.println(Constant.CardTypes.cardTypes[0].list); * System.out.println(Constant.CardTypes.cardTypes[0].list);
@@ -1762,20 +1762,20 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
*/ */
} }
if (!Constant.Keywords.loaded[0]) { if (!Constant.Keywords.LOADED[0]) {
ArrayList<String> nskwListFile = FileUtil.readFile("res/gamedata/NonStackingKWList.txt"); ArrayList<String> nskwListFile = FileUtil.readFile("res/gamedata/NonStackingKWList.txt");
Constant.Keywords.NonStackingList[0] = new Constant_StringArrayList(); Constant.Keywords.NON_STACKING_LIST[0] = new Constant_StringArrayList();
if (nskwListFile.size() > 1) { if (nskwListFile.size() > 1) {
for (int i = 0; i < nskwListFile.size(); i++) { for (int i = 0; i < nskwListFile.size(); i++) {
String s = nskwListFile.get(i); String s = nskwListFile.get(i);
if (s.length() > 1) { if (s.length() > 1) {
Constant.Keywords.NonStackingList[0].list.add(s); Constant.Keywords.NON_STACKING_LIST[0].getList().add(s);
} }
} }
} }
Constant.Keywords.loaded[0] = true; Constant.Keywords.LOADED[0] = true;
/* /*
* if (Constant.Runtime.DevMode[0]) { * if (Constant.Runtime.DevMode[0]) {
* System.out.println(Constant.Keywords.NonStackingList[0].list); } * System.out.println(Constant.Keywords.NonStackingList[0].list); }

View File

@@ -70,7 +70,7 @@ public class WinLoseModeHandler {
* *
*/ */
public void startNextRound() { public void startNextRound() {
AllZone.getGameAction().newGame(Constant.Runtime.HumanDeck[0], Constant.Runtime.ComputerDeck[0]); AllZone.getGameAction().newGame(Constant.Runtime.HUMAN_DECK[0], Constant.Runtime.COMPUTER_DECK[0]);
} }
/** /**

View File

@@ -16,7 +16,7 @@ public class CardColorTest {
@Test(groups = {"UnitTest", "fast"}, timeOut = 1000) @Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
public void CardColorTest1() { public void CardColorTest1() {
ManaCost mc = new ManaCost("R W U"); ManaCost mc = new ManaCost("R W U");
EnumSet<Color> col = Color.ConvertManaCostToColor(mc); EnumSet<Color> col = Color.convertManaCostToColor(mc);
System.out.println(col.toString()); System.out.println(col.toString());
} }
} }

View File

@@ -22,8 +22,8 @@ public class GuiBoosterDraftTest {
*/ */
@Test(groups = {"UnitTest", "fast"}) @Test(groups = {"UnitTest", "fast"})
public void GuiBoosterDraftTest1() { public void GuiBoosterDraftTest1() {
Constant.Runtime.gameType = GameType.Draft; Constant.Runtime.setGameType(GameType.Draft);
Constant.Runtime.HumanDeck[0] = new Deck(GameType.Sealed); Constant.Runtime.HUMAN_DECK[0] = new Deck(GameType.Sealed);
DeckEditorDraft g = new DeckEditorDraft(); DeckEditorDraft g = new DeckEditorDraft();
g.showGui(new BoosterDraft_1(CardPoolLimitation.Full)); g.showGui(new BoosterDraft_1(CardPoolLimitation.Full));

View File

@@ -23,8 +23,7 @@ public final class BraidsAssertFunctions {
*/ */
public static void assertThrowsException( public static void assertThrowsException(
@SuppressWarnings("rawtypes") final Class exnClass, @SuppressWarnings("rawtypes") final Class exnClass,
final ClumsyRunnable withScissors) final ClumsyRunnable withScissors) {
{
try { try {
withScissors.run(); withScissors.run();
} }