mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
checkstyle and refactor
This commit is contained in:
@@ -27,15 +27,15 @@ public class Util {
|
||||
* Constant.
|
||||
* <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.
|
||||
* <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>. */
|
||||
public static ThreadPoolExecutor threadPool;
|
||||
private static ThreadPoolExecutor threadPool;
|
||||
/** Constant <code>threadCount</code>. */
|
||||
private static int threadCount;
|
||||
|
||||
@@ -88,8 +88,7 @@ public class Util {
|
||||
*/
|
||||
private static void broadcast(final DatagramSocket socket,
|
||||
final byte[] data, final int port, final Enumeration<NetworkInterface> ifaces)
|
||||
throws IOException
|
||||
{
|
||||
throws IOException {
|
||||
for (NetworkInterface iface : Collections.list(ifaces)) {
|
||||
for (InetAddress address : Collections.list(iface.getInetAddresses())) {
|
||||
if (!address.isSiteLocalAddress()) {
|
||||
|
||||
@@ -149,7 +149,7 @@ public class AIPlayer extends Player {
|
||||
public final CardList discard(final int num, final SpellAbility sa, final boolean duringResolution) {
|
||||
int max = getCardsIn(Zone.Hand).size();
|
||||
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++) {
|
||||
doDiscard(discarded.get(i), sa);
|
||||
}
|
||||
@@ -293,7 +293,7 @@ public class AIPlayer extends Player {
|
||||
* @see forge.Player#discard_Chains_of_Mephistopheles()
|
||||
*/
|
||||
@Override
|
||||
protected final void discard_Chains_of_Mephistopheles() {
|
||||
protected final void discardChainsOfMephistopheles() {
|
||||
discard(null);
|
||||
drawCard();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public final class AllZone implements NewConstants {
|
||||
}
|
||||
|
||||
/** Global <code>SKIN</code>. */
|
||||
private static FSkin SKIN = null;
|
||||
private static FSkin skin = null;
|
||||
|
||||
/** Global <code>questData</code>. */
|
||||
private static forge.quest.data.QuestData questData = null;
|
||||
@@ -582,7 +582,7 @@ public final class AllZone implements NewConstants {
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public static FSkin getSkin() {
|
||||
return SKIN;
|
||||
return skin;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -596,6 +596,6 @@ public final class AllZone implements NewConstants {
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public static void setSkin(final FSkin fs) {
|
||||
SKIN = fs;
|
||||
skin = fs;
|
||||
}
|
||||
} // AllZone
|
||||
|
||||
@@ -83,7 +83,7 @@ public abstract class AllZoneUtil {
|
||||
*/
|
||||
public static CardList getCreaturesInPlay() {
|
||||
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) {
|
||||
CardList creats = player.getCardsIn(Zone.Battlefield);
|
||||
return creats.filter(CardListFilter.creatures);
|
||||
return creats.filter(CardListFilter.CREATURES);
|
||||
}
|
||||
|
||||
// /////////////// Lands
|
||||
@@ -108,7 +108,7 @@ public abstract class AllZoneUtil {
|
||||
* @return a CardList containing all lands the given player has in play
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public static CardList getLandsInPlay() {
|
||||
return getCardsIn(Zone.Battlefield).filter(CardListFilter.lands);
|
||||
return getCardsIn(Zone.Battlefield).filter(CardListFilter.LANDS);
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class Base64Coder {
|
||||
* Constant.
|
||||
* <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.
|
||||
/** 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.
|
||||
*/
|
||||
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.
|
||||
* @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;
|
||||
if (blockLen <= 0) {
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
@@ -47,6 +47,11 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
private boolean isDoubleFaced = false;
|
||||
private boolean isFlip = false;
|
||||
|
||||
/**
|
||||
* Gets the characteristics.
|
||||
*
|
||||
* @return the characteristics
|
||||
*/
|
||||
public CardCharacteristics getCharacteristics() {
|
||||
return characteristics[currentCharacteristic];
|
||||
}
|
||||
@@ -4484,7 +4489,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
+ getCounters(Counters.P1P2)
|
||||
+ getCounters(Counters.P1P0)
|
||||
- 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;
|
||||
}
|
||||
|
||||
@@ -6245,7 +6251,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
cardType = toMixedCase(cardType);
|
||||
|
||||
if (typeContains(cardType)
|
||||
|| ((isCreature() || isTribal()) && CardUtil.isACreatureType(cardType) && typeContains("AllCreatureTypes"))) {
|
||||
|| ((isCreature() || isTribal()) && CardUtil.isACreatureType(cardType)
|
||||
&& typeContains("AllCreatureTypes"))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -6257,7 +6264,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* isValid.
|
||||
* </p>
|
||||
*
|
||||
* @param Restriction
|
||||
* @param restriction
|
||||
* a {@link java.lang.String} object.
|
||||
* @param sourceController
|
||||
* a {@link forge.Player} object.
|
||||
@@ -6266,13 +6273,13 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* @return a boolean.
|
||||
*/
|
||||
@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()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String[] incR = Restriction.split("\\."); // Inclusive restrictions are
|
||||
String[] incR = restriction.split("\\."); // Inclusive restrictions are
|
||||
// Card types
|
||||
|
||||
if (incR[0].equals("Spell") && !isSpell()) {
|
||||
@@ -6304,7 +6311,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* hasProperty.
|
||||
* </p>
|
||||
*
|
||||
* @param Property
|
||||
* @param property
|
||||
* a {@link java.lang.String} object.
|
||||
* @param sourceController
|
||||
* a {@link forge.Player} object.
|
||||
@@ -6313,52 +6320,52 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* @return a boolean.
|
||||
*/
|
||||
@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.
|
||||
if (Property.startsWith("named")) {
|
||||
if (!getName().equals(Property.substring(5))) {
|
||||
if (property.startsWith("named")) {
|
||||
if (!getName().equals(property.substring(5))) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("notnamed")) {
|
||||
if (getName().equals(Property.substring(8))) {
|
||||
} else if (property.startsWith("notnamed")) {
|
||||
if (getName().equals(property.substring(8))) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("sameName")) {
|
||||
} else if (property.startsWith("sameName")) {
|
||||
if (!getName().equals(source.getName())) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("NamedCard")) {
|
||||
} else if (property.equals("NamedCard")) {
|
||||
if (!getName().equals(source.getNamedCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// ... Card colors
|
||||
else if (Property.contains("White") || Property.contains("Blue") || Property.contains("Black")
|
||||
|| Property.contains("Red") || Property.contains("Green") || Property.contains("Colorless")) {
|
||||
if (Property.startsWith("non")) {
|
||||
if (CardUtil.getColors(this).contains(Property.substring(3).toLowerCase())) {
|
||||
else if (property.contains("White") || property.contains("Blue") || property.contains("Black")
|
||||
|| property.contains("Red") || property.contains("Green") || property.contains("Colorless")) {
|
||||
if (property.startsWith("non")) {
|
||||
if (CardUtil.getColors(this).contains(property.substring(3).toLowerCase())) {
|
||||
return false;
|
||||
}
|
||||
} else if (!CardUtil.getColors(this).contains(Property.toLowerCase())) {
|
||||
} else if (!CardUtil.getColors(this).contains(property.toLowerCase())) {
|
||||
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;
|
||||
}
|
||||
if (!Property.startsWith("non") && (CardUtil.getColors(this).size() <= 1)) {
|
||||
if (!property.startsWith("non") && (CardUtil.getColors(this).size() <= 1)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.contains("MonoColor")) {
|
||||
} else if (property.contains("MonoColor")) {
|
||||
// ... 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;
|
||||
}
|
||||
if (!Property.startsWith("non") && (CardUtil.getColors(this).size() > 1 || isColorless())) {
|
||||
if (!property.startsWith("non") && (CardUtil.getColors(this).size() > 1 || isColorless())) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("ChosenColor")) {
|
||||
} else if (property.equals("ChosenColor")) {
|
||||
// Should this match All chosen colors, or any? Default to first
|
||||
// chosen for now until it matters.
|
||||
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))) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("DoubleFaced")) {
|
||||
} else if (property.equals("DoubleFaced")) {
|
||||
if (!isDoubleFaced) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("Flip")) {
|
||||
} else if (property.equals("Flip")) {
|
||||
if (!isFlip) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("YouCtrl")) {
|
||||
} else if (property.startsWith("YouCtrl")) {
|
||||
if (!getController().isPlayer(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("YouDontCtrl")) {
|
||||
} else if (property.startsWith("YouDontCtrl")) {
|
||||
if (getController().isPlayer(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("EnchantedPlayerCtrl")) {
|
||||
} else if (property.startsWith("EnchantedPlayerCtrl")) {
|
||||
Object o = source.getEnchanting();
|
||||
if (o instanceof Player) {
|
||||
if (!getController().isPlayer((Player) o)) {
|
||||
@@ -6392,110 +6399,110 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
} else { // source not enchanting a player
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("YouOwn")) {
|
||||
} else if (property.startsWith("YouOwn")) {
|
||||
if (!getOwner().isPlayer(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("YouDontOwn")) {
|
||||
} else if (property.startsWith("YouDontOwn")) {
|
||||
if (getOwner().isPlayer(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("OwnerDoesntControl")) {
|
||||
} else if (property.startsWith("OwnerDoesntControl")) {
|
||||
if (getOwner().isPlayer(getController())) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("ControllerControls")) {
|
||||
String type = Property.substring(18);
|
||||
} else if (property.startsWith("ControllerControls")) {
|
||||
String type = property.substring(18);
|
||||
CardList list = getController().getCardsIn(Zone.Battlefield);
|
||||
if (list.getType(type).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("Other")) {
|
||||
} else if (property.startsWith("Other")) {
|
||||
if (this.equals(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("Self")) {
|
||||
} else if (property.startsWith("Self")) {
|
||||
if (!this.equals(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("AttachedBy")) {
|
||||
} else if (property.startsWith("AttachedBy")) {
|
||||
if (!equippedBy.contains(source) && !enchantedBy.contains(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("Attached")) {
|
||||
} else if (property.startsWith("Attached")) {
|
||||
if (!equipping.contains(source) && !source.equals(enchanting)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("EnchantedBy")) {
|
||||
} else if (property.startsWith("EnchantedBy")) {
|
||||
if (!enchantedBy.contains(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("NotEnchantedBy")) {
|
||||
} else if (property.startsWith("NotEnchantedBy")) {
|
||||
if (enchantedBy.contains(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("Enchanted")) {
|
||||
} else if (property.startsWith("Enchanted")) {
|
||||
if (!source.equals(enchanting)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("EquippedBy")) {
|
||||
} else if (property.startsWith("EquippedBy")) {
|
||||
if (!equippedBy.contains(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("Equipped")) {
|
||||
} else if (property.startsWith("Equipped")) {
|
||||
if (!equipping.contains(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("HauntedBy")) {
|
||||
} else if (property.startsWith("HauntedBy")) {
|
||||
if (!hauntedBy.contains(source)) {
|
||||
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);
|
||||
if (!list.getAbove(source, this)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("DirectlyAbove")) { // "Are Directly Above"
|
||||
} else if (property.startsWith("DirectlyAbove")) { // "Are Directly Above"
|
||||
// Source
|
||||
CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
|
||||
if (!list.getDirectlyAbove(source, this)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("TopGraveyardCreature")) {
|
||||
} else if (property.startsWith("TopGraveyardCreature")) {
|
||||
CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
|
||||
list = list.getType("Creature");
|
||||
list.reverse();
|
||||
if (list.isEmpty() || !this.equals(list.get(0))) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("TopGraveyard")) {
|
||||
} else if (property.startsWith("TopGraveyard")) {
|
||||
CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
|
||||
list.reverse();
|
||||
if (list.isEmpty() || !this.equals(list.get(0))) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("TopLibrary")) {
|
||||
} else if (property.startsWith("TopLibrary")) {
|
||||
CardList list = this.getOwner().getCardsIn(Zone.Library);
|
||||
if (list.isEmpty() || !this.equals(list.get(0))) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("Cloned")) {
|
||||
} else if (property.startsWith("Cloned")) {
|
||||
if (cloneOrigin == null || !cloneOrigin.equals(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("DamagedBy")) {
|
||||
} else if (property.startsWith("DamagedBy")) {
|
||||
if (!receivedDamageFromThisTurn.containsKey(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("Damaged")) {
|
||||
} else if (property.startsWith("Damaged")) {
|
||||
if (!dealtDamageToThisTurn.containsKey(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("SharesColorWith")) {
|
||||
} else if (property.startsWith("SharesColorWith")) {
|
||||
if (!sharesColorWith(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("withFlashback")) {
|
||||
} else if (property.startsWith("withFlashback")) {
|
||||
boolean fb = false;
|
||||
if (hasStartOfUnHiddenKeyword("Flashback")) {
|
||||
fb = true;
|
||||
@@ -6508,133 +6515,133 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
if (!fb) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("with")) {
|
||||
} else if (property.startsWith("with")) {
|
||||
// ... Card keywords
|
||||
if (Property.startsWith("without") && hasStartOfUnHiddenKeyword(Property.substring(7))) {
|
||||
if (property.startsWith("without") && hasStartOfUnHiddenKeyword(property.substring(7))) {
|
||||
return false;
|
||||
}
|
||||
if (!Property.startsWith("without") && !hasStartOfUnHiddenKeyword(Property.substring(4))) {
|
||||
if (!property.startsWith("without") && !hasStartOfUnHiddenKeyword(property.substring(4))) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("tapped")) {
|
||||
} else if (property.startsWith("tapped")) {
|
||||
if (!isTapped()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("untapped")) {
|
||||
} else if (property.startsWith("untapped")) {
|
||||
if (!isUntapped()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("faceDown")) {
|
||||
} else if (property.startsWith("faceDown")) {
|
||||
if (!isFaceDown()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("faceUp")) {
|
||||
} else if (property.startsWith("faceUp")) {
|
||||
if (isFaceDown()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("hasLevelUp")) {
|
||||
} else if (property.startsWith("hasLevelUp")) {
|
||||
if (!hasLevelUp()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("enteredBattlefieldThisTurn")) {
|
||||
} else if (property.startsWith("enteredBattlefieldThisTurn")) {
|
||||
if (!(getTurnInZone() == AllZone.getPhase().getTurn())) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("dealtDamageToYouThisTurn")) {
|
||||
} else if (property.startsWith("dealtDamageToYouThisTurn")) {
|
||||
if (!(dealtDmgToHumanThisTurn && getController().isPlayer(AllZone.getComputerPlayer()))
|
||||
&& !(dealtDmgToComputerThisTurn && getController().isPlayer(AllZone.getHumanPlayer()))) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("wasDealtDamageThisTurn")) {
|
||||
} else if (property.startsWith("wasDealtDamageThisTurn")) {
|
||||
if ((getReceivedDamageFromThisTurn().keySet()).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("greatestPower")) {
|
||||
} else if (property.startsWith("greatestPower")) {
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay();
|
||||
for (Card crd : list) {
|
||||
if (crd.getNetAttack() > getNetAttack()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (Property.startsWith("leastPower")) {
|
||||
} else if (property.startsWith("leastPower")) {
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay();
|
||||
for (Card crd : list) {
|
||||
if (crd.getNetAttack() < getNetAttack()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (Property.startsWith("greatestCMC")) {
|
||||
} else if (property.startsWith("greatestCMC")) {
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay();
|
||||
for (Card crd : list) {
|
||||
if (crd.getCMC() > getCMC()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (Property.startsWith("enchanted")) {
|
||||
} else if (property.startsWith("enchanted")) {
|
||||
if (!isEnchanted()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("unenchanted")) {
|
||||
} else if (property.startsWith("unenchanted")) {
|
||||
if (isEnchanted()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("enchanting")) {
|
||||
} else if (property.startsWith("enchanting")) {
|
||||
if (!isEnchanting()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("equipped")) {
|
||||
} else if (property.startsWith("equipped")) {
|
||||
if (!isEquipped()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("unequipped")) {
|
||||
} else if (property.startsWith("unequipped")) {
|
||||
if (isEquipped()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("equipping")) {
|
||||
} else if (property.startsWith("equipping")) {
|
||||
if (!isEquipping()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("token")) {
|
||||
} else if (property.startsWith("token")) {
|
||||
if (!isToken()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("nonToken")) {
|
||||
} else if (property.startsWith("nonToken")) {
|
||||
if (isToken()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("hasXCost")) {
|
||||
} else if (property.startsWith("hasXCost")) {
|
||||
if (getSpellAbility().length > 0) {
|
||||
if (!getSpellAbility()[0].isXCost()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (Property.startsWith("power") || // 8/10
|
||||
Property.startsWith("toughness") || Property.startsWith("cmc")) {
|
||||
} else if (property.startsWith("power") || // 8/10
|
||||
property.startsWith("toughness") || property.startsWith("cmc")) {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
|
||||
if (Property.startsWith("power")) {
|
||||
if (property.startsWith("power")) {
|
||||
z = 7;
|
||||
y = getNetAttack();
|
||||
} else if (Property.startsWith("toughness")) {
|
||||
} else if (property.startsWith("toughness")) {
|
||||
z = 11;
|
||||
y = getNetDefense();
|
||||
} else if (Property.startsWith("cmc")) {
|
||||
} else if (property.startsWith("cmc")) {
|
||||
z = 5;
|
||||
y = getCMC();
|
||||
}
|
||||
|
||||
if (Property.substring(z).equals("X")) {
|
||||
if (property.substring(z).equals("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"));
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
* 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]+.*$");
|
||||
* 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
|
||||
// digits doesn't matter
|
||||
int number = 0;
|
||||
String[] splitProperty = Property.split("_");
|
||||
String[] splitProperty = property.split("_");
|
||||
String strNum = splitProperty[1].substring(2);
|
||||
String comparator = splitProperty[1].substring(0, 2);
|
||||
String counterType = "";
|
||||
@@ -6675,78 +6682,78 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
if (!AllZoneUtil.compare(actualnumber, comparator, number)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("attacking")) {
|
||||
} else if (property.startsWith("attacking")) {
|
||||
if (!isAttacking()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("notattacking")) {
|
||||
} else if (property.startsWith("notattacking")) {
|
||||
if (isAttacking()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("blocking")) {
|
||||
} else if (property.equals("blocking")) {
|
||||
if (!isBlocking()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("blockingSource")) {
|
||||
} else if (property.startsWith("blockingSource")) {
|
||||
if (!isBlocking(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("notblocking")) {
|
||||
} else if (property.startsWith("notblocking")) {
|
||||
if (isBlocking()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("blocked")) {
|
||||
} else if (property.equals("blocked")) {
|
||||
if (!AllZone.getCombat().isBlocked(this)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("blockedBySource")) {
|
||||
} else if (property.startsWith("blockedBySource")) {
|
||||
if (!isBlockedBy(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("unblocked")) {
|
||||
} else if (property.startsWith("unblocked")) {
|
||||
if (!AllZone.getCombat().isUnblocked(this)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("kicked")) {
|
||||
} else if (property.startsWith("kicked")) {
|
||||
if (!isKicked()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("notkicked")) {
|
||||
} else if (property.startsWith("notkicked")) {
|
||||
if (isKicked()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("evoked")) {
|
||||
} else if (property.startsWith("evoked")) {
|
||||
if (!isEvoked()) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("HasDevoured")) {
|
||||
} else if (property.equals("HasDevoured")) {
|
||||
if (devouredCards.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("HasNotDevoured")) {
|
||||
} else if (property.equals("HasNotDevoured")) {
|
||||
if (devouredCards.size() != 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.startsWith("non")) {
|
||||
} else if (property.startsWith("non")) {
|
||||
// ... Other Card types
|
||||
if (isType(Property.substring(3))) {
|
||||
if (isType(property.substring(3))) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("CostsPhyrexianMana")) {
|
||||
} else if (property.equals("CostsPhyrexianMana")) {
|
||||
if (!getCharacteristics().getManaCost().contains("P")) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("IsRemembered")) {
|
||||
} else if (property.equals("IsRemembered")) {
|
||||
if (!source.getRemembered().contains(this)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (Property.equals("ChosenType")) {
|
||||
if (property.equals("ChosenType")) {
|
||||
if (!isType(source.getChosenType())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!isType(Property)) {
|
||||
if (!isType(property)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -7453,7 +7460,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
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;
|
||||
this.subtractCounter(Counters.P1P1, 1);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class CardFilter {
|
||||
* a {@link java.lang.String} 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;
|
||||
String s;
|
||||
s = "";
|
||||
@@ -92,15 +92,15 @@ public class CardFilter {
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList CardListColorFilter(final CardList all, final String name) {
|
||||
Card CardName = new Card();
|
||||
public final CardList cardListColorFilter(final CardList all, final String name) {
|
||||
Card cardName = new Card();
|
||||
CardList listFilter = new CardList();
|
||||
|
||||
if (name == "black") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(CardName).contains(Constant.Color.Black)) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(cardName).contains(Constant.Color.Black)) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -108,9 +108,9 @@ public class CardFilter {
|
||||
|
||||
if (name == "blue") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(CardName).contains(Constant.Color.Blue)) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(cardName).contains(Constant.Color.Blue)) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -118,9 +118,9 @@ public class CardFilter {
|
||||
|
||||
if (name == "green") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(CardName).contains(Constant.Color.Green)) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(cardName).contains(Constant.Color.Green)) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -128,9 +128,9 @@ public class CardFilter {
|
||||
|
||||
if (name == "red") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(CardName).contains(Constant.Color.Red)) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(cardName).contains(Constant.Color.Red)) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -138,9 +138,9 @@ public class CardFilter {
|
||||
|
||||
if (name == "white") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(CardName).contains(Constant.Color.White)) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(cardName).contains(Constant.Color.White)) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -148,9 +148,9 @@ public class CardFilter {
|
||||
|
||||
if (name.equals("colorless")) {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(CardName).contains(Constant.Color.Colorless)) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!CardUtil.getColors(cardName).contains(Constant.Color.Colorless)) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -172,15 +172,15 @@ public class CardFilter {
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList CardListTypeFilter(final CardList all, final String name) {
|
||||
Card CardName = new Card();
|
||||
public final CardList cardListTypeFilter(final CardList all, final String name) {
|
||||
Card cardName = new Card();
|
||||
CardList listFilter = new CardList();
|
||||
|
||||
if (name == "artifact") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardName.isArtifact()) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!cardName.isArtifact()) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -188,9 +188,9 @@ public class CardFilter {
|
||||
|
||||
if (name == "creature") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardName.isCreature()) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!cardName.isCreature()) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -198,9 +198,9 @@ public class CardFilter {
|
||||
|
||||
if (name == "enchantment") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardName.isEnchantment()) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!cardName.isEnchantment()) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -208,9 +208,9 @@ public class CardFilter {
|
||||
|
||||
if (name == "instant") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardName.isInstant()) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!cardName.isInstant()) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -218,9 +218,9 @@ public class CardFilter {
|
||||
|
||||
if (name == "land") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardName.isLand()) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!cardName.isLand()) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -228,9 +228,9 @@ public class CardFilter {
|
||||
|
||||
if (name == "planeswalker") {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardName.isPlaneswalker()) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!cardName.isPlaneswalker()) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -238,9 +238,9 @@ public class CardFilter {
|
||||
|
||||
if (name.equals("sorcery")) {
|
||||
for (int i = 0; i < all.size(); i++) {
|
||||
CardName = all.getCard(i);
|
||||
if (!CardName.isSorcery()) {
|
||||
listFilter.add(CardName);
|
||||
cardName = all.getCard(i);
|
||||
if (!cardName.isSorcery()) {
|
||||
listFilter.add(cardName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all cards that are tapped.
|
||||
*/
|
||||
CardListFilter tapped = new CardListFilter() {
|
||||
CardListFilter TAPPED = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isTapped();
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all cards that are untapped.
|
||||
*/
|
||||
CardListFilter untapped = new CardListFilter() {
|
||||
CardListFilter UNTAPPED = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isUntapped();
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all creatures.
|
||||
*/
|
||||
CardListFilter creatures = new CardListFilter() {
|
||||
CardListFilter CREATURES = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isCreature();
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all enchantments.
|
||||
*/
|
||||
CardListFilter enchantments = new CardListFilter() {
|
||||
CardListFilter ENCHANTMENTS = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isEnchantment();
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all equipment.
|
||||
*/
|
||||
CardListFilter equipment = new CardListFilter() {
|
||||
CardListFilter EQUIPMENT = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isEquipment();
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all unenchanted cards in a list.
|
||||
*/
|
||||
CardListFilter unenchanted = new CardListFilter() {
|
||||
CardListFilter UNENCHANTED = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return !c.isEnchanted();
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all enchanted cards in a list.
|
||||
*/
|
||||
CardListFilter enchanted = new CardListFilter() {
|
||||
CardListFilter ENCHANTED = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isEnchanted();
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all nontoken cards.
|
||||
*/
|
||||
CardListFilter nonToken = new CardListFilter() {
|
||||
CardListFilter NON_TOKEN = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return !c.isToken();
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all token cards.
|
||||
*/
|
||||
CardListFilter token = new CardListFilter() {
|
||||
CardListFilter TOKEN = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isToken();
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all nonbasic lands.
|
||||
*/
|
||||
CardListFilter nonBasicLand = new CardListFilter() {
|
||||
CardListFilter NON_BASIC_LAND = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return !c.isBasicLand();
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all basicLands.
|
||||
*/
|
||||
CardListFilter basicLands = new CardListFilter() {
|
||||
CardListFilter BASIC_LANDS = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
// the isBasicLand() check here may be sufficient...
|
||||
return c.isLand() && c.isBasicLand();
|
||||
@@ -123,7 +123,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all artifacts.
|
||||
*/
|
||||
CardListFilter artifacts = new CardListFilter() {
|
||||
CardListFilter ARTIFACTS = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isArtifact();
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all nonartifacts.
|
||||
*/
|
||||
CardListFilter nonartifacts = new CardListFilter() {
|
||||
CardListFilter NON_ARTIFACTS = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return !c.isArtifact();
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all lands.
|
||||
*/
|
||||
CardListFilter lands = new CardListFilter() {
|
||||
CardListFilter LANDS = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isLand();
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all nonlands.
|
||||
*/
|
||||
CardListFilter nonlands = new CardListFilter() {
|
||||
CardListFilter NON_LANDS = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return !c.isLand();
|
||||
}
|
||||
@@ -159,7 +159,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all cards that are black.
|
||||
*/
|
||||
CardListFilter black = new CardListFilter() {
|
||||
CardListFilter BLACK = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isBlack();
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all cards that are blue.
|
||||
*/
|
||||
CardListFilter blue = new CardListFilter() {
|
||||
CardListFilter BLUE = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isBlue();
|
||||
}
|
||||
@@ -177,7 +177,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all cards that are green.
|
||||
*/
|
||||
CardListFilter green = new CardListFilter() {
|
||||
CardListFilter GREEN = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isGreen();
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all cards that are red.
|
||||
*/
|
||||
CardListFilter red = new CardListFilter() {
|
||||
CardListFilter RED = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isRed();
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public interface CardListFilter {
|
||||
/**
|
||||
* a CardListFilter to get all cards that are white.
|
||||
*/
|
||||
CardListFilter white = new CardListFilter() {
|
||||
CardListFilter WHITE = new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.isWhite();
|
||||
}
|
||||
|
||||
@@ -411,7 +411,8 @@ public final class CardUtil {
|
||||
return c.getEquipping().get(0);
|
||||
// else if(relation.startsWith("target ")) return c.getTargetCard();
|
||||
} 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>();
|
||||
|
||||
// types.addAll(getCardTypes());
|
||||
types.addAll(Constant.CardTypes.cardTypes[0].list);
|
||||
types.addAll(Constant.CardTypes.CARD_TYPES[0].getList());
|
||||
|
||||
// not currently used by Forge
|
||||
types.add("Plane");
|
||||
@@ -468,7 +469,7 @@ public final class CardUtil {
|
||||
// types.add("Sorcery");
|
||||
// types.add("Tribal");
|
||||
|
||||
types.addAll(Constant.CardTypes.cardTypes[0].list);
|
||||
types.addAll(Constant.CardTypes.CARD_TYPES[0].getList());
|
||||
|
||||
return types;
|
||||
}
|
||||
@@ -484,7 +485,7 @@ public final class CardUtil {
|
||||
public static ArrayList<String> getBasicTypes() {
|
||||
ArrayList<String> types = new ArrayList<String>();
|
||||
|
||||
types.addAll(Constant.CardTypes.basicTypes[0].list);
|
||||
types.addAll(Constant.CardTypes.BASIC_TYPES[0].getList());
|
||||
|
||||
return types;
|
||||
}
|
||||
@@ -497,8 +498,8 @@ public final class CardUtil {
|
||||
public static ArrayList<String> getLandTypes() {
|
||||
ArrayList<String> types = new ArrayList<String>();
|
||||
|
||||
types.addAll(Constant.CardTypes.basicTypes[0].list);
|
||||
types.addAll(Constant.CardTypes.landTypes[0].list);
|
||||
types.addAll(Constant.CardTypes.BASIC_TYPES[0].getList());
|
||||
types.addAll(Constant.CardTypes.LAND_TYPES[0].getList());
|
||||
|
||||
return types;
|
||||
}
|
||||
@@ -514,7 +515,7 @@ public final class CardUtil {
|
||||
public static ArrayList<String> getCreatureTypes() {
|
||||
ArrayList<String> types = new ArrayList<String>();
|
||||
|
||||
types.addAll(Constant.CardTypes.creatureTypes[0].list);
|
||||
types.addAll(Constant.CardTypes.CREATURE_TYPES[0].getList());
|
||||
|
||||
return types;
|
||||
}
|
||||
@@ -530,7 +531,7 @@ public final class CardUtil {
|
||||
*/
|
||||
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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
|
||||
@@ -608,7 +609,7 @@ public final class CardUtil {
|
||||
* @return a boolean.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,7 @@ public class Card_Color {
|
||||
*/
|
||||
Card_Color(final ManaCost mc, final Card c, final boolean addToColors, final boolean baseColor) {
|
||||
additional = addToColors;
|
||||
col = Color.ConvertManaCostToColor(mc);
|
||||
col = Color.convertManaCostToColor(mc);
|
||||
effectingCard = c;
|
||||
if (baseColor) {
|
||||
stamp = 0;
|
||||
@@ -94,7 +94,7 @@ public class Card_Color {
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
public Card_Color(final Card c) {
|
||||
col = Color.Colorless();
|
||||
col = Color.colorless();
|
||||
additional = false;
|
||||
stamp = 0;
|
||||
effectingCard = c;
|
||||
@@ -110,7 +110,7 @@ public class Card_Color {
|
||||
* @return a boolean.
|
||||
*/
|
||||
final boolean addToCardColor(final String s) {
|
||||
Color c = Color.ConvertFromString(s);
|
||||
Color c = Color.convertFromString(s);
|
||||
if (!col.contains(c)) {
|
||||
col.add(c);
|
||||
return true;
|
||||
|
||||
@@ -49,7 +49,7 @@ public enum Color {
|
||||
*
|
||||
* @return a {@link java.util.EnumSet} object.
|
||||
*/
|
||||
public static EnumSet<Color> Colorless() {
|
||||
public static EnumSet<Color> colorless() {
|
||||
EnumSet<Color> colors = EnumSet.of(Color.Colorless);
|
||||
return colors;
|
||||
}
|
||||
@@ -63,11 +63,11 @@ public enum Color {
|
||||
* an array of {@link java.lang.String} objects.
|
||||
* @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);
|
||||
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
colors.add(ConvertFromString(s[i]));
|
||||
colors.add(convertFromString(s[i]));
|
||||
}
|
||||
|
||||
if (colors.size() > 1) {
|
||||
@@ -86,7 +86,7 @@ public enum Color {
|
||||
* a {@link java.lang.String} 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)) {
|
||||
return Color.White;
|
||||
@@ -113,7 +113,7 @@ public enum Color {
|
||||
* a {@link forge.card.mana.ManaCost} 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);
|
||||
|
||||
if (m.isColor("W")) {
|
||||
|
||||
@@ -26,7 +26,8 @@ public class ColorChanger {
|
||||
* a boolean.
|
||||
* @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) {
|
||||
Card_Color.increaseTimestamp();
|
||||
}
|
||||
|
||||
@@ -160,7 +160,8 @@ public class CombatUtil {
|
||||
|
||||
if (attacker.hasKeyword("Islandwalk")) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -312,7 +313,8 @@ public class CombatUtil {
|
||||
}
|
||||
|
||||
// "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) {
|
||||
if (canBlock(attacker, blocker, combat)) {
|
||||
return false;
|
||||
@@ -433,9 +435,9 @@ public class CombatUtil {
|
||||
for (String kw : blocker.getKeyword()) {
|
||||
if (kw.startsWith("CARDNAME can't block ")) {
|
||||
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));
|
||||
if (attacker.getUniqueNumber() == ID) {
|
||||
if (attacker.getUniqueNumber() == id) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -463,18 +465,20 @@ public class CombatUtil {
|
||||
}
|
||||
if (blocker.getNetAttack() > attacker.getNetAttack()
|
||||
&& 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;
|
||||
}
|
||||
if (blocker.getNetAttack() >= attacker.getNetDefense()
|
||||
&& 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;
|
||||
}
|
||||
|
||||
if (attacker.hasStartOfKeyword("CantBeBlockedBy")) {
|
||||
int KeywordPosition = attacker.getKeywordPosition("CantBeBlockedBy");
|
||||
String parse = attacker.getKeyword().get(KeywordPosition).toString();
|
||||
int keywordPosition = attacker.getKeywordPosition("CantBeBlockedBy");
|
||||
String parse = attacker.getKeyword().get(keywordPosition).toString();
|
||||
String[] k = parse.split(" ", 2);
|
||||
final String[] restrictions = k[1].split(",");
|
||||
if (blocker.isValid(restrictions, attacker.getController(), attacker)) {
|
||||
@@ -483,8 +487,8 @@ public class CombatUtil {
|
||||
}
|
||||
|
||||
if (blocker.hasStartOfKeyword("CantBlock")) {
|
||||
int KeywordPosition = blocker.getKeywordPosition("CantBlock");
|
||||
String parse = blocker.getKeyword().get(KeywordPosition).toString();
|
||||
int keywordPosition = blocker.getKeywordPosition("CantBlock");
|
||||
String parse = blocker.getKeyword().get(keywordPosition).toString();
|
||||
String[] k = parse.split(" ", 2);
|
||||
final String[] restrictions = k[1].split(",");
|
||||
if (attacker.isValid(restrictions, blocker.getController(), blocker)) {
|
||||
@@ -572,7 +576,8 @@ public class CombatUtil {
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -654,7 +659,8 @@ public class CombatUtil {
|
||||
list = list.filter(new CardListFilter() {
|
||||
public boolean addCard(final Card ct) {
|
||||
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")));
|
||||
}
|
||||
});
|
||||
@@ -1088,7 +1094,8 @@ public class CombatUtil {
|
||||
}
|
||||
|
||||
} // flanking
|
||||
if (attacker.hasKeyword("Indestructible") && !(defender.hasKeyword("Wither") || defender.hasKeyword("Infect"))) {
|
||||
if (attacker.hasKeyword("Indestructible") && !(defender.hasKeyword("Wither")
|
||||
|| defender.hasKeyword("Infect"))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1346,8 +1353,8 @@ public class CombatUtil {
|
||||
continue;
|
||||
}
|
||||
String ability = source.getSVar(trigParams.get("Execute"));
|
||||
AbilityFactory AF = new AbilityFactory();
|
||||
HashMap<String, String> abilityParams = AF.getMapParams(ability, source);
|
||||
AbilityFactory abilityFactory = new AbilityFactory();
|
||||
HashMap<String, String> abilityParams = abilityFactory.getMapParams(ability, source);
|
||||
if (abilityParams.containsKey("AB") && !abilityParams.get("AB").equals("Pump")) {
|
||||
continue;
|
||||
}
|
||||
@@ -1417,8 +1424,8 @@ public class CombatUtil {
|
||||
continue;
|
||||
}
|
||||
String ability = source.getSVar(trigParams.get("Execute"));
|
||||
AbilityFactory AF = new AbilityFactory();
|
||||
HashMap<String, String> abilityParams = AF.getMapParams(ability, source);
|
||||
AbilityFactory abilityFactory = new AbilityFactory();
|
||||
HashMap<String, String> abilityParams = abilityFactory.getMapParams(ability, source);
|
||||
if (abilityParams.containsKey("AB") && !abilityParams.get("AB").equals("Pump")) {
|
||||
continue;
|
||||
}
|
||||
@@ -1497,8 +1504,8 @@ public class CombatUtil {
|
||||
continue;
|
||||
}
|
||||
String ability = source.getSVar(trigParams.get("Execute"));
|
||||
AbilityFactory AF = new AbilityFactory();
|
||||
HashMap<String, String> abilityParams = AF.getMapParams(ability, source);
|
||||
AbilityFactory abilityFactory = new AbilityFactory();
|
||||
HashMap<String, String> abilityParams = abilityFactory.getMapParams(ability, source);
|
||||
if (abilityParams.containsKey("ValidTgts") || abilityParams.containsKey("Tgt")) {
|
||||
continue; // targeted pumping not supported
|
||||
}
|
||||
@@ -1580,8 +1587,8 @@ public class CombatUtil {
|
||||
continue;
|
||||
}
|
||||
String ability = source.getSVar(trigParams.get("Execute"));
|
||||
AbilityFactory AF = new AbilityFactory();
|
||||
HashMap<String, String> abilityParams = AF.getMapParams(ability, source);
|
||||
AbilityFactory abilityFactory = new AbilityFactory();
|
||||
HashMap<String, String> abilityParams = abilityFactory.getMapParams(ability, source);
|
||||
if (abilityParams.containsKey("ValidTgts") || abilityParams.containsKey("Tgt")) {
|
||||
continue; // targeted pumping not supported
|
||||
}
|
||||
@@ -1589,7 +1596,8 @@ public class CombatUtil {
|
||||
// DealDamage triggers
|
||||
if ((abilityParams.containsKey("AB") && abilityParams.get("AB").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;
|
||||
}
|
||||
int damage = 0;
|
||||
@@ -2212,7 +2220,7 @@ public class CombatUtil {
|
||||
} else if (c.getName().equals("Spectral Force")) {
|
||||
Player opp = c.getController().getOpponent();
|
||||
CardList list = opp.getCardsIn(Zone.Battlefield);
|
||||
list = list.filter(CardListFilter.black);
|
||||
list = list.filter(CardListFilter.BLACK);
|
||||
if (list.size() == 0) {
|
||||
c.addExtrinsicKeyword("This card doesn't untap during your next untap step.");
|
||||
}
|
||||
@@ -2547,25 +2555,25 @@ public class CombatUtil {
|
||||
}
|
||||
});
|
||||
Player player = attacker.getController();
|
||||
Card Enchantment = null;
|
||||
Card enchantment = null;
|
||||
if (player.isHuman()) {
|
||||
Card[] Target = new Card[enchantments.size()];
|
||||
Card[] target = new Card[enchantments.size()];
|
||||
for (int j = 0; j < enchantments.size(); j++) {
|
||||
Card crd = enchantments.get(j);
|
||||
Target[j] = crd;
|
||||
target[j] = crd;
|
||||
}
|
||||
Object check = GuiUtils.getChoiceOptional("Select enchantment to enchant exalted creature",
|
||||
Target);
|
||||
target);
|
||||
if (check != null) {
|
||||
Enchantment = ((Card) check);
|
||||
enchantment = ((Card) check);
|
||||
}
|
||||
} else {
|
||||
Enchantment = CardFactoryUtil.AI_getBestEnchantment(enchantments, attacker, false);
|
||||
enchantment = CardFactoryUtil.AI_getBestEnchantment(enchantments, attacker, false);
|
||||
}
|
||||
if (Enchantment != null && AllZoneUtil.isCardInPlay(attacker)) {
|
||||
GameAction.changeZone(AllZone.getZoneOf(Enchantment),
|
||||
Enchantment.getOwner().getZone(Constant.Zone.Battlefield), Enchantment);
|
||||
Enchantment.enchantEntity(attacker);
|
||||
if (enchantment != null && AllZoneUtil.isCardInPlay(attacker)) {
|
||||
GameAction.changeZone(AllZone.getZoneOf(enchantment),
|
||||
enchantment.getOwner().getZone(Constant.Zone.Battlefield), enchantment);
|
||||
enchantment.enchantEntity(attacker);
|
||||
}
|
||||
attacker.getController().shuffle();
|
||||
} // resolve
|
||||
|
||||
@@ -10,7 +10,7 @@ package forge;
|
||||
*/
|
||||
public interface Command extends java.io.Serializable {
|
||||
/** Constant <code>Blank</code>. */
|
||||
Command Blank = new Command() {
|
||||
Command BLANK = new Command() {
|
||||
|
||||
private static final long serialVersionUID = 2689172297036001710L;
|
||||
|
||||
|
||||
@@ -21,28 +21,28 @@ public interface Computer {
|
||||
* begin_combat.
|
||||
* </p>
|
||||
*/
|
||||
void begin_combat();
|
||||
void beginCombat();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* declare_attackers.
|
||||
* </p>
|
||||
*/
|
||||
void declare_attackers();
|
||||
void declareAttackers();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* declare_attackers_after.
|
||||
* </p>
|
||||
*/
|
||||
void declare_attackers_after(); // can play Instants and Abilities
|
||||
void declareAttackersAfter(); // can play Instants and Abilities
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* declare_blockers.
|
||||
* </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
|
||||
|
||||
/**
|
||||
@@ -50,14 +50,14 @@ public interface Computer {
|
||||
* declare_blockers_after.
|
||||
* </p>
|
||||
*/
|
||||
void declare_blockers_after(); // can play Instants and Abilities
|
||||
void declareBlockersAfter(); // can play Instants and Abilities
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* end_of_combat.
|
||||
* </p>
|
||||
*/
|
||||
void end_of_combat();
|
||||
void endOfCombat();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -71,13 +71,13 @@ public interface Computer {
|
||||
* end_of_turn.
|
||||
* </p>
|
||||
*/
|
||||
void end_of_turn();// end of Human's turn
|
||||
void endOfTurn(); // end of Human's turn
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* stack_not_empty.
|
||||
* </p>
|
||||
*/
|
||||
void stack_not_empty();
|
||||
void stackNotEmpty();
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ComputerAI_General implements Computer {
|
||||
ComputerUtil.chooseLandsToPlay();
|
||||
|
||||
if (AllZone.getStack().size() == 0) {
|
||||
playCards(Constant.Phase.Main1);
|
||||
playCards(Constant.Phase.MAIN1);
|
||||
} else {
|
||||
stackResponse();
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public class ComputerAI_General implements Computer {
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
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);
|
||||
|
||||
@@ -146,7 +146,8 @@ public class ComputerAI_General implements Computer {
|
||||
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) {
|
||||
return true;
|
||||
}
|
||||
@@ -367,7 +368,7 @@ public class ComputerAI_General implements Computer {
|
||||
* begin_combat.
|
||||
* </p>
|
||||
*/
|
||||
public final void begin_combat() {
|
||||
public final void beginCombat() {
|
||||
stackResponse();
|
||||
}
|
||||
|
||||
@@ -376,7 +377,7 @@ public class ComputerAI_General implements Computer {
|
||||
* declare_attackers.
|
||||
* </p>
|
||||
*/
|
||||
public final void declare_attackers() {
|
||||
public final void declareAttackers() {
|
||||
// 12/2/10(sol) the decision making here has moved to getAttackers()
|
||||
|
||||
AllZone.setCombat(ComputerUtil.getAttackers());
|
||||
@@ -403,7 +404,7 @@ public class ComputerAI_General implements Computer {
|
||||
* declare_attackers_after.
|
||||
* </p>
|
||||
*/
|
||||
public final void declare_attackers_after() {
|
||||
public final void declareAttackersAfter() {
|
||||
stackResponse();
|
||||
}
|
||||
|
||||
@@ -412,7 +413,7 @@ public class ComputerAI_General implements Computer {
|
||||
* declare_blockers.
|
||||
* </p>
|
||||
*/
|
||||
public final void declare_blockers() {
|
||||
public final void declareBlockers() {
|
||||
CardList blockers = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
|
||||
AllZone.setCombat(ComputerUtil_Block2.getBlockers(AllZone.getCombat(), blockers));
|
||||
@@ -427,7 +428,7 @@ public class ComputerAI_General implements Computer {
|
||||
* declare_blockers_after.
|
||||
* </p>
|
||||
*/
|
||||
public final void declare_blockers_after() {
|
||||
public final void declareBlockersAfter() {
|
||||
stackResponse();
|
||||
}
|
||||
|
||||
@@ -436,7 +437,7 @@ public class ComputerAI_General implements Computer {
|
||||
* end_of_combat.
|
||||
* </p>
|
||||
*/
|
||||
public final void end_of_combat() {
|
||||
public final void endOfCombat() {
|
||||
stackResponse();
|
||||
}
|
||||
|
||||
@@ -446,7 +447,7 @@ public class ComputerAI_General implements Computer {
|
||||
* end_of_turn.
|
||||
* </p>
|
||||
*/
|
||||
public final void end_of_turn() {
|
||||
public final void endOfTurn() {
|
||||
stackResponse();
|
||||
}
|
||||
|
||||
@@ -455,7 +456,7 @@ public class ComputerAI_General implements Computer {
|
||||
* stack_not_empty.
|
||||
* </p>
|
||||
*/
|
||||
public final void stack_not_empty() {
|
||||
public final void stackNotEmpty() {
|
||||
stackResponse();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ComputerAI_Input extends Input {
|
||||
* </p>
|
||||
*/
|
||||
public final void stackNotEmpty() {
|
||||
computer.stack_not_empty();
|
||||
computer.stackNotEmpty();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -75,25 +75,25 @@ public class ComputerAI_Input extends Input {
|
||||
final String phase = AllZone.getPhase().getPhase();
|
||||
|
||||
if (AllZone.getStack().size() > 0) {
|
||||
computer.stack_not_empty();
|
||||
} else if (phase.equals(Constant.Phase.Main1)) {
|
||||
computer.stackNotEmpty();
|
||||
} else if (phase.equals(Constant.Phase.MAIN1)) {
|
||||
Log.debug("Computer main1");
|
||||
computer.main1();
|
||||
} else if (phase.equals(Constant.Phase.Combat_Begin)) {
|
||||
computer.begin_combat();
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
|
||||
computer.beginCombat();
|
||||
} else if (phase.equals(Constant.Phase.Combat_Declare_Attackers)) {
|
||||
computer.declare_attackers();
|
||||
computer.declareAttackers();
|
||||
} 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)) {
|
||||
computer.declare_blockers_after();
|
||||
computer.declareBlockersAfter();
|
||||
} else if (phase.equals(Constant.Phase.Combat_End)) {
|
||||
computer.end_of_combat();
|
||||
computer.endOfCombat();
|
||||
} else if (phase.equals(Constant.Phase.Main2)) {
|
||||
Log.debug("Computer main2");
|
||||
computer.main2();
|
||||
} else {
|
||||
computer.stack_not_empty();
|
||||
computer.stackNotEmpty();
|
||||
}
|
||||
|
||||
} // think
|
||||
|
||||
@@ -65,8 +65,7 @@ public class ComputerUtil {
|
||||
}
|
||||
|
||||
sa.setActivatingPlayer(AllZone.getComputerPlayer());
|
||||
if (canBePlayedAndPayedByAI(sa)) // checks everything necessary
|
||||
{
|
||||
if (canBePlayedAndPayedByAI(sa)) {
|
||||
handlePlayingSpellAbility(sa);
|
||||
|
||||
return false;
|
||||
@@ -647,7 +646,8 @@ public class ComputerUtil {
|
||||
|
||||
if (sourceCard.getName().equals("Rainbow Vale")) {
|
||||
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 " +
|
||||
@@ -948,7 +948,7 @@ public class ComputerUtil {
|
||||
public static boolean chooseLandsToPlay() {
|
||||
Player computer = AllZone.getComputerPlayer();
|
||||
CardList landList = computer.getCardsIn(Zone.Hand);
|
||||
landList = landList.filter(CardListFilter.lands);
|
||||
landList = landList.filter(CardListFilter.LANDS);
|
||||
|
||||
CardList lands = computer.getCardsIn(Zone.Graveyard).getType("Land");
|
||||
for (Card crd : lands) {
|
||||
@@ -978,7 +978,7 @@ public class ComputerUtil {
|
||||
// don't play the land if it has cycling and enough lands are
|
||||
// available
|
||||
ArrayList<SpellAbility> spellAbilities = c.getSpellAbilities();
|
||||
for (SpellAbility sa : spellAbilities)
|
||||
for (SpellAbility sa : spellAbilities) {
|
||||
if (sa.isCycling()) {
|
||||
CardList hand = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
||||
CardList lands = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
||||
@@ -989,7 +989,7 @@ public class ComputerUtil {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@@ -1043,14 +1043,14 @@ public class ComputerUtil {
|
||||
for (int ip = 0; ip < 9; ip++) { // priority 0 is the lowest,
|
||||
// priority 5 the highest
|
||||
final int priority = 9 - ip;
|
||||
CardList SacMeList = typeList.filter(new CardListFilter() {
|
||||
CardList sacMeList = typeList.filter(new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return (!c.getSVar("SacMe").equals("") && Integer.parseInt(c.getSVar("SacMe")) == priority);
|
||||
}
|
||||
});
|
||||
if (SacMeList.size() != 0) {
|
||||
SacMeList.shuffle();
|
||||
return SacMeList.get(0);
|
||||
if (sacMeList.size() != 0) {
|
||||
sacMeList.shuffle();
|
||||
return sacMeList.get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1060,14 +1060,15 @@ public class ComputerUtil {
|
||||
for (int ip = 0; ip < 9; ip++) { // priority 0 is the lowest,
|
||||
// priority 5 the highest
|
||||
final int priority = 9 - ip;
|
||||
CardList SacMeList = typeList.filter(new CardListFilter() {
|
||||
CardList sacMeList = typeList.filter(new CardListFilter() {
|
||||
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) {
|
||||
SacMeList.shuffle();
|
||||
return SacMeList.get(0);
|
||||
if (sacMeList.size() != 0) {
|
||||
sacMeList.shuffle();
|
||||
return sacMeList.get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1138,7 +1139,7 @@ public class ComputerUtil {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @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);
|
||||
Card sourceCard = null;
|
||||
|
||||
@@ -1212,7 +1213,8 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -1314,7 +1316,7 @@ public class ComputerUtil {
|
||||
typeList = typeList.getValidCards(type.split(","), activate.getController(), activate);
|
||||
|
||||
// is this needed?
|
||||
typeList = typeList.filter(CardListFilter.untapped);
|
||||
typeList = typeList.filter(CardListFilter.UNTAPPED);
|
||||
|
||||
if (tap) {
|
||||
typeList.remove(activate);
|
||||
@@ -1349,7 +1351,8 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @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);
|
||||
typeList = typeList.getValidCards(type.split(","), activate.getController(), activate);
|
||||
if (target != null && target.getController().isComputer() && typeList.contains(target)) {
|
||||
@@ -1531,7 +1534,7 @@ public class ComputerUtil {
|
||||
|
||||
Player controller = card.getController();
|
||||
CardList l = controller.getCardsIn(Zone.Battlefield);
|
||||
for (Card c : l)
|
||||
for (Card c : l) {
|
||||
for (SpellAbility sa : c.getSpellAbility()) {
|
||||
// This try/catch should fix the "computer is thinking" bug
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1582,8 +1585,8 @@ public class ComputerUtil {
|
||||
|
||||
Player controller = card.getController();
|
||||
CardList l = controller.getCardsIn(Zone.Battlefield);
|
||||
for (Card c : l)
|
||||
for (SpellAbility sa : c.getSpellAbility())
|
||||
for (Card c : l) {
|
||||
for (SpellAbility sa : c.getSpellAbility()) {
|
||||
// if SA is from AF_Counter don't add to getPlayable
|
||||
// This try/catch should fix the "computer is thinking" bug
|
||||
try {
|
||||
@@ -1600,7 +1603,8 @@ public class ComputerUtil {
|
||||
Target tgt = sa.getTarget();
|
||||
if (tgt != null) {
|
||||
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(),
|
||||
mapParams.get("Amount"), sa);
|
||||
}
|
||||
@@ -1611,7 +1615,8 @@ public class ComputerUtil {
|
||||
} catch (Exception ex) {
|
||||
showError(ex, "There is an error in the card code for %s:%n", c.getName(), ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return prevented;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@ public class ComputerUtil_Attack2 {
|
||||
* @param blockerLife
|
||||
* 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 = humanList.getType("Creature");
|
||||
|
||||
@@ -253,7 +254,8 @@ public class ComputerUtil_Attack2 {
|
||||
// bonus TWICE
|
||||
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;
|
||||
if ((AllZone.getComputerPlayer().getLife() - 3) <= totalExaltedAttack) {
|
||||
// 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
|
||||
double aiLifeToPlayerDamageRatio = 1000000;
|
||||
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
|
||||
@@ -476,7 +478,7 @@ public class ComputerUtil_Attack2 {
|
||||
// find the potential damage ratio the AI can cause
|
||||
double playerLifeToDamageRatio = 1000000;
|
||||
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
|
||||
CardListUtil.sortAttackLowFirst(attackers);
|
||||
// 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
|
||||
CardList attritionalAttackers = new CardList();
|
||||
for (int x = 0; x < attackers.size() - playerForces; x++) {
|
||||
@@ -564,9 +566,9 @@ public class ComputerUtil_Attack2 {
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
// *****************
|
||||
@@ -581,7 +583,8 @@ public class ComputerUtil_Attack2 {
|
||||
// <= 1 && ratioDiff >= 1
|
||||
// && outNumber > 0) ||
|
||||
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
|
||||
// player.
|
||||
} else if (ratioDiff >= 0 || ratioDiff + outNumber >= -1) {
|
||||
@@ -613,7 +616,8 @@ public class ComputerUtil_Attack2 {
|
||||
if (combat.getAttackers().length == 0
|
||||
&& (countExaltedBonus(AllZone.getComputerPlayer()) >= 3
|
||||
|| 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)
|
||||
&& AllZone.getPhase().isFirstCombat()) && !bAssault) {
|
||||
int biggest = 0;
|
||||
|
||||
@@ -15,8 +15,8 @@ import forge.game.GameType;
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface Constant {
|
||||
/** Constant <code>ProgramName="Forge - http://cardforge.org"</code> */
|
||||
String ProgramName = "Forge - http://cardforge.org";
|
||||
/** Constant <code>ProgramName="Forge - http://cardforge.org"</code>. */
|
||||
String PROGRAM_NAME = "Forge - http://cardforge.org";
|
||||
|
||||
// used to pass information between the GUI screens
|
||||
/**
|
||||
@@ -25,19 +25,19 @@ public interface Constant {
|
||||
public abstract class Runtime {
|
||||
|
||||
/** The Constant HumanDeck. */
|
||||
public static final Deck[] HumanDeck = new Deck[1];
|
||||
public static final Deck[] HUMAN_DECK = new Deck[1];
|
||||
|
||||
/** The Constant ComputerDeck. */
|
||||
public static final Deck[] ComputerDeck = new Deck[1];
|
||||
public static final Deck[] COMPUTER_DECK = new Deck[1];
|
||||
|
||||
/** The game type. */
|
||||
public static GameType gameType = GameType.Constructed;
|
||||
private static GameType gameType = GameType.Constructed;
|
||||
|
||||
/** The Constant Smooth. */
|
||||
public static final boolean[] Smooth = new boolean[1];
|
||||
public static final boolean[] SMOOTH = new boolean[1];
|
||||
|
||||
/** The Constant Mill. */
|
||||
public static final boolean[] Mill = new boolean[1];
|
||||
public static final boolean[] MILL = new boolean[1];
|
||||
|
||||
/** The Constant DevMode. */
|
||||
public static final boolean[] DevMode = new boolean[1]; // one for
|
||||
@@ -65,6 +65,20 @@ public interface Constant {
|
||||
|
||||
/** The Constant stackOffset. */
|
||||
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 {
|
||||
@@ -87,10 +101,10 @@ public interface Constant {
|
||||
public interface Ability {
|
||||
|
||||
/** The Triggered. */
|
||||
String Triggered = "Triggered";
|
||||
String TRIGGERED = "Triggered";
|
||||
|
||||
/** The Activated. */
|
||||
String Activated = "Activated";
|
||||
String ACTIVATED = "Activated";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,19 +113,19 @@ public interface Constant {
|
||||
public interface Phase {
|
||||
|
||||
/** The Constant Untap. */
|
||||
String Untap = "Untap";
|
||||
String UNTAP = "Untap";
|
||||
|
||||
/** The Constant Upkeep. */
|
||||
String Upkeep = "Upkeep";
|
||||
String UPKEEP = "Upkeep";
|
||||
|
||||
/** The Constant Draw. */
|
||||
String Draw = "Draw";
|
||||
String DRAW = "Draw";
|
||||
|
||||
/** The Constant Main1. */
|
||||
String Main1 = "Main1";
|
||||
String MAIN1 = "Main1";
|
||||
|
||||
/** The Constant Combat_Begin. */
|
||||
String Combat_Begin = "BeginCombat";
|
||||
String COMBAT_BEGIN = "BeginCombat";
|
||||
|
||||
/** The Constant Combat_Declare_Attackers. */
|
||||
String Combat_Declare_Attackers = "Declare Attackers";
|
||||
@@ -250,7 +264,7 @@ public interface Constant {
|
||||
// Constant_StringHashMap[1];
|
||||
|
||||
/** 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 {
|
||||
|
||||
/** The fantasy quest. */
|
||||
boolean[] fantasyQuest = new boolean[1];
|
||||
boolean[] FANTASY_QUEST = new boolean[1];
|
||||
|
||||
// public static final Quest_Assignment[] qa = new Quest_Assignment[1];
|
||||
|
||||
/** The human list. */
|
||||
CardList[] humanList = new CardList[1];
|
||||
CardList[] HUMAN_LIST = new CardList[1];
|
||||
|
||||
/** The computer list. */
|
||||
CardList[] computerList = new CardList[1];
|
||||
CardList[] COMPUTER_LIST = new CardList[1];
|
||||
|
||||
/** The human life. */
|
||||
int[] humanLife = new int[1];
|
||||
|
||||
/** The computer life. */
|
||||
int[] computerLife = new int[1];
|
||||
int[] COMPUTER_LIFE = new int[1];
|
||||
|
||||
/** The opp icon name. */
|
||||
String[] oppIconName = new String[1];
|
||||
@@ -285,37 +299,37 @@ public interface Constant {
|
||||
public interface CardTypes {
|
||||
|
||||
/** The loaded. */
|
||||
boolean[] loaded = { false };
|
||||
boolean[] LOADED = { false };
|
||||
|
||||
/** The card types. */
|
||||
Constant_StringArrayList[] cardTypes = new Constant_StringArrayList[1];
|
||||
Constant_StringArrayList[] CARD_TYPES = new Constant_StringArrayList[1];
|
||||
|
||||
/** The super types. */
|
||||
Constant_StringArrayList[] superTypes = new Constant_StringArrayList[1];
|
||||
Constant_StringArrayList[] SUPER_TYPES = new Constant_StringArrayList[1];
|
||||
|
||||
/** The basic types. */
|
||||
Constant_StringArrayList[] basicTypes = new Constant_StringArrayList[1];
|
||||
Constant_StringArrayList[] BASIC_TYPES = new Constant_StringArrayList[1];
|
||||
|
||||
/** The land types. */
|
||||
Constant_StringArrayList[] landTypes = new Constant_StringArrayList[1];
|
||||
Constant_StringArrayList[] LAND_TYPES = new Constant_StringArrayList[1];
|
||||
|
||||
/** The creature types. */
|
||||
Constant_StringArrayList[] creatureTypes = new Constant_StringArrayList[1];
|
||||
Constant_StringArrayList[] CREATURE_TYPES = new Constant_StringArrayList[1];
|
||||
|
||||
/** The instant types. */
|
||||
Constant_StringArrayList[] instantTypes = new Constant_StringArrayList[1];
|
||||
Constant_StringArrayList[] INSTANT_TYPES = new Constant_StringArrayList[1];
|
||||
|
||||
/** The sorcery types. */
|
||||
Constant_StringArrayList[] sorceryTypes = new Constant_StringArrayList[1];
|
||||
Constant_StringArrayList[] SORCERY_TYPES = new Constant_StringArrayList[1];
|
||||
|
||||
/** The enchantment types. */
|
||||
Constant_StringArrayList[] enchantmentTypes = new Constant_StringArrayList[1];
|
||||
Constant_StringArrayList[] ENCHANTMENT_TYPES = new Constant_StringArrayList[1];
|
||||
|
||||
/** The artifact types. */
|
||||
Constant_StringArrayList[] artifactTypes = new Constant_StringArrayList[1];
|
||||
Constant_StringArrayList[] ARTIFACT_TYPES = new Constant_StringArrayList[1];
|
||||
|
||||
/** 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 {
|
||||
|
||||
/** The loaded. */
|
||||
boolean[] loaded = { false };
|
||||
boolean[] LOADED = { false };
|
||||
|
||||
/** The Non stacking list. */
|
||||
Constant_StringArrayList[] NonStackingList = new Constant_StringArrayList[1];
|
||||
Constant_StringArrayList[] NON_STACKING_LIST = new Constant_StringArrayList[1];
|
||||
}
|
||||
|
||||
} // Constant
|
||||
|
||||
@@ -8,6 +8,22 @@ import java.util.ArrayList;
|
||||
public class Constant_StringArrayList {
|
||||
|
||||
/** 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.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@ import java.util.Map;
|
||||
public class Constant_StringHashMap {
|
||||
|
||||
/** The map. */
|
||||
public Map<String, String> map = new HashMap<String, String>();
|
||||
private Map<String, String> map = new HashMap<String, String>();
|
||||
|
||||
}
|
||||
|
||||
@@ -1284,7 +1284,7 @@ public class GameAction {
|
||||
AllZone.getComputerPlayer().getZone(Zone.Battlefield).add(c);
|
||||
c.setSickness(true);
|
||||
}
|
||||
Constant.Quest.fantasyQuest[0] = true;
|
||||
Constant.Quest.FANTASY_QUEST[0] = true;
|
||||
}
|
||||
|
||||
private boolean Start_Cut = false;
|
||||
@@ -1302,7 +1302,7 @@ public class GameAction {
|
||||
public final void newGame(final Deck humanDeck, final Deck computerDeck) {
|
||||
// AllZone.getComputer() = new ComputerAI_Input(new
|
||||
// ComputerAI_General());
|
||||
Constant.Quest.fantasyQuest[0] = false;
|
||||
Constant.Quest.FANTASY_QUEST[0] = false;
|
||||
|
||||
AllZone.newGameCleanup();
|
||||
canShowWinLose = true;
|
||||
@@ -1313,7 +1313,7 @@ public class GameAction {
|
||||
CardFactoryInterface c = AllZone.getCardFactory();
|
||||
Card.resetUniqueNumber();
|
||||
boolean canRandomFoil = Constant.Runtime.RndCFoil[0]
|
||||
&& Constant.Runtime.gameType.equals(GameType.Constructed);
|
||||
&& Constant.Runtime.getGameType().equals(GameType.Constructed);
|
||||
Random generator = MyRandom.random;
|
||||
for (Entry<CardPrinted, Integer> stackOfCards : humanDeck.getMain()) {
|
||||
CardPrinted cardPrinted = stackOfCards.getKey();
|
||||
@@ -1403,7 +1403,7 @@ public class GameAction {
|
||||
}
|
||||
|
||||
// do this instead of shuffling Computer's deck
|
||||
boolean smoothLand = Constant.Runtime.Smooth[0];
|
||||
boolean smoothLand = Constant.Runtime.SMOOTH[0];
|
||||
|
||||
if (smoothLand) {
|
||||
Card[] c1 = smoothComputerManaCurve(AllZone.getComputerPlayer().getCardsIn(Zone.Library).toArray());
|
||||
@@ -1640,9 +1640,9 @@ public class GameAction {
|
||||
public final void seeWhoPlaysFirst() {
|
||||
|
||||
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);
|
||||
CLibrary = CLibrary.filter(CardListFilter.nonlands);
|
||||
CLibrary = CLibrary.filter(CardListFilter.NON_LANDS);
|
||||
|
||||
boolean Starter_Determined = false;
|
||||
int Cut_Count = 0;
|
||||
@@ -2452,7 +2452,7 @@ public class GameAction {
|
||||
if (originalCard.getName().equals("Khalni Hydra") && spell.isSpell()) {
|
||||
Player player = AllZone.getPhase().getPlayerTurn();
|
||||
CardList playerCreature = AllZoneUtil.getCreaturesInPlay(player);
|
||||
playerCreature = playerCreature.filter(CardListFilter.green);
|
||||
playerCreature = playerCreature.filter(CardListFilter.GREEN);
|
||||
String manaC = manaCost + " ";
|
||||
if (playerCreature.size() > 0) {
|
||||
for (int i = 0; i < playerCreature.size(); i++) {
|
||||
|
||||
@@ -803,7 +803,7 @@ public final class GameActionUtil {
|
||||
public void resolve() {
|
||||
for (int i = 0; i < damage; i++) {
|
||||
CardList nonTokens = player.getCardsIn(Zone.Battlefield);
|
||||
nonTokens = nonTokens.filter(CardListFilter.nonToken);
|
||||
nonTokens = nonTokens.filter(CardListFilter.NON_TOKEN);
|
||||
if (nonTokens.size() == 0) {
|
||||
player.loseConditionMet(GameLossReason.SpellEffect, lich.getName());
|
||||
} else {
|
||||
@@ -1471,7 +1471,7 @@ public final class GameActionUtil {
|
||||
produces.put("Swamp", "B");
|
||||
|
||||
CardList lands = AllZoneUtil.getCardsInGame();
|
||||
lands = lands.filter(CardListFilter.lands);
|
||||
lands = lands.filter(CardListFilter.LANDS);
|
||||
|
||||
// remove all abilities granted by this Command
|
||||
for (Card land : lands) {
|
||||
|
||||
@@ -249,7 +249,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
devMenu.setEnabled(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 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 (phase.equals(Constant.Phase.End_Of_Turn)) {
|
||||
return cbAIEndOfTurn.isSelected();
|
||||
} else if (phase.equals(Constant.Phase.Upkeep)) {
|
||||
} else if (phase.equals(Constant.Phase.UPKEEP)) {
|
||||
return cbAIUpkeep.isSelected();
|
||||
} else if (phase.equals(Constant.Phase.Draw)) {
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
return cbAIDraw.isSelected();
|
||||
} else if (phase.equals(Constant.Phase.Combat_Begin)) {
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
|
||||
return cbAIBeginCombat.isSelected();
|
||||
} else if (phase.equals(Constant.Phase.Combat_End)) {
|
||||
return cbAIEndCombat.isSelected();
|
||||
@@ -1441,11 +1441,11 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
} else {
|
||||
if (phase.equals(Constant.Phase.End_Of_Turn)) {
|
||||
return cbHumanEndOfTurn.isSelected();
|
||||
} else if (phase.equals(Constant.Phase.Upkeep)) {
|
||||
} else if (phase.equals(Constant.Phase.UPKEEP)) {
|
||||
return cbHumanUpkeep.isSelected();
|
||||
} else if (phase.equals(Constant.Phase.Draw)) {
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
return cbHumanDraw.isSelected();
|
||||
} else if (phase.equals(Constant.Phase.Combat_Begin)) {
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
|
||||
return cbHumanBeginCombat.isSelected();
|
||||
} else if (phase.equals(Constant.Phase.Combat_End)) {
|
||||
return cbHumanEndCombat.isSelected();
|
||||
@@ -1489,7 +1489,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean savePrefs() {
|
||||
Constant.Runtime.Mill[0] = canLoseByDecking.isSelected();
|
||||
Constant.Runtime.MILL[0] = canLoseByDecking.isSelected();
|
||||
ForgePreferences fp = Singletons.getModel().getPreferences();
|
||||
|
||||
fp.bAIUpkeep = cbAIUpkeep.isSelected();
|
||||
@@ -1662,16 +1662,16 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
private static final long serialVersionUID = 9874492387239847L;
|
||||
|
||||
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>();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
String nl = System.getProperty("line.separator");
|
||||
StringBuilder deckList = new StringBuilder();
|
||||
String dName = Constant.Runtime.HumanDeck[0].getName();
|
||||
String dName = Constant.Runtime.HUMAN_DECK[0].getName();
|
||||
|
||||
if (dName == null) {
|
||||
dName = "";
|
||||
|
||||
@@ -152,7 +152,7 @@ public class HumanPlayer extends Player {
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
||||
@@ -737,7 +737,7 @@ public class MagicStack extends MyObservable {
|
||||
if (sp.isSpell() && AllZoneUtil.isCardInPlay("Bazaar of Wonders")) {
|
||||
boolean found = false;
|
||||
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
||||
all = all.filter(CardListFilter.nonToken);
|
||||
all = all.filter(CardListFilter.NON_TOKEN);
|
||||
CardList graves = AllZoneUtil.getCardsIn(Zone.Graveyard);
|
||||
all.addAll(graves);
|
||||
|
||||
|
||||
@@ -239,8 +239,8 @@ public class Phase extends MyObservable implements java.io.Serializable {
|
||||
}
|
||||
|
||||
/** The phase order. */
|
||||
String[] phaseOrder = { Constant.Phase.Untap, Constant.Phase.Upkeep, Constant.Phase.Draw, Constant.Phase.Main1,
|
||||
Constant.Phase.Combat_Begin, Constant.Phase.Combat_Declare_Attackers,
|
||||
String[] phaseOrder = { Constant.Phase.UNTAP, Constant.Phase.UPKEEP, Constant.Phase.DRAW, Constant.Phase.MAIN1,
|
||||
Constant.Phase.COMBAT_BEGIN, Constant.Phase.Combat_Declare_Attackers,
|
||||
Constant.Phase.Combat_Declare_Attackers_InstantAbility, Constant.Phase.Combat_Declare_Blockers,
|
||||
Constant.Phase.Combat_Declare_Blockers_InstantAbility, Constant.Phase.Combat_FirstStrikeDamage,
|
||||
Constant.Phase.Combat_Damage, Constant.Phase.Combat_End, Constant.Phase.Main2, Constant.Phase.End_Of_Turn,
|
||||
@@ -299,13 +299,13 @@ public class Phase extends MyObservable implements java.io.Serializable {
|
||||
AllZone.getPhase().setSkipPhase(true);
|
||||
AllZone.getGameAction().checkStateEffects();
|
||||
|
||||
if (phase.equals(Constant.Phase.Untap)) {
|
||||
if (phase.equals(Constant.Phase.UNTAP)) {
|
||||
PhaseUtil.handleUntap();
|
||||
} else if (phase.equals(Constant.Phase.Upkeep)) {
|
||||
} else if (phase.equals(Constant.Phase.UPKEEP)) {
|
||||
PhaseUtil.handleUpkeep();
|
||||
} else if (phase.equals(Constant.Phase.Draw)) {
|
||||
} else if (phase.equals(Constant.Phase.DRAW)) {
|
||||
PhaseUtil.handleDraw();
|
||||
} else if (phase.equals(Constant.Phase.Combat_Begin)) {
|
||||
} else if (phase.equals(Constant.Phase.COMBAT_BEGIN)) {
|
||||
PhaseUtil.verifyCombat();
|
||||
} else if (phase.equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)) {
|
||||
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
|
||||
AllZone.getStack().unfreezeStack();
|
||||
|
||||
if (!phase.equals(Constant.Phase.Untap)) {
|
||||
if (!phase.equals(Constant.Phase.UNTAP)) {
|
||||
// during untap
|
||||
resetPriority();
|
||||
}
|
||||
@@ -450,7 +450,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
|
||||
if (getPhase().equals(Constant.Phase.Combat_Declare_Attackers)) {
|
||||
AllZone.getStack().unfreezeStack();
|
||||
nCombatsThisTurn++;
|
||||
} else if (getPhase().equals(Constant.Phase.Untap)) {
|
||||
} else if (getPhase().equals(Constant.Phase.UNTAP)) {
|
||||
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
|
||||
// this to handleBeginPhase
|
||||
if (getPhase().equals(Constant.Phase.Untap)) {
|
||||
if (getPhase().equals(Constant.Phase.UNTAP)) {
|
||||
turn++;
|
||||
}
|
||||
|
||||
@@ -874,7 +874,7 @@ public class Phase extends MyObservable implements java.io.Serializable {
|
||||
public static boolean canCastSorcery(final Player player) {
|
||||
return AllZone.getPhase().isPlayerTurn(player)
|
||||
&& (AllZone.getPhase().getPhase().equals(Constant.Phase.Main2) || AllZone.getPhase().getPhase()
|
||||
.equals(Constant.Phase.Main1)) && AllZone.getStack().size() == 0;
|
||||
.equals(Constant.Phase.MAIN1)) && AllZone.getStack().size() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,7 +65,7 @@ public class PhaseUtil {
|
||||
|
||||
AllZone.getGameAction().resetActivationsPerTurn();
|
||||
|
||||
CardList lands = AllZoneUtil.getPlayerLandsInPlay(turn).filter(CardListFilter.untapped);
|
||||
CardList lands = AllZoneUtil.getPlayerLandsInPlay(turn).filter(CardListFilter.UNTAPPED);
|
||||
turn.setNumPowerSurgeLands(lands.size());
|
||||
|
||||
// anything before this point happens regardless of whether the Untap
|
||||
@@ -217,7 +217,7 @@ public class PhaseUtil {
|
||||
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
||||
// search for lands the computer has and only untap 1
|
||||
CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
landList = landList.filter(CardListFilter.tapped).filter(new CardListFilter() {
|
||||
landList = landList.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return canUntap(c);
|
||||
@@ -247,7 +247,7 @@ public class PhaseUtil {
|
||||
}// selectCard()
|
||||
};// Input
|
||||
CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
landList = landList.filter(CardListFilter.tapped).filter(new CardListFilter() {
|
||||
landList = landList.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return canUntap(c);
|
||||
@@ -261,8 +261,8 @@ public class PhaseUtil {
|
||||
if (AllZoneUtil.isCardInPlay("Damping Field") || AllZoneUtil.isCardInPlay("Imi Statue")) {
|
||||
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
||||
CardList artList = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
||||
artList = artList.filter(CardListFilter.artifacts);
|
||||
artList = artList.filter(CardListFilter.tapped).filter(new CardListFilter() {
|
||||
artList = artList.filter(CardListFilter.ARTIFACTS);
|
||||
artList = artList.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return canUntap(c);
|
||||
@@ -293,8 +293,8 @@ public class PhaseUtil {
|
||||
}// selectCard()
|
||||
};// Input
|
||||
CardList artList = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
||||
artList = artList.filter(CardListFilter.artifacts);
|
||||
artList = artList.filter(CardListFilter.tapped).filter(new CardListFilter() {
|
||||
artList = artList.filter(CardListFilter.ARTIFACTS);
|
||||
artList = artList.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return canUntap(c);
|
||||
@@ -308,7 +308,7 @@ public class PhaseUtil {
|
||||
if ((AllZoneUtil.isCardInPlay("Smoke") || AllZoneUtil.isCardInPlay("Stoic Angel"))) {
|
||||
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
||||
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
creatures = creatures.filter(CardListFilter.tapped).filter(new CardListFilter() {
|
||||
creatures = creatures.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return canUntap(c);
|
||||
@@ -339,7 +339,7 @@ public class PhaseUtil {
|
||||
}// selectCard()
|
||||
};// Input
|
||||
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
creatures = creatures.filter(CardListFilter.tapped).filter(new CardListFilter() {
|
||||
creatures = creatures.filter(CardListFilter.TAPPED).filter(new CardListFilter() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
return canUntap(c);
|
||||
@@ -617,8 +617,8 @@ public class PhaseUtil {
|
||||
*/
|
||||
public static boolean isBeforeAttackersAreDeclared() {
|
||||
String phase = AllZone.getPhase().getPhase();
|
||||
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.Combat_Begin);
|
||||
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.COMBAT_BEGIN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,67 +30,67 @@ import forge.game.GameLossReason;
|
||||
public abstract class Player extends GameEntity {
|
||||
|
||||
/** The poison counters. */
|
||||
protected int poisonCounters;
|
||||
private int poisonCounters;
|
||||
|
||||
/** The life. */
|
||||
protected int life;
|
||||
private int life;
|
||||
|
||||
/** The assigned damage. */
|
||||
protected int assignedDamage;
|
||||
private int assignedDamage;
|
||||
|
||||
/** The num power surge lands. */
|
||||
protected int numPowerSurgeLands;
|
||||
private int numPowerSurgeLands;
|
||||
|
||||
/** The alt win. */
|
||||
protected boolean altWin = false;
|
||||
private boolean altWin = false;
|
||||
|
||||
/** The alt win source name. */
|
||||
protected String altWinSourceName;
|
||||
private String altWinSourceName;
|
||||
|
||||
/** The alt lose. */
|
||||
protected boolean altLose = false;
|
||||
private boolean altLose = false;
|
||||
|
||||
/** The loss state. */
|
||||
protected GameLossReason lossState = GameLossReason.DidNotLoseYet;
|
||||
private GameLossReason lossState = GameLossReason.DidNotLoseYet;
|
||||
|
||||
/** The lose condition spell. */
|
||||
protected String loseConditionSpell;
|
||||
private String loseConditionSpell;
|
||||
|
||||
/** The n turns. */
|
||||
protected int nTurns = 0;
|
||||
private int nTurns = 0;
|
||||
|
||||
/** The skip next untap. */
|
||||
protected boolean skipNextUntap = false;
|
||||
private boolean skipNextUntap = false;
|
||||
|
||||
/** The prowl. */
|
||||
protected ArrayList<String> prowl = new ArrayList<String>();
|
||||
private ArrayList<String> prowl = new ArrayList<String>();
|
||||
|
||||
/** The max lands to play. */
|
||||
protected int maxLandsToPlay = 1;
|
||||
private int maxLandsToPlay = 1;
|
||||
|
||||
/** The num lands played. */
|
||||
protected int numLandsPlayed = 0;
|
||||
private int numLandsPlayed = 0;
|
||||
|
||||
/** The last drawn card. */
|
||||
protected Card lastDrawnCard;
|
||||
private Card lastDrawnCard;
|
||||
|
||||
/** The num drawn this turn. */
|
||||
protected int numDrawnThisTurn = 0;
|
||||
private int numDrawnThisTurn = 0;
|
||||
|
||||
/** The slowtrip list. */
|
||||
protected CardList slowtripList = new CardList();
|
||||
private CardList slowtripList = new CardList();
|
||||
|
||||
/** The keywords. */
|
||||
protected ArrayList<String> keywords = new ArrayList<String>();
|
||||
private ArrayList<String> keywords = new ArrayList<String>();
|
||||
|
||||
/** The mana pool. */
|
||||
protected ManaPool manaPool = null;
|
||||
private ManaPool manaPool = null;
|
||||
|
||||
/** The must attack entity. */
|
||||
protected Object mustAttackEntity = null;
|
||||
private Object mustAttackEntity = null;
|
||||
|
||||
/** 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. */
|
||||
public static final List<Zone> ALL_ZONES = Collections.unmodifiableList(Arrays.asList(Zone.Battlefield,
|
||||
@@ -473,9 +473,10 @@ public abstract class Player extends GameEntity {
|
||||
|
||||
if (isCombat) {
|
||||
ArrayList<String> types = source.getType();
|
||||
for (String type : types)
|
||||
for (String type : types) {
|
||||
source.getController().addProwlType(type);
|
||||
}
|
||||
}
|
||||
|
||||
// Run triggers
|
||||
HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
@@ -906,6 +907,10 @@ public abstract class Player extends GameEntity {
|
||||
*
|
||||
* @see forge.GameEntity#hasKeyword(java.lang.String)
|
||||
*/
|
||||
/**
|
||||
* @param keyword String
|
||||
* @return boolean
|
||||
*/
|
||||
public final boolean hasKeyword(final String keyword) {
|
||||
return this.keywords.contains(keyword);
|
||||
}
|
||||
@@ -1061,7 +1066,7 @@ public abstract class Player extends GameEntity {
|
||||
if (!firstFromDraw && AllZoneUtil.isCardInPlay("Chains of Mephistopheles")) {
|
||||
if (!this.getZone(Zone.Hand).isEmpty()) {
|
||||
if (isHuman()) {
|
||||
discard_Chains_of_Mephistopheles();
|
||||
discardChainsOfMephistopheles();
|
||||
} else { // Computer
|
||||
discard(1, null, false);
|
||||
// true causes this code not to be run again
|
||||
@@ -1277,7 +1282,7 @@ public abstract class Player extends GameEntity {
|
||||
/**
|
||||
* Discard_ chains_of_ mephistopheles.
|
||||
*/
|
||||
protected abstract void discard_Chains_of_Mephistopheles();
|
||||
protected abstract void discardChainsOfMephistopheles();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -1348,19 +1353,24 @@ public abstract class Player extends GameEntity {
|
||||
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.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
|
||||
.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."))
|
||||
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.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())) {
|
||||
AllZone.getGameAction().discard_PutIntoPlayInstead(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 {
|
||||
AllZone.getGameAction().moveToGraveyard(c);
|
||||
}
|
||||
@@ -1569,10 +1579,10 @@ public abstract class Player extends GameEntity {
|
||||
*
|
||||
* @param topN
|
||||
* a {@link forge.CardList} object.
|
||||
* @param N
|
||||
* @param n
|
||||
* a int.
|
||||
*/
|
||||
protected abstract void doScry(CardList topN, int N);
|
||||
protected abstract void doScry(CardList topN, int n);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -2129,9 +2139,9 @@ public abstract class Player extends GameEntity {
|
||||
* @see forge.GameEntity#isValid(java.lang.String, forge.Player, forge.Card)
|
||||
*/
|
||||
@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))
|
||||
&& !(incR[0].equals("You") && this.equals(sourceController))) {
|
||||
@@ -2142,7 +2152,7 @@ public abstract class Player extends GameEntity {
|
||||
final String excR = incR[1];
|
||||
String[] exR = excR.split("\\+"); // Exclusive Restrictions are ...
|
||||
for (int j = 0; j < exR.length; j++) {
|
||||
if (hasProperty(exR[j], sourceController, source) == false) {
|
||||
if (!hasProperty(exR[j], sourceController, source)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2158,13 +2168,13 @@ public abstract class Player extends GameEntity {
|
||||
* forge.Card)
|
||||
*/
|
||||
@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)) {
|
||||
return false;
|
||||
}
|
||||
} else if (Property.equals("Opponent")) {
|
||||
} else if (property.equals("Opponent")) {
|
||||
if (this.equals(sourceController)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2263,8 +2273,8 @@ public abstract class Player extends GameEntity {
|
||||
handSizeOperations.clear();
|
||||
}
|
||||
|
||||
/** Constant <code>NextHandSizeStamp=0</code> */
|
||||
private static int NextHandSizeStamp = 0;
|
||||
/** Constant <code>NextHandSizeStamp=0</code>. */
|
||||
private static int nextHandSizeStamp = 0;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -2274,7 +2284,7 @@ public abstract class Player extends GameEntity {
|
||||
* @return a int.
|
||||
*/
|
||||
public static int getHandSizeStamp() {
|
||||
return NextHandSizeStamp++;
|
||||
return nextHandSizeStamp++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -133,7 +133,7 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone {
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList lands = tisLand.getController().getCardsIn(Zone.Battlefield);
|
||||
lands = lands.filter(CardListFilter.lands);
|
||||
lands = lands.filter(CardListFilter.LANDS);
|
||||
for (Card land : lands) {
|
||||
land.tap();
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ public class Upkeep implements java.io.Serializable {
|
||||
final Card c = list.get(i);
|
||||
if (c.getIntrinsicKeyword().contains("(Echo unpaid)")) {
|
||||
|
||||
final Command paidCommand = Command.Blank;
|
||||
final Command paidCommand = Command.BLANK;
|
||||
|
||||
final Command unpaidCommand = new Command() {
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -564,7 +564,7 @@ public class Upkeep implements java.io.Serializable {
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
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);
|
||||
return creats;
|
||||
}
|
||||
@@ -588,7 +588,7 @@ public class Upkeep implements java.io.Serializable {
|
||||
final Ability sacrificeArtifact = new Ability(c, "") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList artifacts = player.getCardsIn(Zone.Battlefield).filter(CardListFilter.artifacts);
|
||||
CardList artifacts = player.getCardsIn(Zone.Battlefield).filter(CardListFilter.ARTIFACTS);
|
||||
|
||||
if (player.isHuman()) {
|
||||
AllZone.getInputControl().setInput(new Input() {
|
||||
@@ -836,7 +836,7 @@ public class Upkeep implements java.io.Serializable {
|
||||
StringBuilder cost = new StringBuilder();
|
||||
cost.append("Pay cost for ").append(c).append("\r\n");
|
||||
GameActionUtil.payManaDuringAbilityResolve(cost.toString(), noPay.getManaCost(),
|
||||
Command.Blank, Command.Blank);
|
||||
Command.BLANK, Command.BLANK);
|
||||
}
|
||||
} // end resolve()
|
||||
}; // end pay ability
|
||||
@@ -2347,8 +2347,8 @@ public class Upkeep implements java.io.Serializable {
|
||||
public void resolve() {
|
||||
int gain = 0;
|
||||
CardList play = player.getCardsIn(Zone.Battlefield);
|
||||
CardList black = play.filter(CardListFilter.black);
|
||||
CardList red = play.filter(CardListFilter.red);
|
||||
CardList black = play.filter(CardListFilter.BLACK);
|
||||
CardList red = play.filter(CardListFilter.RED);
|
||||
if (black.size() > 0 && red.size() > 0) {
|
||||
gain = 4;
|
||||
} else if (black.size() > 0 || red.size() > 0) {
|
||||
@@ -2384,8 +2384,8 @@ public class Upkeep implements java.io.Serializable {
|
||||
public void resolve() {
|
||||
int draw = 0;
|
||||
CardList play = player.getCardsIn(Zone.Battlefield);
|
||||
CardList green = play.filter(CardListFilter.green);
|
||||
CardList red = play.filter(CardListFilter.red);
|
||||
CardList green = play.filter(CardListFilter.GREEN);
|
||||
CardList red = play.filter(CardListFilter.RED);
|
||||
|
||||
if (green.size() > 0 && red.size() > 0) {
|
||||
draw = 2;
|
||||
|
||||
@@ -301,7 +301,7 @@ public final class AbilityFactory_Animate {
|
||||
|
||||
// don't use instant speed animate abilities outside computers
|
||||
// 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)
|
||||
&& !params.containsKey("ActivationPhases") && !params.containsKey("Permanent")) {
|
||||
return false;
|
||||
|
||||
@@ -847,7 +847,7 @@ public class AbilityFactory_Attach {
|
||||
}
|
||||
|
||||
if (AbilityFactory.isSorcerySpeed(sa)) {
|
||||
if (AllZone.getPhase().is(Constant.Phase.Main1)) {
|
||||
if (AllZone.getPhase().is(Constant.Phase.MAIN1)) {
|
||||
chance = r.nextFloat() <= .75;
|
||||
} else {
|
||||
// Don't Attach Sorcery Speed stuff after Main1
|
||||
|
||||
@@ -2004,7 +2004,7 @@ public final class AbilityFactory_ChangeZone {
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
} else if (origin.equals(Zone.Graveyard)) {
|
||||
|
||||
@@ -214,7 +214,7 @@ public final class AbilityFactory_Copy {
|
||||
// TODO - I'm sure someone can do this AI better
|
||||
|
||||
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;
|
||||
} else {
|
||||
double chance = .4; // 40 percent chance with instant speed stuff
|
||||
@@ -276,7 +276,7 @@ public final class AbilityFactory_Copy {
|
||||
}
|
||||
|
||||
Card choice;
|
||||
if (list.filter(CardListFilter.creatures).size() > 0) {
|
||||
if (list.filter(CardListFilter.CREATURES).size() > 0) {
|
||||
choice = CardFactoryUtil.AI_getBestCreature(list);
|
||||
} else {
|
||||
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, source, true);
|
||||
|
||||
@@ -271,7 +271,7 @@ public final class AbilityFactory_Debuff {
|
||||
SpellAbility_Restriction restrict = sa.getRestrictions();
|
||||
|
||||
// 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
|
||||
// stack is empty
|
||||
if (!AbilityFactory.isSorcerySpeed(sa)) {
|
||||
@@ -733,7 +733,7 @@ public final class AbilityFactory_Debuff {
|
||||
});
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ public class AbilityFactory_PermanentState {
|
||||
untapList = untapList.getTargetableCards(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
|
||||
// matter.
|
||||
String[] tappablePermanents = { "Creature", "Land", "Artifact" };
|
||||
@@ -431,7 +431,7 @@ public class AbilityFactory_PermanentState {
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
return true;
|
||||
@@ -578,7 +578,7 @@ public class AbilityFactory_PermanentState {
|
||||
} else {
|
||||
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
||||
list = list.getType(valid);
|
||||
list = list.filter(CardListFilter.tapped);
|
||||
list = list.filter(CardListFilter.TAPPED);
|
||||
|
||||
int count = 0;
|
||||
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,
|
||||
final boolean mandatory) {
|
||||
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);
|
||||
// filter out enchantments and planeswalkers, their tapped state doesn't
|
||||
// matter.
|
||||
@@ -997,7 +997,7 @@ public class AbilityFactory_PermanentState {
|
||||
}
|
||||
|
||||
// try to just tap already tapped things
|
||||
tapList = list.filter(CardListFilter.tapped);
|
||||
tapList = list.filter(CardListFilter.TAPPED);
|
||||
|
||||
if (tapTargetList(af, sa, tapList, mandatory)) {
|
||||
return true;
|
||||
@@ -1503,7 +1503,7 @@ public class AbilityFactory_PermanentState {
|
||||
Card source = sa.getSourceCard();
|
||||
HashMap<String, String> params = af.getMapParams();
|
||||
|
||||
if (AllZone.getPhase().isAfter(Constant.Phase.Combat_Begin)) {
|
||||
if (AllZone.getPhase().isAfter(Constant.Phase.COMBAT_BEGIN)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1523,7 +1523,7 @@ public class AbilityFactory_PermanentState {
|
||||
}
|
||||
|
||||
validTappables = validTappables.getValidCards(valid, source.getController(), source);
|
||||
validTappables = validTappables.filter(CardListFilter.untapped);
|
||||
validTappables = validTappables.filter(CardListFilter.UNTAPPED);
|
||||
|
||||
Random r = MyRandom.random;
|
||||
boolean rr = false;
|
||||
@@ -1563,7 +1563,7 @@ public class AbilityFactory_PermanentState {
|
||||
private static CardList getTapAllTargets(final String valid, final Card source) {
|
||||
CardList tmpList = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
||||
tmpList = tmpList.getValidCards(valid, source.getController(), source);
|
||||
tmpList = tmpList.filter(CardListFilter.untapped);
|
||||
tmpList = tmpList.filter(CardListFilter.UNTAPPED);
|
||||
return tmpList;
|
||||
}
|
||||
|
||||
|
||||
@@ -421,7 +421,7 @@ public class AbilityFactory_Pump {
|
||||
SpellAbility_Restriction restrict = sa.getRestrictions();
|
||||
|
||||
// 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
|
||||
// stack is empty
|
||||
if (!AF.isCurse() && !AbilityFactory.isSorcerySpeed(sa)) {
|
||||
@@ -1119,7 +1119,7 @@ public class AbilityFactory_Pump {
|
||||
}// end Curse
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ public class AbilityFactory_Token extends AbilityFactory {
|
||||
&& AllZone.getPhase().isPlayerTurn(AllZone.getComputerPlayer()) && !haste) {
|
||||
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()))
|
||||
&& oneShot) {
|
||||
return false;
|
||||
|
||||
@@ -217,7 +217,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
|
||||
out.setOwner(in.getOwner());
|
||||
CardList all = new CardList(getAllCards());
|
||||
CardList tokens = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
||||
tokens = tokens.filter(CardListFilter.token);
|
||||
tokens = tokens.filter(CardListFilter.TOKEN);
|
||||
all.addAll(tokens);
|
||||
out.setCopiedSpell(true);
|
||||
copiedList.add(out);
|
||||
@@ -1057,7 +1057,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
|
||||
final Player player = getTargetPlayer();
|
||||
|
||||
CardList lands = player.getCardsIn(Zone.Graveyard);
|
||||
lands = lands.filter(CardListFilter.basicLands);
|
||||
lands = lands.filter(CardListFilter.BASIC_LANDS);
|
||||
if (card.getController().isHuman()) {
|
||||
// now, select up to four lands
|
||||
int end = -1;
|
||||
@@ -1202,7 +1202,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
|
||||
// may return null
|
||||
public Card getCreature() {
|
||||
CardList tappedCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
tappedCreatures = tappedCreatures.filter(CardListFilter.tapped);
|
||||
tappedCreatures = tappedCreatures.filter(CardListFilter.TAPPED);
|
||||
tappedCreatures = tappedCreatures.getTargetableCards(card);
|
||||
if (tappedCreatures.isEmpty()) {
|
||||
return null;
|
||||
@@ -1683,14 +1683,14 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList arts = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.artifacts);
|
||||
CardList arts = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.ARTIFACTS);
|
||||
return !arts.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
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()) {
|
||||
copyTarget[0] = CardFactoryUtil.AI_getBestArtifact(arts);
|
||||
}
|
||||
|
||||
@@ -968,7 +968,7 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
if (AllZone.getPhase().isAfter(Constant.Phase.Main1)
|
||||
if (AllZone.getPhase().isAfter(Constant.Phase.MAIN1)
|
||||
|| AllZone.getPhase().isPlayerTurn(AllZone.getHumanPlayer())) {
|
||||
return false;
|
||||
}
|
||||
@@ -1812,7 +1812,7 @@ public class CardFactoryUtil {
|
||||
*/
|
||||
public static Input input_targetSpecific(final SpellAbility spell, final CardList choices, final String message,
|
||||
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
|
||||
@@ -3213,7 +3213,7 @@ public class CardFactoryUtil {
|
||||
// Count$IfMainPhase.<numMain>.<numNotMain> // 7/10
|
||||
if (sq[0].contains("IfMainPhase")) {
|
||||
final String cPhase = AllZone.getPhase().getPhase();
|
||||
if ((cPhase.equals(Constant.Phase.Main1) || cPhase.equals(Constant.Phase.Main2))
|
||||
if ((cPhase.equals(Constant.Phase.MAIN1) || cPhase.equals(Constant.Phase.Main2))
|
||||
&& AllZone.getPhase().getPlayerTurn().equals(cardController)) {
|
||||
return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
|
||||
} else {
|
||||
@@ -3411,32 +3411,32 @@ public class CardFactoryUtil {
|
||||
|
||||
// "Untapped Lands" - Count$UntappedTypeYouCtrl.Land
|
||||
if (sq[0].contains("Untapped")) {
|
||||
someCards = someCards.filter(CardListFilter.untapped);
|
||||
someCards = someCards.filter(CardListFilter.UNTAPPED);
|
||||
}
|
||||
|
||||
if (sq[0].contains("Tapped")) {
|
||||
someCards = someCards.filter(CardListFilter.tapped);
|
||||
someCards = someCards.filter(CardListFilter.TAPPED);
|
||||
}
|
||||
|
||||
// "White Creatures" - Count$WhiteTypeYouCtrl.Creature
|
||||
if (sq[0].contains("White")) {
|
||||
someCards = someCards.filter(CardListFilter.white);
|
||||
someCards = someCards.filter(CardListFilter.WHITE);
|
||||
}
|
||||
|
||||
if (sq[0].contains("Blue")) {
|
||||
someCards = someCards.filter(CardListFilter.blue);
|
||||
someCards = someCards.filter(CardListFilter.BLUE);
|
||||
}
|
||||
|
||||
if (sq[0].contains("Black")) {
|
||||
someCards = someCards.filter(CardListFilter.black);
|
||||
someCards = someCards.filter(CardListFilter.BLACK);
|
||||
}
|
||||
|
||||
if (sq[0].contains("Red")) {
|
||||
someCards = someCards.filter(CardListFilter.red);
|
||||
someCards = someCards.filter(CardListFilter.RED);
|
||||
}
|
||||
|
||||
if (sq[0].contains("Green")) {
|
||||
someCards = someCards.filter(CardListFilter.green);
|
||||
someCards = someCards.filter(CardListFilter.GREEN);
|
||||
}
|
||||
|
||||
if (sq[0].contains("Multicolor")) {
|
||||
|
||||
@@ -422,7 +422,7 @@ class CardFactory_Auras {
|
||||
// This includes creatures Animate Dead can't enchant once
|
||||
// in play.
|
||||
// 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() {
|
||||
|
||||
@@ -593,7 +593,7 @@ public class CardFactory_Creatures {
|
||||
@Override
|
||||
public boolean canPlay() {
|
||||
CardList possible = card.getController().getCardsIn(Zone.Hand);
|
||||
possible = possible.filter(CardListFilter.nonlands);
|
||||
possible = possible.filter(CardListFilter.NON_LANDS);
|
||||
return !possible.isEmpty() && super.canPlay();
|
||||
}
|
||||
|
||||
@@ -967,7 +967,7 @@ public class CardFactory_Creatures {
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList allTokens = AllZoneUtil.getCreaturesInPlay(card.getController());
|
||||
allTokens = allTokens.filter(CardListFilter.token);
|
||||
allTokens = allTokens.filter(CardListFilter.TOKEN);
|
||||
|
||||
CardFactoryUtil.copyTokens(allTokens);
|
||||
}
|
||||
@@ -975,7 +975,7 @@ public class CardFactory_Creatures {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList allTokens = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
allTokens = allTokens.filter(CardListFilter.token);
|
||||
allTokens = allTokens.filter(CardListFilter.TOKEN);
|
||||
|
||||
return allTokens.size() >= 2;
|
||||
}
|
||||
@@ -1796,7 +1796,7 @@ public class CardFactory_Creatures {
|
||||
public boolean canPlayAI() {
|
||||
// get all creatures
|
||||
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Graveyard);
|
||||
list = list.filter(CardListFilter.creatures);
|
||||
list = list.filter(CardListFilter.CREATURES);
|
||||
return 0 < list.size();
|
||||
}
|
||||
});
|
||||
@@ -1819,12 +1819,12 @@ public class CardFactory_Creatures {
|
||||
Player opp = player.getOpponent();
|
||||
int max = 0;
|
||||
CardList play = opp.getCardsIn(Zone.Battlefield);
|
||||
play = play.filter(CardListFilter.nonToken);
|
||||
play = play.filter(CardListFilter.white);
|
||||
play = play.filter(CardListFilter.NON_TOKEN);
|
||||
play = play.filter(CardListFilter.WHITE);
|
||||
max += play.size();
|
||||
|
||||
CardList grave = opp.getCardsIn(Zone.Graveyard);
|
||||
grave = grave.filter(CardListFilter.white);
|
||||
grave = grave.filter(CardListFilter.WHITE);
|
||||
max += grave.size();
|
||||
|
||||
String[] life = new String[max + 1];
|
||||
|
||||
@@ -915,7 +915,7 @@ public class CardFactory_Instants {
|
||||
@Override
|
||||
public void resolve() {
|
||||
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() {
|
||||
@Override
|
||||
public boolean addCard(final Card c) {
|
||||
|
||||
@@ -209,7 +209,7 @@ class CardFactory_Lands {
|
||||
|
||||
@Override
|
||||
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())) {
|
||||
return false;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ class CardFactory_Lands {
|
||||
}
|
||||
} // selectCard()
|
||||
}; // Input
|
||||
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.untapped)
|
||||
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.UNTAPPED)
|
||||
.size() < 2)) {
|
||||
AllZone.getGameAction().sacrifice(card);
|
||||
return;
|
||||
@@ -322,7 +322,7 @@ class CardFactory_Lands {
|
||||
if (player.isComputer()) {
|
||||
if (land.size() > 0) {
|
||||
CardList tappedLand = new CardList(land.toArray());
|
||||
tappedLand = tappedLand.filter(CardListFilter.tapped);
|
||||
tappedLand = tappedLand.filter(CardListFilter.TAPPED);
|
||||
// if any are tapped, sacrifice it
|
||||
// else sacrifice random
|
||||
if (tappedLand.size() > 0) {
|
||||
@@ -393,7 +393,7 @@ class CardFactory_Lands {
|
||||
|
||||
public void execute() {
|
||||
CardList plains = AllZoneUtil.getPlayerLandsInPlay(card.getController());
|
||||
plains = plains.filter(CardListFilter.untapped);
|
||||
plains = plains.filter(CardListFilter.UNTAPPED);
|
||||
|
||||
if (player.isComputer()) {
|
||||
if (plains.size() > 1) {
|
||||
@@ -412,7 +412,7 @@ class CardFactory_Lands {
|
||||
}
|
||||
} else { // this is the human resolution
|
||||
final int[] paid = { 0 };
|
||||
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.untapped)
|
||||
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.UNTAPPED)
|
||||
.size() < 2)) {
|
||||
AllZone.getGameAction().sacrifice(card);
|
||||
return;
|
||||
@@ -676,7 +676,7 @@ class CardFactory_Lands {
|
||||
if (player.isComputer()) {
|
||||
if (land.size() > 0) {
|
||||
CardList tappedLand = new CardList(land.toArray());
|
||||
tappedLand = tappedLand.filter(CardListFilter.tapped);
|
||||
tappedLand = tappedLand.filter(CardListFilter.TAPPED);
|
||||
if (tappedLand.size() > 0) {
|
||||
AllZone.getGameAction().moveToHand(CardFactoryUtil.getWorstLand(tappedLand));
|
||||
} else {
|
||||
|
||||
@@ -251,7 +251,7 @@ public class CardFactory_Sorceries {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
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()
|
||||
|
||||
}; // SpellAbility
|
||||
@@ -698,7 +698,7 @@ public class CardFactory_Sorceries {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList c = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
|
||||
c = c.filter(CardListFilter.nonlands);
|
||||
c = c.filter(CardListFilter.NON_LANDS);
|
||||
return c.size() > 0;
|
||||
}
|
||||
}; // SpellAbility spell
|
||||
@@ -873,7 +873,7 @@ public class CardFactory_Sorceries {
|
||||
// randomly choose a nonland card
|
||||
int getDamage() {
|
||||
CardList notLand = card.getController().getCardsIn(Zone.Library);
|
||||
notLand = notLand.filter(CardListFilter.nonlands);
|
||||
notLand = notLand.filter(CardListFilter.NON_LANDS);
|
||||
notLand.shuffle();
|
||||
|
||||
if (notLand.isEmpty()) {
|
||||
@@ -937,10 +937,10 @@ public class CardFactory_Sorceries {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList humTokenCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
humTokenCreats = humTokenCreats.filter(CardListFilter.token);
|
||||
humTokenCreats = humTokenCreats.filter(CardListFilter.TOKEN);
|
||||
|
||||
CardList compTokenCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
compTokenCreats = compTokenCreats.filter(CardListFilter.token);
|
||||
compTokenCreats = compTokenCreats.filter(CardListFilter.TOKEN);
|
||||
|
||||
return compTokenCreats.size() > humTokenCreats.size();
|
||||
} // canPlayAI()
|
||||
@@ -948,7 +948,7 @@ public class CardFactory_Sorceries {
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList tokens = AllZoneUtil.getCreaturesInPlay();
|
||||
tokens = tokens.filter(CardListFilter.token);
|
||||
tokens = tokens.filter(CardListFilter.TOKEN);
|
||||
|
||||
CardFactoryUtil.copyTokens(tokens);
|
||||
|
||||
@@ -2226,7 +2226,7 @@ public class CardFactory_Sorceries {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList c = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
||||
c = c.filter(CardListFilter.nonlands);
|
||||
c = c.filter(CardListFilter.NON_LANDS);
|
||||
return 2 >= c.size();
|
||||
}
|
||||
|
||||
@@ -2279,7 +2279,7 @@ public class CardFactory_Sorceries {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList c = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
||||
c = c.filter(CardListFilter.nonlands);
|
||||
c = c.filter(CardListFilter.NON_LANDS);
|
||||
return 2 >= c.size()
|
||||
|| (AllZone.getComputerPlayer().hasMetalcraft() && AllZone.getHumanPlayer().getLife() <= 3);
|
||||
}
|
||||
@@ -2536,7 +2536,7 @@ public class CardFactory_Sorceries {
|
||||
@Override
|
||||
public void showMessage() {
|
||||
CardList grave = card.getController().getCardsIn(Constant.Zone.Graveyard);
|
||||
grave = grave.filter(CardListFilter.creatures);
|
||||
grave = grave.filter(CardListFilter.CREATURES);
|
||||
grave = grave.filter(new CardListFilter() {
|
||||
public boolean addCard(final Card c) {
|
||||
return c.getCMC() <= x[0];
|
||||
@@ -2691,7 +2691,7 @@ public class CardFactory_Sorceries {
|
||||
// get all
|
||||
CardList creatures = AllZoneUtil.getCreaturesInPlay();
|
||||
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)) {
|
||||
display.add("Target player loses X life");
|
||||
@@ -2803,7 +2803,7 @@ public class CardFactory_Sorceries {
|
||||
|
||||
// Sacrifice an artifact
|
||||
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());
|
||||
if (toSac != null) {
|
||||
Card c = (Card) toSac;
|
||||
@@ -2816,7 +2816,7 @@ public class CardFactory_Sorceries {
|
||||
// Search your library for an artifact
|
||||
CardList lib = p.getCardsIn(Zone.Library);
|
||||
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());
|
||||
if (o != null) {
|
||||
newArtifact[0] = (Card) o;
|
||||
|
||||
@@ -126,9 +126,10 @@ public class CostDiscard extends CostPartWithList {
|
||||
@Override
|
||||
public final void payAI(final SpellAbility ability, final Card source, final Cost_Payment payment) {
|
||||
Player activator = ability.getActivatingPlayer();
|
||||
for (Card c : list)
|
||||
for (Card c : list) {
|
||||
activator.discard(c, ability);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
@@ -247,7 +248,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
if (type.equals("Random")) {
|
||||
list = CardListUtil.getRandomSubList(hand, c);
|
||||
} else {
|
||||
list = ComputerUtil.AI_discardNumType(c, type.split(";"), ability);
|
||||
list = ComputerUtil.discardNumTypeAI(c, type.split(";"), ability);
|
||||
}
|
||||
}
|
||||
return list != null;
|
||||
|
||||
@@ -42,7 +42,8 @@ public class CostReveal extends CostPartWithList {
|
||||
* forge.Card, forge.Player, forge.card.cost.Cost)
|
||||
*/
|
||||
@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);
|
||||
String type = getType();
|
||||
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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
addListToHash(ability, "Revealed");
|
||||
@@ -209,12 +210,12 @@ public class CostReveal extends CostPartWithList {
|
||||
* a int.
|
||||
* @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) {
|
||||
Input target = new Input() {
|
||||
private static final long serialVersionUID = -329993322080934435L;
|
||||
|
||||
int nReveal = 0;
|
||||
private int nReveal = 0;
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
|
||||
@@ -103,7 +103,7 @@ public class CostTapType extends CostPartWithList {
|
||||
if (cost.getTap()) {
|
||||
typeList.remove(source);
|
||||
}
|
||||
typeList = typeList.filter(CardListFilter.untapped);
|
||||
typeList = typeList.filter(CardListFilter.UNTAPPED);
|
||||
|
||||
Integer amount = convertAmount();
|
||||
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) {
|
||||
CardList typeList = ability.getActivatingPlayer().getCardsIn(Zone.Battlefield);
|
||||
typeList = typeList.getValidCards(getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
|
||||
typeList = typeList.filter(CardListFilter.untapped);
|
||||
typeList = typeList.filter(CardListFilter.UNTAPPED);
|
||||
String amount = getAmount();
|
||||
Integer c = convertAmount();
|
||||
if (c == null) {
|
||||
|
||||
@@ -101,8 +101,8 @@ public abstract class SpellAbility {
|
||||
|
||||
private HashMap<String, Object> triggeringObjects = new HashMap<String, Object>();
|
||||
|
||||
private Command cancelCommand = Command.Blank;
|
||||
private Command beforePayManaAI = Command.Blank;
|
||||
private Command cancelCommand = Command.BLANK;
|
||||
private Command beforePayManaAI = Command.BLANK;
|
||||
|
||||
private CommandArgs randomTarget = new CommandArgs() {
|
||||
|
||||
|
||||
@@ -66,9 +66,9 @@ public abstract class DeckGeneration {
|
||||
}
|
||||
|
||||
if (playerType.equals(PlayerType.HUMAN)) {
|
||||
Constant.Runtime.HumanDeck[0] = d;
|
||||
Constant.Runtime.HUMAN_DECK[0] = d;
|
||||
} else if (playerType.equals(PlayerType.COMPUTER)) {
|
||||
Constant.Runtime.ComputerDeck[0] = d;
|
||||
Constant.Runtime.COMPUTER_DECK[0] = d;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ public class DeckEditorDraft extends DeckEditorBase implements NewConstants, New
|
||||
*/
|
||||
private Deck getPlayersDeck() {
|
||||
Deck deck = new Deck(GameType.Draft);
|
||||
Constant.Runtime.HumanDeck[0] = deck;
|
||||
Constant.Runtime.HUMAN_DECK[0] = deck;
|
||||
|
||||
// add sideboard to deck
|
||||
ItemPoolView<CardPrinted> list = ItemPool.createFrom(bottom.getCards(), CardPrinted.class);
|
||||
|
||||
@@ -90,9 +90,9 @@ public final class DeckEditorQuest extends DeckEditorBase implements NewConstant
|
||||
Deck deck = null;
|
||||
|
||||
// open deck that the player used if QuestData has it
|
||||
if (Constant.Runtime.HumanDeck[0] != null
|
||||
&& questData.getDeckNames().contains(Constant.Runtime.HumanDeck[0].getName())) {
|
||||
deck = questData.getDeck(Constant.Runtime.HumanDeck[0].getName());
|
||||
if (Constant.Runtime.HUMAN_DECK[0] != null
|
||||
&& questData.getDeckNames().contains(Constant.Runtime.HUMAN_DECK[0].getName())) {
|
||||
deck = questData.getDeck(Constant.Runtime.HUMAN_DECK[0].getName());
|
||||
} else {
|
||||
deck = new Deck(GameType.Sealed);
|
||||
deck.setName("");
|
||||
|
||||
@@ -201,7 +201,7 @@ public class InputControl extends MyObservable implements java.io.Serializable {
|
||||
} else if (phase.equals(Constant.Phase.Combat_Declare_Blockers)) {
|
||||
model.getGameState().getStack().freezeStack();
|
||||
if (playerTurn.isHuman()) {
|
||||
aiInput.getComputer().declare_blockers();
|
||||
aiInput.getComputer().declareBlockers();
|
||||
return null;
|
||||
} else {
|
||||
if (model.getGameState().getCombat().getAttackers().length == 0) {
|
||||
@@ -238,7 +238,7 @@ public class InputControl extends MyObservable implements java.io.Serializable {
|
||||
} else if (playerTurn.isComputer()) {
|
||||
return aiInput;
|
||||
} else {
|
||||
aiInput.getComputer().stack_not_empty();
|
||||
aiInput.getComputer().stackNotEmpty();
|
||||
return null;
|
||||
}
|
||||
}// getInput()
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Input_PayManaCost_Ability extends Input {
|
||||
* a {@link forge.Command} object.
|
||||
*/
|
||||
public Input_PayManaCost_Ability(final String manaCost, final Command paid) {
|
||||
this(manaCost, paid, Command.Blank);
|
||||
this(manaCost, paid, Command.BLANK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,7 +73,7 @@ public class FModel {
|
||||
// PM
|
||||
}
|
||||
|
||||
Constant.Runtime.Mill[0] = preferences.millingLossCondition;
|
||||
Constant.Runtime.MILL[0] = preferences.millingLossCondition;
|
||||
Constant.Runtime.DevMode[0] = preferences.developerMode;
|
||||
Constant.Runtime.UpldDrft[0] = preferences.uploadDraftAI;
|
||||
Constant.Runtime.RndCFoil[0] = preferences.randCFoil;
|
||||
|
||||
@@ -506,7 +506,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
AllZone.getQuestData().saveData();
|
||||
|
||||
devModeCheckBox.setSelected(Constant.Runtime.DevMode[0]);
|
||||
smoothLandCheckBox.setSelected(Constant.Runtime.Smooth[0]);
|
||||
smoothLandCheckBox.setSelected(Constant.Runtime.SMOOTH[0]);
|
||||
|
||||
creditsLabel.setText(" " + questData.getCredits());
|
||||
statsLabel.setText(questData.getWin() + " wins / " + questData.getLost() + " losses");
|
||||
@@ -727,7 +727,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
|
||||
Deck humanDeck = questData.getDeck(humanDeckName);
|
||||
|
||||
Constant.Runtime.HumanDeck[0] = humanDeck;
|
||||
Constant.Runtime.HUMAN_DECK[0] = humanDeck;
|
||||
moveDeckToTop(humanDeckName);
|
||||
|
||||
Constant.Quest.oppIconName[0] = getEventIconFilename();
|
||||
@@ -743,7 +743,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
// AllZone.setDisplay(new GuiDisplay3());
|
||||
// }
|
||||
|
||||
Constant.Runtime.Smooth[0] = smoothLandCheckBox.isSelected();
|
||||
Constant.Runtime.SMOOTH[0] = smoothLandCheckBox.isSelected();
|
||||
|
||||
AllZone.getMatchState().reset();
|
||||
if (isShowingChallenges) {
|
||||
@@ -768,7 +768,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
*/
|
||||
final void setupDuel(final Deck humanDeck) {
|
||||
Deck computer = selectedOpponent.getEvent().getEventDeck();
|
||||
Constant.Runtime.ComputerDeck[0] = computer;
|
||||
Constant.Runtime.COMPUTER_DECK[0] = computer;
|
||||
|
||||
QuestDuel selectedDuel = (QuestDuel) selectedOpponent.getEvent();
|
||||
AllZone.setQuestEvent(selectedDuel);
|
||||
@@ -789,7 +789,7 @@ public class QuestMainPanel extends QuestAbstractPanel {
|
||||
QuestChallenge selectedChallenge = (QuestChallenge) selectedOpponent.getEvent();
|
||||
|
||||
Deck computer = selectedOpponent.getEvent().getEventDeck();
|
||||
Constant.Runtime.ComputerDeck[0] = computer;
|
||||
Constant.Runtime.COMPUTER_DECK[0] = computer;
|
||||
|
||||
AllZone.setQuestEvent(selectedChallenge);
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
|
||||
*/
|
||||
@Override
|
||||
public final void startNextRound() {
|
||||
if (Constant.Quest.fantasyQuest[0]) {
|
||||
if (Constant.Quest.FANTASY_QUEST[0]) {
|
||||
int extraLife = 0;
|
||||
|
||||
if (model.qEvent.getEventType().equals("challenge")) {
|
||||
@@ -99,7 +99,7 @@ public class QuestWinLoseHandler extends WinLoseModeHandler {
|
||||
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);
|
||||
} else {
|
||||
super.startNextRound();
|
||||
|
||||
@@ -145,7 +145,7 @@ public class ApplicationView implements FView {
|
||||
try {
|
||||
ManaSymbols.loadImages();
|
||||
|
||||
Constant.Runtime.gameType = GameType.Constructed;
|
||||
Constant.Runtime.setGameType(GameType.Constructed);
|
||||
SwingUtilities.invokeLater(new Runnable() { // NOPMD by Braids
|
||||
// on 8/7/11 1:07
|
||||
// PM: this isn't a
|
||||
|
||||
@@ -802,10 +802,10 @@ public class Gui_HomeScreen {
|
||||
Deck rDeck = chooseRandomDeck();
|
||||
|
||||
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);
|
||||
|
||||
Constant.Runtime.HumanDeck[0] = rDeck;
|
||||
Constant.Runtime.HUMAN_DECK[0] = rDeck;
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "No decks available.", "Random Deck Name",
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
@@ -813,7 +813,7 @@ public class Gui_HomeScreen {
|
||||
}
|
||||
|
||||
} else {
|
||||
Constant.Runtime.HumanDeck[0] = deckManager.getDeck(HumanDeckSelected);
|
||||
Constant.Runtime.HUMAN_DECK[0] = deckManager.getDeck(HumanDeckSelected);
|
||||
}
|
||||
|
||||
if (AIDeckSelected.equals("Generate Deck")) {
|
||||
@@ -824,10 +824,10 @@ public class Gui_HomeScreen {
|
||||
|
||||
if (rDeck != null) {
|
||||
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);
|
||||
|
||||
Constant.Runtime.ComputerDeck[0] = rDeck;
|
||||
Constant.Runtime.COMPUTER_DECK[0] = rDeck;
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "No decks available.", "Random Deck Name",
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
@@ -835,7 +835,7 @@ public class Gui_HomeScreen {
|
||||
}
|
||||
|
||||
} else {
|
||||
Constant.Runtime.ComputerDeck[0] = deckManager.getDeck(AIDeckSelected);
|
||||
Constant.Runtime.COMPUTER_DECK[0] = deckManager.getDeck(AIDeckSelected);
|
||||
}
|
||||
|
||||
} else if (GameTypeSelected.equals(GameType.Sealed)) {
|
||||
@@ -848,8 +848,8 @@ public class Gui_HomeScreen {
|
||||
|
||||
} else {
|
||||
if (!HumanDeckSelected.equals("") && !AIDeckSelected.equals("")) {
|
||||
Constant.Runtime.HumanDeck[0] = deckManager.getDeck(HumanDeckSelected);
|
||||
Constant.Runtime.ComputerDeck[0] = deckManager.getDeck(AIDeckSelected);
|
||||
Constant.Runtime.HUMAN_DECK[0] = deckManager.getDeck(HumanDeckSelected);
|
||||
Constant.Runtime.COMPUTER_DECK[0] = deckManager.getDeck(AIDeckSelected);
|
||||
}
|
||||
}
|
||||
} else if (GameTypeSelected.equals(GameType.Draft)) {
|
||||
@@ -861,13 +861,13 @@ public class Gui_HomeScreen {
|
||||
return false;
|
||||
} else {
|
||||
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(" - ");
|
||||
int AIDeckNum = Integer.parseInt(aiDeck[1]);
|
||||
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);
|
||||
|
||||
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++) {
|
||||
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);
|
||||
|
||||
HumanDeckSelected = sDeckName;
|
||||
Constant.Runtime.HumanDeck[0] = deck;
|
||||
Constant.Runtime.HUMAN_DECK[0] = deck;
|
||||
AIDeckSelected = "AI_" + sDeckName;
|
||||
|
||||
// Deck aiDeck = sd.buildAIDeck(sDeck.toForgeCardList());
|
||||
@@ -960,7 +960,7 @@ public class Gui_HomeScreen {
|
||||
aiDeck.setPlayerType(PlayerType.COMPUTER);
|
||||
deckManager.addDeck(aiDeck);
|
||||
DeckManager.writeDeck(aiDeck, DeckManager.makeFileName(aiDeck));
|
||||
Constant.Runtime.ComputerDeck[0] = aiDeck;
|
||||
Constant.Runtime.COMPUTER_DECK[0] = aiDeck;
|
||||
|
||||
showDecks();
|
||||
|
||||
@@ -1274,11 +1274,11 @@ public class Gui_HomeScreen {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Constant.Runtime.gameType = GameTypeSelected;
|
||||
Constant.Runtime.setGameType(GameTypeSelected);
|
||||
|
||||
gHS.dispose();
|
||||
}
|
||||
|
||||
@@ -203,15 +203,15 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
ErrorViewer.showError(ex);
|
||||
}
|
||||
|
||||
if (Constant.Runtime.gameType.equals(GameType.Constructed)) {
|
||||
if (Constant.Runtime.getGameType().equals(GameType.Constructed)) {
|
||||
singleRadioButton.setSelected(true);
|
||||
updateDeckComboBoxes();
|
||||
}
|
||||
if (Constant.Runtime.gameType.equals(GameType.Sealed)) {
|
||||
if (Constant.Runtime.getGameType().equals(GameType.Sealed)) {
|
||||
sealedRadioButton.setSelected(true);
|
||||
updateDeckComboBoxes();
|
||||
}
|
||||
if (Constant.Runtime.gameType.equals(GameType.Draft)) {
|
||||
if (Constant.Runtime.getGameType().equals(GameType.Draft)) {
|
||||
draftRadioButton.setSelected(true);
|
||||
draftRadioButtonActionPerformed(null);
|
||||
}
|
||||
@@ -389,9 +389,9 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
|
||||
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++) {
|
||||
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.setPlayerType(PlayerType.HUMAN);
|
||||
|
||||
Constant.Runtime.HumanDeck[0] = deck;
|
||||
Constant.Runtime.gameType = GameType.Sealed;
|
||||
Constant.Runtime.HUMAN_DECK[0] = deck;
|
||||
Constant.Runtime.setGameType(GameType.Sealed);
|
||||
|
||||
// Deck aiDeck = sd.buildAIDeck(sDeck.toForgeCardList());
|
||||
Deck aiDeck = sd.buildAIDeck(sd.getCardpool().toForgeCardList()); // AI
|
||||
@@ -419,7 +419,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
|
||||
deckEditorButtonActionPerformed(GameType.Sealed, deck);
|
||||
|
||||
Constant.Runtime.ComputerDeck[0] = aiDeck;
|
||||
Constant.Runtime.COMPUTER_DECK[0] = aiDeck;
|
||||
} else {
|
||||
new OldGuiNewGame();
|
||||
}
|
||||
@@ -757,10 +757,10 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
Deck[] deck = deckManager.getDraftDeck(human);
|
||||
int index = Integer.parseInt(computer);
|
||||
|
||||
Constant.Runtime.HumanDeck[0] = deck[0];
|
||||
Constant.Runtime.ComputerDeck[0] = deck[index];
|
||||
Constant.Runtime.HUMAN_DECK[0] = deck[0];
|
||||
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");
|
||||
}
|
||||
} // else - load old draft
|
||||
@@ -773,16 +773,16 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
|
||||
return;
|
||||
} else {
|
||||
Constant.Runtime.HumanDeck[0] = deckManager.getDeck(human);
|
||||
Constant.Runtime.HUMAN_DECK[0] = deckManager.getDeck(human);
|
||||
|
||||
}
|
||||
|
||||
if (!computer.equals("New Sealed")) {
|
||||
Constant.Runtime.ComputerDeck[0] = deckManager.getDeck(computer);
|
||||
Constant.Runtime.COMPUTER_DECK[0] = deckManager.getDeck(computer);
|
||||
}
|
||||
} else {
|
||||
// non-draft decks
|
||||
GameType format = Constant.Runtime.gameType;
|
||||
GameType format = Constant.Runtime.getGameType();
|
||||
// boolean sealed = GameType.Sealed.equals(format);
|
||||
boolean constructed = GameType.Constructed.equals(format);
|
||||
|
||||
@@ -796,13 +796,13 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
// else if(sealed)
|
||||
// Constant.Runtime.HumanDeck[0] = generateSealedDeck();
|
||||
} else if (humanRandom) {
|
||||
Constant.Runtime.HumanDeck[0] = getRandomDeck(getDecks(format));
|
||||
Constant.Runtime.HUMAN_DECK[0] = getRandomDeck(getDecks(format));
|
||||
|
||||
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);
|
||||
} else {
|
||||
Constant.Runtime.HumanDeck[0] = deckManager.getDeck(human);
|
||||
Constant.Runtime.HUMAN_DECK[0] = deckManager.getDeck(human);
|
||||
}
|
||||
|
||||
assert computer != null;
|
||||
@@ -817,13 +817,13 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
// else if(sealed)
|
||||
// Constant.Runtime.ComputerDeck[0] = generateSealedDeck();
|
||||
} else if (computerRandom) {
|
||||
Constant.Runtime.ComputerDeck[0] = getRandomDeck(getDecks(format));
|
||||
Constant.Runtime.COMPUTER_DECK[0] = getRandomDeck(getDecks(format));
|
||||
|
||||
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);
|
||||
} else {
|
||||
Constant.Runtime.ComputerDeck[0] = deckManager.getDeck(computer);
|
||||
Constant.Runtime.COMPUTER_DECK[0] = deckManager.getDeck(computer);
|
||||
}
|
||||
} // else
|
||||
|
||||
@@ -835,9 +835,9 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
AllZone.setDisplay(new GuiDisplay4());
|
||||
// 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);
|
||||
|
||||
dispose();
|
||||
@@ -852,7 +852,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* a {@link java.awt.event.ActionEvent} object.
|
||||
*/
|
||||
final void singleRadioButtonActionPerformed(final ActionEvent e) {
|
||||
Constant.Runtime.gameType = GameType.Constructed;
|
||||
Constant.Runtime.setGameType(GameType.Constructed);
|
||||
updateDeckComboBoxes();
|
||||
}
|
||||
|
||||
@@ -865,7 +865,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* a {@link java.awt.event.ActionEvent} object.
|
||||
*/
|
||||
final void sealedRadioButtonActionPerformed(final ActionEvent e) {
|
||||
Constant.Runtime.gameType = GameType.Sealed;
|
||||
Constant.Runtime.setGameType(GameType.Sealed);
|
||||
updateDeckComboBoxes();
|
||||
}
|
||||
|
||||
@@ -879,7 +879,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
computerComboBox.removeAllItems();
|
||||
|
||||
allDecks = getDecks();
|
||||
switch (Constant.Runtime.gameType) {
|
||||
switch (Constant.Runtime.getGameType()) {
|
||||
case Sealed:
|
||||
humanComboBox.addItem("New Sealed");
|
||||
computerComboBox.addItem("New Sealed");
|
||||
@@ -965,7 +965,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* the e
|
||||
*/
|
||||
final void draftRadioButtonActionPerformed(final ActionEvent e) {
|
||||
Constant.Runtime.gameType = GameType.Draft;
|
||||
Constant.Runtime.setGameType(GameType.Draft);
|
||||
updateDeckComboBoxes();
|
||||
}
|
||||
|
||||
@@ -1625,7 +1625,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
preferences.lafFonts = useLAFFonts.isSelected();
|
||||
// preferences.newGui = newGuiCheckBox.isSelected();
|
||||
preferences.stackAiLand = smoothLandCheckBox.isSelected();
|
||||
preferences.millingLossCondition = Constant.Runtime.Mill[0];
|
||||
preferences.millingLossCondition = Constant.Runtime.MILL[0];
|
||||
preferences.developerMode = Constant.Runtime.DevMode[0];
|
||||
preferences.cardOverlay = cardOverlay.isSelected();
|
||||
preferences.scaleLargerThanOriginal = ImageCache.scaleLargerThanOriginal;
|
||||
@@ -1681,64 +1681,64 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants.
|
||||
* Load dynamic gamedata.
|
||||
*/
|
||||
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> tList = null;
|
||||
|
||||
Constant.CardTypes.cardTypes[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.superTypes[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.basicTypes[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.landTypes[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.creatureTypes[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.instantTypes[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.sorceryTypes[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.enchantmentTypes[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.artifactTypes[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.walkerTypes[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.CARD_TYPES[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.SUPER_TYPES[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.BASIC_TYPES[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.LAND_TYPES[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.CREATURE_TYPES[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.INSTANT_TYPES[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.SORCERY_TYPES[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.ENCHANTMENT_TYPES[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.ARTIFACT_TYPES[0] = new Constant_StringArrayList();
|
||||
Constant.CardTypes.WALKER_TYPES[0] = new Constant_StringArrayList();
|
||||
|
||||
if (typeListFile.size() > 0) {
|
||||
for (int i = 0; i < typeListFile.size(); i++) {
|
||||
String s = typeListFile.get(i);
|
||||
|
||||
if (s.equals("[CardTypes]")) {
|
||||
tList = Constant.CardTypes.cardTypes[0].list;
|
||||
tList = Constant.CardTypes.CARD_TYPES[0].getList();
|
||||
}
|
||||
|
||||
else if (s.equals("[SuperTypes]")) {
|
||||
tList = Constant.CardTypes.superTypes[0].list;
|
||||
tList = Constant.CardTypes.SUPER_TYPES[0].getList();
|
||||
}
|
||||
|
||||
else if (s.equals("[BasicTypes]")) {
|
||||
tList = Constant.CardTypes.basicTypes[0].list;
|
||||
tList = Constant.CardTypes.BASIC_TYPES[0].getList();
|
||||
}
|
||||
|
||||
else if (s.equals("[LandTypes]")) {
|
||||
tList = Constant.CardTypes.landTypes[0].list;
|
||||
tList = Constant.CardTypes.LAND_TYPES[0].getList();
|
||||
}
|
||||
|
||||
else if (s.equals("[CreatureTypes]")) {
|
||||
tList = Constant.CardTypes.creatureTypes[0].list;
|
||||
tList = Constant.CardTypes.CREATURE_TYPES[0].getList();
|
||||
}
|
||||
|
||||
else if (s.equals("[InstantTypes]")) {
|
||||
tList = Constant.CardTypes.instantTypes[0].list;
|
||||
tList = Constant.CardTypes.INSTANT_TYPES[0].getList();
|
||||
}
|
||||
|
||||
else if (s.equals("[SorceryTypes]")) {
|
||||
tList = Constant.CardTypes.sorceryTypes[0].list;
|
||||
tList = Constant.CardTypes.SORCERY_TYPES[0].getList();
|
||||
}
|
||||
|
||||
else if (s.equals("[EnchantmentTypes]")) {
|
||||
tList = Constant.CardTypes.enchantmentTypes[0].list;
|
||||
tList = Constant.CardTypes.ENCHANTMENT_TYPES[0].getList();
|
||||
}
|
||||
|
||||
else if (s.equals("[ArtifactTypes]")) {
|
||||
tList = Constant.CardTypes.artifactTypes[0].list;
|
||||
tList = Constant.CardTypes.ARTIFACT_TYPES[0].getList();
|
||||
}
|
||||
|
||||
else if (s.equals("[WalkerTypes]")) {
|
||||
tList = Constant.CardTypes.walkerTypes[0].list;
|
||||
tList = Constant.CardTypes.WALKER_TYPES[0].getList();
|
||||
}
|
||||
|
||||
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]) {
|
||||
* 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");
|
||||
|
||||
Constant.Keywords.NonStackingList[0] = new Constant_StringArrayList();
|
||||
Constant.Keywords.NON_STACKING_LIST[0] = new Constant_StringArrayList();
|
||||
|
||||
if (nskwListFile.size() > 1) {
|
||||
for (int i = 0; i < nskwListFile.size(); i++) {
|
||||
String s = nskwListFile.get(i);
|
||||
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]) {
|
||||
* System.out.println(Constant.Keywords.NonStackingList[0].list); }
|
||||
|
||||
@@ -70,7 +70,7 @@ public class WinLoseModeHandler {
|
||||
*
|
||||
*/
|
||||
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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@ public class CardColorTest {
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
|
||||
public void CardColorTest1() {
|
||||
ManaCost mc = new ManaCost("R W U");
|
||||
EnumSet<Color> col = Color.ConvertManaCostToColor(mc);
|
||||
EnumSet<Color> col = Color.convertManaCostToColor(mc);
|
||||
System.out.println(col.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ public class GuiBoosterDraftTest {
|
||||
*/
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public void GuiBoosterDraftTest1() {
|
||||
Constant.Runtime.gameType = GameType.Draft;
|
||||
Constant.Runtime.HumanDeck[0] = new Deck(GameType.Sealed);
|
||||
Constant.Runtime.setGameType(GameType.Draft);
|
||||
Constant.Runtime.HUMAN_DECK[0] = new Deck(GameType.Sealed);
|
||||
|
||||
DeckEditorDraft g = new DeckEditorDraft();
|
||||
g.showGui(new BoosterDraft_1(CardPoolLimitation.Full));
|
||||
|
||||
@@ -23,8 +23,7 @@ public final class BraidsAssertFunctions {
|
||||
*/
|
||||
public static void assertThrowsException(
|
||||
@SuppressWarnings("rawtypes") final Class exnClass,
|
||||
final ClumsyRunnable withScissors)
|
||||
{
|
||||
final ClumsyRunnable withScissors) {
|
||||
try {
|
||||
withScissors.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user