diff --git a/.gitattributes b/.gitattributes
index 8a0eed00185..219b163eba5 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -11357,7 +11357,6 @@ src/main/java/forge/GameEntity.java -text
src/main/java/forge/GameLog.java -text
src/main/java/forge/HandSizeOp.java svneol=native#text/plain
src/main/java/forge/ImageCache.java svneol=native#text/plain
-src/main/java/forge/MagicStack.java svneol=native#text/plain
src/main/java/forge/MyObservable.java svneol=native#text/plain
src/main/java/forge/NameChanger.java svneol=native#text/plain
src/main/java/forge/Singletons.java svneol=native#text/plain
@@ -11623,14 +11622,16 @@ src/main/java/forge/game/player/ComputerAIInput.java svneol=native#text/plain
src/main/java/forge/game/player/ComputerUtil.java svneol=native#text/plain
src/main/java/forge/game/player/ComputerUtilAttack.java svneol=native#text/plain
src/main/java/forge/game/player/ComputerUtilBlock.java svneol=native#text/plain
-src/main/java/forge/game/player/DefaultPlayerZone.java svneol=native#text/plain
src/main/java/forge/game/player/HumanPlayer.java svneol=native#text/plain
-src/main/java/forge/game/player/IPlayerZone.java svneol=native#text/plain
src/main/java/forge/game/player/Player.java svneol=native#text/plain
src/main/java/forge/game/player/PlayerType.java svneol=native#text/plain
src/main/java/forge/game/player/PlayerUtil.java svneol=native#text/plain
-src/main/java/forge/game/player/PlayerZone.java svneol=native#text/plain
-src/main/java/forge/game/player/PlayerZoneComesIntoPlay.java svneol=native#text/plain
+src/main/java/forge/game/zone/DefaultPlayerZone.java svneol=native#text/plain
+src/main/java/forge/game/zone/IPlayerZone.java svneol=native#text/plain
+src/main/java/forge/game/zone/MagicStack.java svneol=native#text/plain
+src/main/java/forge/game/zone/PlayerZone.java svneol=native#text/plain
+src/main/java/forge/game/zone/PlayerZoneComesIntoPlay.java svneol=native#text/plain
+src/main/java/forge/game/zone/ZoneType.java -text
src/main/java/forge/gui/CardContainer.java svneol=native#text/plain
src/main/java/forge/gui/CardDetailPanel.java svneol=native#text/plain
src/main/java/forge/gui/CardListViewer.java -text
@@ -11893,14 +11894,11 @@ src/main/java/forge/view/match/ViewTabber.java -text
src/main/java/forge/view/match/ViewWinLose.java -text
src/main/java/forge/view/match/package-info.java svneol=native#text/plain
src/main/java/forge/view/package-info.java svneol=native#text/plain
+src/main/java/net/slightlymagic/braids/BaseProgressMonitor.java svneol=native#text/plain
+src/main/java/net/slightlymagic/braids/BraidsProgressMonitor.java svneol=native#text/plain
+src/main/java/net/slightlymagic/braids/FindNonDirectoriesSkipDotDirectoriesGenerator.java svneol=native#text/plain
+src/main/java/net/slightlymagic/braids/GeneratorFunctions.java svneol=native#text/plain
src/main/java/net/slightlymagic/braids/LICENSE.txt svneol=native#text/plain
-src/main/java/net/slightlymagic/braids/util/generator/FindNonDirectoriesSkipDotDirectoriesGenerator.java svneol=native#text/plain
-src/main/java/net/slightlymagic/braids/util/generator/GeneratorFunctions.java svneol=native#text/plain
-src/main/java/net/slightlymagic/braids/util/generator/package-info.java svneol=native#text/plain
-src/main/java/net/slightlymagic/braids/util/progress_monitor/BaseProgressMonitor.java svneol=native#text/plain
-src/main/java/net/slightlymagic/braids/util/progress_monitor/BraidsProgressMonitor.java svneol=native#text/plain
-src/main/java/net/slightlymagic/braids/util/progress_monitor/StderrProgressMonitor.java svneol=native#text/plain
-src/main/java/net/slightlymagic/braids/util/progress_monitor/package-info.java svneol=native#text/plain
src/main/java/tree/properties/PropertyElement.java svneol=native#text/plain
src/main/java/tree/properties/PropertyType.java svneol=native#text/plain
src/main/java/tree/properties/TreeProperties.java svneol=native#text/plain
diff --git a/src/main/java/forge/AllZone.java b/src/main/java/forge/AllZone.java
index fea739155d3..b4255b59a98 100644
--- a/src/main/java/forge/AllZone.java
+++ b/src/main/java/forge/AllZone.java
@@ -20,7 +20,6 @@ package forge;
import java.util.Arrays;
import java.util.List;
-import forge.Constant.Zone;
import forge.card.cardfactory.CardFactoryInterface;
import forge.card.cardfactory.PreloadingCardFactory;
import forge.card.replacement.ReplacementHandler;
@@ -30,7 +29,9 @@ import forge.game.GameState;
import forge.game.phase.Combat;
import forge.game.phase.EndOfTurn;
import forge.game.player.Player;
-import forge.game.player.PlayerZone;
+import forge.game.zone.MagicStack;
+import forge.game.zone.PlayerZone;
+import forge.game.zone.ZoneType;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import forge.quest.QuestController;
@@ -226,7 +227,7 @@ public final class AllZone {
*
* Will eventually be marked deprecated.
*
- * @return a {@link forge.MagicStack} object.
+ * @return a {@link forge.game.zone.MagicStack} object.
* @since 1.0.15
*/
public static MagicStack getStack() {
@@ -333,7 +334,7 @@ public final class AllZone {
*
* Will eventually be marked deprecated.
*
- * @return a {@link forge.game.player.PlayerZone} object.
+ * @return a {@link forge.game.zone.PlayerZone} object.
* @since 1.0.15
*/
public static PlayerZone getStackZone() {
@@ -347,7 +348,7 @@ public final class AllZone {
*
* @param c
* a {@link forge.Card} object.
- * @return a {@link forge.game.player.PlayerZone} object.
+ * @return a {@link forge.game.zone.PlayerZone} object.
*/
public static PlayerZone getZoneOf(final Card c) {
final GameState gameState = Singletons.getModel().getGameState();
@@ -360,7 +361,7 @@ public final class AllZone {
}
for (final Player p : gameState.getPlayers()) {
- for (final Zone z : Player.ALL_ZONES) {
+ for (final ZoneType z : Player.ALL_ZONES) {
final PlayerZone pz = p.getZone(z);
if (pz.contains(c)) {
return pz;
@@ -381,13 +382,13 @@ public final class AllZone {
* Constant.Zone
* @return boolean
*/
- public static boolean isCardInZone(final Card c, final Constant.Zone zone) {
+ public static boolean isCardInZone(final Card c, final ZoneType zone) {
final GameState gameState = Singletons.getModel().getGameState();
if (gameState == null) {
return false;
}
- if (zone.equals(Constant.Zone.Stack)) {
+ if (zone.equals(ZoneType.Stack)) {
if (gameState.getStackZone().contains(c)) {
return true;
}
@@ -413,7 +414,7 @@ public final class AllZone {
return;
}
for (final Player p : gameState.getPlayers()) {
- for (final Zone z : Player.ALL_ZONES) {
+ for (final ZoneType z : Player.ALL_ZONES) {
p.getZone(z).resetCardsAddedThisTurn();
}
}
diff --git a/src/main/java/forge/AllZoneUtil.java b/src/main/java/forge/AllZoneUtil.java
index 3a52970de27..27c06030518 100644
--- a/src/main/java/forge/AllZoneUtil.java
+++ b/src/main/java/forge/AllZoneUtil.java
@@ -18,8 +18,8 @@
package forge;
import java.util.ArrayList;
-import forge.Constant.Zone;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
/**
* AllZoneUtil contains static functions used to get CardLists of various cards
@@ -40,14 +40,14 @@ public abstract class AllZoneUtil {
* Constant.Zone
* @return a CardList with all cards currently in a graveyard
*/
- public static CardList getCardsIn(final Constant.Zone zone) {
+ public static CardList getCardsIn(final ZoneType zone) {
final CardList cards = new CardList();
getCardsIn(zone, cards);
return cards;
}
- private static void getCardsIn(final Constant.Zone zone, final CardList cards) {
- if (zone == Zone.Stack) {
+ private static void getCardsIn(final ZoneType zone, final CardList cards) {
+ if (zone == ZoneType.Stack) {
cards.addAll(AllZone.getStackZone().getCards());
} else {
for (final Player p : AllZone.getPlayersInGame()) {
@@ -56,17 +56,17 @@ public abstract class AllZoneUtil {
}
}
- public static CardList getCardsIn(final Iterable zones) {
+ public static CardList getCardsIn(final Iterable zones) {
final CardList cards = new CardList();
- for (final Zone z : zones) {
+ for (final ZoneType z : zones) {
getCardsIn(z, cards);
}
return cards;
}
- public static CardList getCardsIn(final Constant.Zone[] zones) {
+ public static CardList getCardsIn(final ZoneType[] zones) {
final CardList cards = new CardList();
- for (final Zone z : zones) {
+ for (final ZoneType z : zones) {
getCardsIn(z, cards);
}
return cards;
@@ -82,7 +82,7 @@ public abstract class AllZoneUtil {
* a String
* @return a CardList with all cards currently in a graveyard
*/
- public static CardList getCardsIn(final Constant.Zone zone, final String cardName) {
+ public static CardList getCardsIn(final ZoneType zone, final String cardName) {
return AllZoneUtil.getCardsIn(zone).getName(cardName);
}
@@ -95,7 +95,7 @@ public abstract class AllZoneUtil {
* @return a CardList of all creatures on the battlefield on both sides
*/
public static CardList getCreaturesInPlay() {
- final CardList creats = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final CardList creats = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
return creats.filter(CardListFilter.CREATURES);
}
@@ -107,7 +107,7 @@ public abstract class AllZoneUtil {
* @return a CardList containing all creatures a given player has in play
*/
public static CardList getCreaturesInPlay(final Player player) {
- final CardList creats = player.getCardsIn(Zone.Battlefield);
+ final CardList creats = player.getCardsIn(ZoneType.Battlefield);
return creats.filter(CardListFilter.CREATURES);
}
@@ -121,7 +121,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(ZoneType.Battlefield).filter(CardListFilter.LANDS);
}
/**
@@ -130,7 +130,7 @@ public abstract class AllZoneUtil {
* @return a CardList of all lands on the battlefield
*/
public static CardList getLandsInPlay() {
- return AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.LANDS);
+ return AllZoneUtil.getCardsIn(ZoneType.Battlefield).filter(CardListFilter.LANDS);
}
// =============================================================================
@@ -148,7 +148,7 @@ public abstract class AllZoneUtil {
* @return true is the card is in Human or Computer's Exile zone
*/
public static boolean isCardExiled(final Card c) {
- return AllZoneUtil.getCardsIn(Zone.Exile).contains(c);
+ return AllZoneUtil.getCardsIn(ZoneType.Exile).contains(c);
}
// /Check if a certain card is in play
@@ -163,7 +163,7 @@ public abstract class AllZoneUtil {
* @return a boolean.
*/
public static boolean isCardInPlay(final Card card) {
- return AllZoneUtil.getCardsIn(Zone.Battlefield).contains(card);
+ return AllZoneUtil.getCardsIn(ZoneType.Battlefield).contains(card);
}
/**
@@ -174,7 +174,7 @@ public abstract class AllZoneUtil {
* @return true is the card is in play, false otherwise
*/
public static boolean isCardInPlay(final String cardName) {
- for (Card card : AllZoneUtil.getCardsIn(Zone.Battlefield)) {
+ for (Card card : AllZoneUtil.getCardsIn(ZoneType.Battlefield)) {
if (card.getName().equals(cardName)) {
return true;
}
@@ -192,7 +192,7 @@ public abstract class AllZoneUtil {
* @return true if that player has that card in play, false otherwise
*/
public static boolean isCardInPlay(final String cardName, final Player player) {
- for (Card card : player.getCardsIn(Zone.Battlefield)) {
+ for (Card card : player.getCardsIn(ZoneType.Battlefield)) {
if (card.getName().equals(cardName)) {
return true;
}
@@ -226,7 +226,7 @@ public abstract class AllZoneUtil {
* @return a CardList of all cards in play of a given color
*/
public static CardList getPlayerColorInPlay(final Player player, final String color) {
- CardList cards = player.getCardsIn(Zone.Battlefield);
+ CardList cards = player.getCardsIn(ZoneType.Battlefield);
cards = cards.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
@@ -271,8 +271,8 @@ public abstract class AllZoneUtil {
public static int compareTypeAmountInPlay(final Player player, final String type) {
// returns the difference between player's
final Player opponent = player.getOpponent();
- final CardList playerList = player.getCardsIn(Zone.Battlefield).getType(type);
- final CardList opponentList = opponent.getCardsIn(Zone.Battlefield).getType(type);
+ final CardList playerList = player.getCardsIn(ZoneType.Battlefield).getType(type);
+ final CardList opponentList = opponent.getCardsIn(ZoneType.Battlefield).getType(type);
return (playerList.size() - opponentList.size());
}
@@ -290,8 +290,8 @@ public abstract class AllZoneUtil {
public static int compareTypeAmountInGraveyard(final Player player, final String type) {
// returns the difference between player's
final Player opponent = player.getOpponent();
- final CardList playerList = player.getCardsIn(Zone.Graveyard).getType(type);
- final CardList opponentList = opponent.getCardsIn(Zone.Graveyard).getType(type);
+ final CardList playerList = player.getCardsIn(ZoneType.Graveyard).getType(type);
+ final CardList opponentList = opponent.getCardsIn(ZoneType.Graveyard).getType(type);
return (playerList.size() - opponentList.size());
}
@@ -304,11 +304,11 @@ public abstract class AllZoneUtil {
public static CardList getCardsInGame() {
final CardList all = new CardList();
for (final Player player : AllZone.getPlayersInGame()) {
- all.addAll(player.getZone(Zone.Graveyard).getCards());
- all.addAll(player.getZone(Zone.Hand).getCards());
- all.addAll(player.getZone(Zone.Library).getCards());
- all.addAll(player.getZone(Zone.Battlefield).getCards(false));
- all.addAll(player.getZone(Zone.Exile).getCards());
+ all.addAll(player.getZone(ZoneType.Graveyard).getCards());
+ all.addAll(player.getZone(ZoneType.Hand).getCards());
+ all.addAll(player.getZone(ZoneType.Library).getCards());
+ all.addAll(player.getZone(ZoneType.Battlefield).getCards(false));
+ all.addAll(player.getZone(ZoneType.Exile).getCards());
}
all.addAll(AllZone.getStackZone().getCards());
return all;
@@ -325,7 +325,7 @@ public abstract class AllZoneUtil {
* @return a int.
*/
public static int getDoublingSeasonMagnitude(final Player player) {
- final int doublingSeasons = player.getCardsIn(Zone.Battlefield, "Doubling Season").size();
+ final int doublingSeasons = player.getCardsIn(ZoneType.Battlefield, "Doubling Season").size();
return (int) Math.pow(2, doublingSeasons); // pow(a,0) = 1; pow(a,1) = a
// ... no worries about size
// = 0
@@ -342,8 +342,8 @@ public abstract class AllZoneUtil {
* @return a int.
*/
public static int getTokenDoublersMagnitude(final Player player) {
- final int tokenDoublers = player.getCardsIn(Zone.Battlefield, "Parallel Lives").size()
- + player.getCardsIn(Zone.Battlefield, "Doubling Season").size();
+ final int tokenDoublers = player.getCardsIn(ZoneType.Battlefield, "Parallel Lives").size()
+ + player.getCardsIn(ZoneType.Battlefield, "Doubling Season").size();
return (int) Math.pow(2, tokenDoublers); // pow(a,0) = 1; pow(a,1) = a
// ... no worries about size =
// 0
diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java
index 0e7a28063e0..07718777225 100644
--- a/src/main/java/forge/Card.java
+++ b/src/main/java/forge/Card.java
@@ -33,7 +33,6 @@ import java.util.TreeMap;
import com.esotericsoftware.minlog.Log;
-import forge.Constant.Zone;
import forge.card.CardCharacteristics;
import forge.card.EditionInfo;
import forge.card.abilityfactory.AbilityFactory;
@@ -53,6 +52,7 @@ import forge.card.trigger.TriggerType;
import forge.card.trigger.ZCTrigger;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
import forge.item.CardDb;
import forge.util.MyRandom;
@@ -82,7 +82,7 @@ public class Card extends GameEntity implements Comparable {
private boolean isFlip = false;
private CardCharactersticName otherTransformable = null;
- private Zone castFrom = null;
+ private ZoneType castFrom = null;
private final CardDamageHistory damageHistory = new CardDamageHistory();
private Map counters = new TreeMap();
@@ -5497,7 +5497,7 @@ public class Card extends GameEntity implements Comparable {
* @return a boolean.
*/
public final boolean isSpell() {
- return (this.isInstant() || this.isSorcery() || (this.isAura() && !AllZoneUtil.getCardsIn(Zone.Battlefield)
+ return (this.isInstant() || this.isSorcery() || (this.isAura() && !AllZoneUtil.getCardsIn(ZoneType.Battlefield)
.contains(this)));
}
@@ -6470,7 +6470,7 @@ public class Card extends GameEntity implements Comparable {
}
} else if (property.startsWith("ControllerControls")) {
final String type = property.substring(18);
- final CardList list = this.getController().getCardsIn(Zone.Battlefield);
+ final CardList list = this.getController().getCardsIn(ZoneType.Battlefield);
if (list.getType(type).isEmpty()) {
return false;
}
@@ -6526,31 +6526,31 @@ public class Card extends GameEntity implements Comparable {
return false;
}
} else if (property.startsWith("Above")) { // "Are Above" Source
- final CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
+ final CardList list = this.getOwner().getCardsIn(ZoneType.Graveyard);
if (!list.getAbove(source, this)) {
return false;
}
} else if (property.startsWith("DirectlyAbove")) { // "Are Directly Above"
// Source
- final CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
+ final CardList list = this.getOwner().getCardsIn(ZoneType.Graveyard);
if (!list.getDirectlyAbove(source, this)) {
return false;
}
} else if (property.startsWith("TopGraveyardCreature")) {
- CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
+ CardList list = this.getOwner().getCardsIn(ZoneType.Graveyard);
list = list.getType("Creature");
list.reverse();
if (list.isEmpty() || !this.equals(list.get(0))) {
return false;
}
} else if (property.startsWith("TopGraveyard")) {
- final CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
+ final CardList list = this.getOwner().getCardsIn(ZoneType.Graveyard);
list.reverse();
if (list.isEmpty() || !this.equals(list.get(0))) {
return false;
}
} else if (property.startsWith("TopLibrary")) {
- final CardList list = this.getOwner().getCardsIn(Zone.Library);
+ final CardList list = this.getOwner().getCardsIn(ZoneType.Library);
if (list.isEmpty() || !this.equals(list.get(0))) {
return false;
}
@@ -6574,7 +6574,7 @@ public class Card extends GameEntity implements Comparable {
} else {
final String restriction = property.split("SharesColorWith ")[1];
if (restriction.equals("TopCardOfLibrary")) {
- final CardList list = sourceController.getCardsIn(Zone.Library);
+ final CardList list = sourceController.getCardsIn(ZoneType.Library);
if (list.isEmpty() || !this.sharesColorWith(list.get(0))) {
return false;
}
@@ -6586,7 +6586,7 @@ public class Card extends GameEntity implements Comparable {
}
} else {
boolean shares = false;
- for (final Card card : sourceController.getCardsIn(Constant.Zone.Battlefield)) {
+ for (final Card card : sourceController.getCardsIn(ZoneType.Battlefield)) {
if (card.isValid(restriction, sourceController, source) && this.sharesColorWith(card)) {
shares = true;
}
@@ -6604,7 +6604,7 @@ public class Card extends GameEntity implements Comparable {
} else {
final String restriction = property.split("sharesCreatureTypeWith ")[1];
if (restriction.equals("TopCardOfLibrary")) {
- final CardList list = sourceController.getCardsIn(Zone.Library);
+ final CardList list = sourceController.getCardsIn(ZoneType.Library);
if (list.isEmpty() || !this.sharesCreatureTypeWith(list.get(0))) {
return false;
}
@@ -6623,7 +6623,7 @@ public class Card extends GameEntity implements Comparable {
}
} else {
boolean shares = false;
- for (final Card card : sourceController.getCardsIn(Constant.Zone.Battlefield)) {
+ for (final Card card : sourceController.getCardsIn(ZoneType.Battlefield)) {
if (card.isValid(restriction, sourceController, source) && this.sharesCreatureTypeWith(card)) {
shares = true;
}
@@ -6636,12 +6636,12 @@ public class Card extends GameEntity implements Comparable {
} else if (property.startsWith("sharesNameWith")) {
final String restriction = property.split("sharesNameWith ")[1];
if (restriction.equals("YourGraveyard")) {
- final CardList list = sourceController.getCardsIn(Zone.Graveyard);
+ final CardList list = sourceController.getCardsIn(ZoneType.Graveyard);
if (list.isEmpty()) {
return false;
}
boolean shares = false;
- for (final Card card : sourceController.getCardsIn(Constant.Zone.Graveyard)) {
+ for (final Card card : sourceController.getCardsIn(ZoneType.Graveyard)) {
if (this.getName().equals(card.getName())) {
shares = true;
}
@@ -6649,13 +6649,13 @@ public class Card extends GameEntity implements Comparable {
if (!shares) {
return false;
}
- } else if (restriction.equals(Constant.Zone.Battlefield.toString())) {
- final CardList list = AllZoneUtil.getCardsIn(Constant.Zone.Battlefield);
+ } else if (restriction.equals(ZoneType.Battlefield.toString())) {
+ final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
if (list.isEmpty()) {
return false;
}
boolean shares = false;
- for (final Card card : AllZoneUtil.getCardsIn(Constant.Zone.Battlefield)) {
+ for (final Card card : AllZoneUtil.getCardsIn(ZoneType.Battlefield)) {
if (this.getName().equals(card.getName())) {
shares = true;
}
@@ -6822,7 +6822,7 @@ public class Card extends GameEntity implements Comparable {
}
}
} else if (property.startsWith("lowestCMC")) {
- final CardList list = AllZoneUtil.getCardsIn(Constant.Zone.Battlefield);
+ final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
for (final Card crd : list) {
if (!crd.isLand() && !crd.isImmutable() && (crd.getCMC() < this.getCMC())) {
return false;
@@ -7048,13 +7048,13 @@ public class Card extends GameEntity implements Comparable {
}
} else if (property.startsWith("wasCastFrom")) {
final String strZone = property.substring(11);
- final Zone realZone = Constant.Zone.smartValueOf(strZone);
+ final ZoneType realZone = ZoneType.smartValueOf(strZone);
if (realZone != this.getCastFrom()) {
return false;
}
} else if (property.startsWith("wasNotCastFrom")) {
final String strZone = property.substring(14);
- final Zone realZone = Constant.Zone.smartValueOf(strZone);
+ final ZoneType realZone = ZoneType.smartValueOf(strZone);
if (realZone == this.getCastFrom()) {
return false;
}
@@ -7814,7 +7814,7 @@ public class Card extends GameEntity implements Comparable {
}
// Prevent Damage static abilities
- final CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final CardList allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
for (final Card ca : allp) {
final ArrayList staticAbilities = ca.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {
@@ -7923,7 +7923,7 @@ public class Card extends GameEntity implements Comparable {
int restDamage = damage;
if (AllZoneUtil.isCardInPlay("Sulfuric Vapors") && source.isSpell() && source.isRed()) {
- final int amount = AllZoneUtil.getCardsIn(Zone.Battlefield, "Sulfuric Vapors").size();
+ final int amount = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Sulfuric Vapors").size();
for (int i = 0; i < amount; i++) {
restDamage += 1;
}
@@ -7931,14 +7931,14 @@ public class Card extends GameEntity implements Comparable {
if (AllZoneUtil.isCardInPlay("Pyromancer's Swath", source.getController())
&& (source.isInstant() || source.isSorcery()) && this.isCreature()) {
- final int amount = source.getController().getCardsIn(Zone.Battlefield, "Pyromancer's Swath").size();
+ final int amount = source.getController().getCardsIn(ZoneType.Battlefield, "Pyromancer's Swath").size();
for (int i = 0; i < amount; i++) {
restDamage += 2;
}
}
if (AllZoneUtil.isCardInPlay("Furnace of Rath") && this.isCreature()) {
- final int amount = AllZoneUtil.getCardsIn(Zone.Battlefield, "Furnace of Rath").size();
+ final int amount = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Furnace of Rath").size();
for (int i = 0; i < amount; i++) {
restDamage += restDamage;
}
@@ -7946,7 +7946,7 @@ public class Card extends GameEntity implements Comparable {
if (AllZoneUtil.isCardInPlay("Gratuitous Violence", source.getController()) && source.isCreature()
&& this.isCreature()) {
- final int amount = source.getController().getCardsIn(Zone.Battlefield, "Gratuitous Violence").size();
+ final int amount = source.getController().getCardsIn(ZoneType.Battlefield, "Gratuitous Violence").size();
for (int i = 0; i < amount; i++) {
restDamage += restDamage;
}
@@ -7954,14 +7954,14 @@ public class Card extends GameEntity implements Comparable {
if (AllZoneUtil.isCardInPlay("Fire Servant", source.getController()) && source.isRed()
&& (source.isInstant() || source.isSorcery())) {
- final int amount = source.getController().getCardsIn(Zone.Battlefield, "Fire Servant").size();
+ final int amount = source.getController().getCardsIn(ZoneType.Battlefield, "Fire Servant").size();
for (int i = 0; i < amount; i++) {
restDamage += restDamage;
}
}
if (AllZoneUtil.isCardInPlay("Benevolent Unicorn") && source.isSpell() && this.isCreature()) {
- final int amount = AllZoneUtil.getCardsIn(Zone.Battlefield, "Benevolent Unicorn").size();
+ final int amount = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Benevolent Unicorn").size();
for (int i = 0; i < amount; i++) {
if (restDamage > 0) {
restDamage -= 1;
@@ -7970,7 +7970,7 @@ public class Card extends GameEntity implements Comparable {
}
if (AllZoneUtil.isCardInPlay("Lashknife Barrier", this.getController()) && this.isCreature()) {
- final int amount = this.getController().getCardsIn(Zone.Battlefield, "Lashknife Barrier").size();
+ final int amount = this.getController().getCardsIn(ZoneType.Battlefield, "Lashknife Barrier").size();
for (int i = 0; i < amount; i++) {
if (restDamage > 0) {
restDamage -= 1;
@@ -8523,7 +8523,7 @@ public class Card extends GameEntity implements Comparable {
* Constant.Zone
* @return boolean
*/
- public boolean isInZone(final Constant.Zone zone) {
+ public boolean isInZone(final ZoneType zone) {
return AllZone.isCardInZone(this, zone);
}
@@ -8542,7 +8542,7 @@ public class Card extends GameEntity implements Comparable {
}
// CantTarget static abilities
- final CardList allp = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final CardList allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
for (final Card ca : allp) {
final ArrayList staticAbilities = ca.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {
@@ -8553,7 +8553,7 @@ public class Card extends GameEntity implements Comparable {
}
// keywords don't work outside battlefield
- if (!this.isInZone(Constant.Zone.Battlefield)) {
+ if (!this.isInZone(ZoneType.Battlefield)) {
return true;
}
@@ -8685,7 +8685,7 @@ public class Card extends GameEntity implements Comparable {
*
* @return the castFrom
*/
- public Zone getCastFrom() {
+ public ZoneType getCastFrom() {
return this.castFrom;
}
@@ -8693,7 +8693,7 @@ public class Card extends GameEntity implements Comparable {
* @param castFrom0
* the castFrom to set
*/
- public void setCastFrom(final Zone castFrom0) {
+ public void setCastFrom(final ZoneType castFrom0) {
this.castFrom = castFrom0;
}
diff --git a/src/main/java/forge/CardReader.java b/src/main/java/forge/CardReader.java
index c019318bedd..413e3888314 100644
--- a/src/main/java/forge/CardReader.java
+++ b/src/main/java/forge/CardReader.java
@@ -35,8 +35,8 @@ import java.util.zip.ZipFile;
import javax.swing.SwingUtilities;
-import net.slightlymagic.braids.util.generator.FindNonDirectoriesSkipDotDirectoriesGenerator;
-import net.slightlymagic.braids.util.generator.GeneratorFunctions;
+import net.slightlymagic.braids.FindNonDirectoriesSkipDotDirectoriesGenerator;
+import net.slightlymagic.braids.GeneratorFunctions;
import com.google.code.jyield.Generator;
import com.google.code.jyield.YieldUtils;
diff --git a/src/main/java/forge/CardUtil.java b/src/main/java/forge/CardUtil.java
index 5953de9d2c1..111f76eaa22 100644
--- a/src/main/java/forge/CardUtil.java
+++ b/src/main/java/forge/CardUtil.java
@@ -37,7 +37,8 @@ import forge.card.spellability.SpellAbility;
import forge.card.spellability.SpellAbilityList;
import forge.card.trigger.TriggerType;
import forge.control.input.InputPayManaCostUtil;
-import forge.game.player.DefaultPlayerZone;
+import forge.game.zone.DefaultPlayerZone;
+import forge.game.zone.ZoneType;
import forge.gui.GuiDisplayUtil;
import forge.item.CardPrinted;
import forge.properties.ForgeProps;
@@ -850,10 +851,10 @@ public final class CardUtil {
* a Card object
* @return a CardList that matches the given criteria
*/
- public static CardList getThisTurnEntered(final Constant.Zone to, final Constant.Zone from, final String valid,
+ public static CardList getThisTurnEntered(final ZoneType to, final ZoneType from, final String valid,
final Card src) {
CardList res = new CardList();
- if (to != Constant.Zone.Stack) {
+ if (to != ZoneType.Stack) {
res.addAll(((DefaultPlayerZone) AllZone.getComputerPlayer().getZone(to)).getCardsAddedThisTurn(from));
res.addAll(((DefaultPlayerZone) AllZone.getHumanPlayer().getZone(to)).getCardsAddedThisTurn(from));
} else {
diff --git a/src/main/java/forge/Constant.java b/src/main/java/forge/Constant.java
index 8562cd9c678..c9f68a557f6 100644
--- a/src/main/java/forge/Constant.java
+++ b/src/main/java/forge/Constant.java
@@ -124,77 +124,6 @@ public final class Constant {
}
}
- /**
- * The Enum Zone.
- */
- public enum Zone {
-
- /** The Hand. */
- Hand(true),
-
- /** The Library. */
- Library(true),
-
- /** The Graveyard. */
- Graveyard(false),
-
- /** The Battlefield. */
- Battlefield(false),
-
- /** The Exile. */
- Exile(false),
-
- /** The Command. */
- Command(false),
-
- /** The Stack. */
- Stack(false),
-
- Sideboard(true),
- /** Ante. */
- Ante(false);
-
- public static final Zone[] StaticAbilitiesSourceZones = new Zone[]{Battlefield, Graveyard, Exile/*, Hand*/};
-
- private final boolean holdsHiddenInfo;
- private Zone(boolean holdsHidden) {
- holdsHiddenInfo = holdsHidden;
- }
-
-
- public static Zone smartValueOf(final String value) {
- if (value == null) {
- return null;
- }
- if ("All".equals(value)) {
- return null;
- }
- final String valToCompate = value.trim();
- for (final Zone v : Zone.values()) {
- if (v.name().compareToIgnoreCase(valToCompate) == 0) {
- return v;
- }
- }
- throw new IllegalArgumentException("No element named " + value + " in enum Zone");
- }
-
- public static List listValueOf(final String values) {
- final List result = new ArrayList();
- for (final String s : values.split("[, ]+")) {
- result.add(Zone.smartValueOf(s));
- }
- return result;
- }
-
- public boolean isHidden() {
- return holdsHiddenInfo;
- }
-
- public boolean isKnown() {
- return !holdsHiddenInfo;
- }
- }
-
/**
* The Interface Color.
*/
diff --git a/src/main/java/forge/GameAction.java b/src/main/java/forge/GameAction.java
index c6539585104..90aa870ae2b 100644
--- a/src/main/java/forge/GameAction.java
+++ b/src/main/java/forge/GameAction.java
@@ -23,7 +23,6 @@ import java.util.Iterator;
import javax.swing.JFrame;
-import forge.Constant.Zone;
import forge.card.abilityfactory.AbilityFactory;
import forge.card.abilityfactory.AbilityFactoryAttach;
import forge.card.abilityfactory.AbilityFactoryCharm;
@@ -52,8 +51,9 @@ import forge.game.GameSummary;
import forge.game.phase.PhaseHandler;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
-import forge.game.player.PlayerZone;
-import forge.game.player.PlayerZoneComesIntoPlay;
+import forge.game.zone.PlayerZone;
+import forge.game.zone.PlayerZoneComesIntoPlay;
+import forge.game.zone.ZoneType;
import forge.gui.GuiUtils;
import forge.view.match.ViewWinLose;
@@ -86,9 +86,9 @@ public class GameAction {
*
*
* @param zoneFrom
- * a {@link forge.game.player.PlayerZone} object.
+ * a {@link forge.game.zone.PlayerZone} object.
* @param zoneTo
- * a {@link forge.game.player.PlayerZone} object.
+ * a {@link forge.game.zone.PlayerZone} object.
* @param c
* a {@link forge.Card} object.
* @return a {@link forge.Card} object.
@@ -120,7 +120,7 @@ public class GameAction {
repParams.put("Destination", zoneTo.getZoneType());
if (AllZone.getReplacementHandler().run(repParams)) {
- if (AllZone.getStack().isResolving(c) && !zoneTo.is(Constant.Zone.Graveyard)) {
+ if (AllZone.getStack().isResolving(c) && !zoneTo.is(ZoneType.Graveyard)) {
return Singletons.getModel().getGameAction().moveToGraveyard(c);
}
return c;
@@ -133,8 +133,8 @@ public class GameAction {
// Don't copy Tokens, Cards staying in same zone, or cards entering
// Battlefield
- if (c.isToken() || suppress || zoneTo.is(Constant.Zone.Battlefield) || zoneTo.is(Constant.Zone.Stack)
- || (zoneFrom.is(Constant.Zone.Stack) && zoneTo.is(Constant.Zone.Battlefield))) {
+ if (c.isToken() || suppress || zoneTo.is(ZoneType.Battlefield) || zoneTo.is(ZoneType.Stack)
+ || (zoneFrom.is(ZoneType.Stack) && zoneTo.is(ZoneType.Battlefield))) {
lastKnownInfo = c;
copied = c;
} else {
@@ -168,12 +168,12 @@ public class GameAction {
zoneTo.add(copied);
// Tokens outside the battlefield disappear immideately.
- if (copied.isToken() && !zoneTo.is(Constant.Zone.Battlefield)) {
+ if (copied.isToken() && !zoneTo.is(ZoneType.Battlefield)) {
zoneTo.remove(copied);
}
if (zoneFrom != null) {
- if (zoneFrom.is(Constant.Zone.Battlefield) && c.isCreature()) {
+ if (zoneFrom.is(ZoneType.Battlefield) && c.isCreature()) {
AllZone.getCombat().removeFromCombat(c);
}
@@ -203,11 +203,11 @@ public class GameAction {
// remove all counters from the card if destination is not the
// battlefield
// UNLESS we're dealing with Skullbriar, the Walking Grave
- if (!zoneTo.is(Constant.Zone.Battlefield)) {
+ if (!zoneTo.is(ZoneType.Battlefield)) {
// remove all counters from the card if destination is not the battlefield
// UNLESS we're dealing with Skullbriar, the Walking Grave
- if (!(c.getName().equals("Skullbriar, the Walking Grave") && !zoneTo.is(Constant.Zone.Hand) && !zoneTo
- .is(Constant.Zone.Library))) {
+ if (!(c.getName().equals("Skullbriar, the Walking Grave") && !zoneTo.is(ZoneType.Hand) && !zoneTo
+ .is(ZoneType.Library))) {
copied.clearCounters();
}
AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed);
@@ -232,7 +232,7 @@ public class GameAction {
*
*
* @param zone
- * a {@link forge.game.player.PlayerZone} object.
+ * a {@link forge.game.zone.PlayerZone} object.
* @param c
* a {@link forge.Card} object.
* @return a {@link forge.Card} object.
@@ -244,8 +244,8 @@ public class GameAction {
// String prevName = prev != null ? prev.getZoneName() : "";
if (c.hasKeyword("If CARDNAME would leave the battlefield, exile it instead of putting it anywhere else.")
- && !zone.is(Constant.Zone.Exile)) {
- final PlayerZone removed = c.getOwner().getZone(Constant.Zone.Exile);
+ && !zone.is(ZoneType.Exile)) {
+ final PlayerZone removed = c.getOwner().getZone(ZoneType.Exile);
c.removeAllExtrinsicKeyword("If CARDNAME would leave the battlefield, "
+ "exile it instead of putting it anywhere else.");
return this.moveTo(removed, c);
@@ -255,15 +255,15 @@ public class GameAction {
c = GameAction.changeZone(prev, zone, c);
- if (zone.is(Zone.Stack)) {
+ if (zone.is(ZoneType.Stack)) {
c.setCastFrom(prev.getZoneType());
} else if (prev == null) {
c.setCastFrom(null);
- } else if (!(zone.is(Zone.Battlefield) && prev.is(Zone.Stack))) {
+ } else if (!(zone.is(ZoneType.Battlefield) && prev.is(ZoneType.Stack))) {
c.setCastFrom(null);
}
- if (c.isAura() && zone.is(Constant.Zone.Battlefield) && ((prev == null) || !prev.is(Constant.Zone.Stack))
+ if (c.isAura() && zone.is(ZoneType.Battlefield) && ((prev == null) || !prev.is(ZoneType.Stack))
&& !c.isEnchanting()) {
// TODO Need a way to override this for Abilities that put Auras
// into play attached to things
@@ -285,8 +285,8 @@ public class GameAction {
public final Card moveToPlayFromHand(Card c) {
// handles the case for Clone, etc where prev was null
- final PlayerZone hand = c.getOwner().getZone(Constant.Zone.Hand);
- final PlayerZone play = c.getController().getZone(Constant.Zone.Battlefield);
+ final PlayerZone hand = c.getOwner().getZone(ZoneType.Hand);
+ final PlayerZone play = c.getController().getZone(ZoneType.Battlefield);
c = GameAction.changeZone(hand, play, c);
@@ -340,8 +340,8 @@ public class GameAction {
}
AllZone.getTriggerHandler().suppressMode(TriggerType.ChangesZone);
- ((PlayerZoneComesIntoPlay) AllZone.getHumanPlayer().getZone(Zone.Battlefield)).setTriggers(false);
- ((PlayerZoneComesIntoPlay) AllZone.getComputerPlayer().getZone(Zone.Battlefield)).setTriggers(false);
+ ((PlayerZoneComesIntoPlay) AllZone.getHumanPlayer().getZone(ZoneType.Battlefield)).setTriggers(false);
+ ((PlayerZoneComesIntoPlay) AllZone.getComputerPlayer().getZone(ZoneType.Battlefield)).setTriggers(false);
final int tiz = c.getTurnInZone();
@@ -360,8 +360,8 @@ public class GameAction {
AllZone.getTriggerHandler().runTrigger(TriggerType.ChangesController, runParams);
AllZone.getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
- ((PlayerZoneComesIntoPlay) AllZone.getHumanPlayer().getZone(Zone.Battlefield)).setTriggers(true);
- ((PlayerZoneComesIntoPlay) AllZone.getComputerPlayer().getZone(Zone.Battlefield)).setTriggers(true);
+ ((PlayerZoneComesIntoPlay) AllZone.getHumanPlayer().getZone(ZoneType.Battlefield)).setTriggers(true);
+ ((PlayerZoneComesIntoPlay) AllZone.getComputerPlayer().getZone(ZoneType.Battlefield)).setTriggers(true);
}
/**
@@ -390,12 +390,12 @@ public class GameAction {
public final Card moveToGraveyard(Card c) {
final PlayerZone origZone = AllZone.getZoneOf(c);
final Player owner = c.getOwner();
- final PlayerZone grave = owner.getZone(Constant.Zone.Graveyard);
- final PlayerZone exile = owner.getZone(Constant.Zone.Exile);
- final CardList ownerBoard = owner.getCardsIn(Constant.Zone.Battlefield);
- final CardList opponentsBoard = owner.getOpponent().getCardsIn(Constant.Zone.Battlefield);
+ final PlayerZone grave = owner.getZone(ZoneType.Graveyard);
+ final PlayerZone exile = owner.getZone(ZoneType.Exile);
+ final CardList ownerBoard = owner.getCardsIn(ZoneType.Battlefield);
+ final CardList opponentsBoard = owner.getOpponent().getCardsIn(ZoneType.Battlefield);
- if (c.getName().equals("Nissa's Chosen") && origZone.is(Constant.Zone.Battlefield)) {
+ if (c.getName().equals("Nissa's Chosen") && origZone.is(ZoneType.Battlefield)) {
return this.moveToLibrary(c, -1);
}
@@ -424,8 +424,8 @@ public class GameAction {
c = this.moveTo(grave, c);
// Recover keyword
- if (c.isCreature() && origZone.is(Constant.Zone.Battlefield)) {
- for (final Card recoverable : c.getOwner().getCardsIn(Zone.Graveyard)) {
+ if (c.isCreature() && origZone.is(ZoneType.Battlefield)) {
+ for (final Card recoverable : c.getOwner().getCardsIn(ZoneType.Graveyard)) {
if (recoverable.hasStartOfKeyword("Recover") && !recoverable.equals(c)) {
final String recoverCost = recoverable.getKeyword().get(recoverable.getKeywordPosition("Recover"))
@@ -504,7 +504,7 @@ public class GameAction {
* @return a {@link forge.Card} object.
*/
public final Card moveToHand(final Card c) {
- final PlayerZone hand = c.getOwner().getZone(Constant.Zone.Hand);
+ final PlayerZone hand = c.getOwner().getZone(ZoneType.Hand);
return this.moveTo(hand, c);
}
@@ -518,7 +518,7 @@ public class GameAction {
* @return a {@link forge.Card} object.
*/
public final Card moveToPlay(final Card c) {
- final PlayerZone play = c.getOwner().getZone(Constant.Zone.Battlefield);
+ final PlayerZone play = c.getOwner().getZone(ZoneType.Battlefield);
return this.moveTo(play, c);
}
@@ -535,7 +535,7 @@ public class GameAction {
*/
public final Card moveToPlay(final Card c, final Player p) {
// move to a specific player's Battlefield
- final PlayerZone play = p.getZone(Constant.Zone.Battlefield);
+ final PlayerZone play = p.getZone(ZoneType.Battlefield);
return this.moveTo(play, c);
}
@@ -578,10 +578,10 @@ public class GameAction {
*/
public final Card moveToLibrary(Card c, int libPosition) {
final PlayerZone p = AllZone.getZoneOf(c);
- final PlayerZone library = c.getOwner().getZone(Constant.Zone.Library);
+ final PlayerZone library = c.getOwner().getZone(ZoneType.Library);
if (c.hasKeyword("If CARDNAME would leave the battlefield, exile it instead of putting it anywhere else.")) {
- final PlayerZone removed = c.getOwner().getZone(Constant.Zone.Exile);
+ final PlayerZone removed = c.getOwner().getZone(ZoneType.Exile);
c.removeAllExtrinsicKeyword("If CARDNAME would leave the battlefield, "
+ "exile it instead of putting it anywhere else.");
return this.moveTo(removed, c);
@@ -601,7 +601,7 @@ public class GameAction {
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);
}
- if ((p != null) && p.is(Constant.Zone.Battlefield)) {
+ if ((p != null) && p.is(ZoneType.Battlefield)) {
c = AllZone.getCardFactory().copyCard(c);
}
@@ -620,7 +620,7 @@ public class GameAction {
} else {
runParams.put("Origin", null);
}
- runParams.put("Destination", Constant.Zone.Library);
+ runParams.put("Destination", ZoneType.Library);
AllZone.getTriggerHandler().runTrigger(TriggerType.ChangesZone, runParams);
Player owner = p.getPlayer();
@@ -645,7 +645,7 @@ public class GameAction {
return c;
}
- final PlayerZone removed = c.getOwner().getZone(Constant.Zone.Exile);
+ final PlayerZone removed = c.getOwner().getZone(ZoneType.Exile);
return Singletons.getModel().getGameAction().moveTo(removed, c);
}
@@ -659,7 +659,7 @@ public class GameAction {
* the c
* @return the card
*/
- public final Card moveTo(final Zone name, final Card c) {
+ public final Card moveTo(final ZoneType name, final Card c) {
return this.moveTo(name, c, 0);
}
@@ -676,20 +676,20 @@ public class GameAction {
* a int.
* @return a {@link forge.Card} object.
*/
- public final Card moveTo(final Zone name, final Card c, final int libPosition) {
+ public final Card moveTo(final ZoneType name, final Card c, final int libPosition) {
// Call specific functions to set PlayerZone, then move onto moveTo
- if (name.equals(Constant.Zone.Hand)) {
+ if (name.equals(ZoneType.Hand)) {
return this.moveToHand(c);
- } else if (name.equals(Constant.Zone.Library)) {
+ } else if (name.equals(ZoneType.Library)) {
return this.moveToLibrary(c, libPosition);
- } else if (name.equals(Constant.Zone.Battlefield)) {
+ } else if (name.equals(ZoneType.Battlefield)) {
return this.moveToPlay(c);
- } else if (name.equals(Constant.Zone.Graveyard)) {
+ } else if (name.equals(ZoneType.Graveyard)) {
return this.moveToGraveyard(c);
- } else if (name.equals(Constant.Zone.Exile)) {
+ } else if (name.equals(ZoneType.Exile)) {
return this.exile(c);
- } else if (name.equals(Constant.Zone.Ante)) {
- final PlayerZone ante = c.getOwner().getZone(Constant.Zone.Ante);
+ } else if (name.equals(ZoneType.Ante)) {
+ final PlayerZone ante = c.getOwner().getZone(ZoneType.Ante);
return this.moveTo(ante, c);
} else {
return this.moveToStack(c);
@@ -899,7 +899,7 @@ public class GameAction {
final HashMap runParams = new HashMap();
AllZone.getTriggerHandler().runTrigger(TriggerType.Always, runParams);
- final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
Card c;
final Iterator it = list.iterator();
@@ -1038,7 +1038,7 @@ public class GameAction {
*/
private void destroyPlaneswalkers() {
// get all Planeswalkers
- final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield).getType("Planeswalker");
+ final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield).getType("Planeswalker");
Card c;
for (int i = 0; i < list.size(); i++) {
@@ -1071,10 +1071,10 @@ public class GameAction {
*
*/
private void destroyLegendaryCreatures() {
- final CardList a = AllZoneUtil.getCardsIn(Zone.Battlefield).getType("Legendary");
+ final CardList a = AllZoneUtil.getCardsIn(ZoneType.Battlefield).getType("Legendary");
while (!a.isEmpty() && !AllZoneUtil.isCardInPlay("Mirror Gallery")) {
- CardList b = AllZoneUtil.getCardsIn(Zone.Battlefield, a.get(0).getName());
+ CardList b = AllZoneUtil.getCardsIn(ZoneType.Battlefield, a.get(0).getName());
b = b.getType("Legendary");
b = b.filter(new CardListFilter() {
@Override
@@ -1258,8 +1258,8 @@ public class GameAction {
@Override
public void resolve() {
- if (AllZone.getZoneOf(persistCard).is(Constant.Zone.Graveyard)) {
- final PlayerZone ownerPlay = persistCard.getOwner().getZone(Constant.Zone.Battlefield);
+ if (AllZone.getZoneOf(persistCard).is(ZoneType.Graveyard)) {
+ final PlayerZone ownerPlay = persistCard.getOwner().getZone(ZoneType.Battlefield);
final Card card = GameAction.this.moveTo(ownerPlay, persistCard);
card.addCounter(Counters.M1M1, 1);
}
@@ -1275,8 +1275,8 @@ public class GameAction {
@Override
public void resolve() {
- if (AllZone.getZoneOf(undyingCard).is(Constant.Zone.Graveyard)) {
- final PlayerZone ownerPlay = undyingCard.getOwner().getZone(Constant.Zone.Battlefield);
+ if (AllZone.getZoneOf(undyingCard).is(ZoneType.Graveyard)) {
+ final PlayerZone ownerPlay = undyingCard.getOwner().getZone(ZoneType.Battlefield);
final Card card = GameAction.this.moveTo(ownerPlay, undyingCard);
card.addCounter(Counters.P1P1, 1);
}
@@ -1368,7 +1368,7 @@ public class GameAction {
flashback.setFlashBackAbility(true);
SpellAbilityRestriction sar = new SpellAbilityRestriction();
sar.setVariables(sa.getRestrictions());
- sar.setZone(Constant.Zone.Graveyard);
+ sar.setZone(ZoneType.Graveyard);
flashback.setRestrictions(sar);
// there is a flashback cost (and not the cards cost)
@@ -1457,7 +1457,7 @@ public class GameAction {
final PlayerZone zone = AllZone.getZoneOf(c);
if (c.isLand() && human.canPlayLand()) {
- if (zone.is(Zone.Hand) || ((!zone.is(Zone.Battlefield)) && c.hasStartOfKeyword("May be played"))) {
+ if (zone.is(ZoneType.Hand) || ((!zone.is(ZoneType.Battlefield)) && c.hasStartOfKeyword("May be played"))) {
choices.add("Play land");
}
}
@@ -1621,16 +1621,16 @@ public class GameAction {
if (originalCard.getName().equals("Avatar of Woe")) {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player opponent = player.getOpponent();
- CardList playerCreatureList = player.getCardsIn(Zone.Graveyard);
+ CardList playerCreatureList = player.getCardsIn(ZoneType.Graveyard);
playerCreatureList = playerCreatureList.getType("Creature");
- CardList opponentCreatureList = opponent.getCardsIn(Zone.Graveyard);
+ CardList opponentCreatureList = opponent.getCardsIn(ZoneType.Graveyard);
opponentCreatureList = opponentCreatureList.getType("Creature");
if ((playerCreatureList.size() + opponentCreatureList.size()) >= 10) {
manaCost = new ManaCost("B B");
} // Avatar of Woe
} else if (originalCard.getName().equals("Avatar of Will")) {
final Player opponent = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getOpponent();
- final CardList opponentHandList = opponent.getCardsIn(Zone.Hand);
+ final CardList opponentHandList = opponent.getCardsIn(ZoneType.Hand);
if (opponentHandList.size() == 0) {
manaCost = new ManaCost("U U");
} // Avatar of Will
@@ -1649,7 +1649,7 @@ public class GameAction {
manaCost = new ManaCost("G G");
} // Avatar of Might
} else if (spell.getIsDelve()) {
- final int cardsInGrave = originalCard.getController().getCardsIn(Zone.Graveyard).size();
+ final int cardsInGrave = originalCard.getController().getCardsIn(ZoneType.Graveyard).size();
final ArrayList choiceList = new ArrayList();
for (int i = 0; i <= cardsInGrave; i++) {
choiceList.add(i);
@@ -1660,7 +1660,7 @@ public class GameAction {
final int chosenAmount = (Integer) GuiUtils
.chooseOne("Exile how many cards?", choiceList.toArray());
System.out.println("Delve for " + chosenAmount);
- final CardList choices = AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard);
+ final CardList choices = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
final CardList chosen = new CardList();
for (int i = 0; i < chosenAmount; i++) {
final Card nowChosen = GuiUtils.chooseOneOrNone("Exile which card?", choices.toArray());
@@ -1693,7 +1693,7 @@ public class GameAction {
}
for (int i = 0; i < numToExile; i++) {
- final CardList grave = new CardList(AllZone.getComputerPlayer().getZone(Zone.Graveyard)
+ final CardList grave = new CardList(AllZone.getComputerPlayer().getZone(ZoneType.Graveyard)
.getCards());
Card chosen = null;
for (final Card c : grave) { // Exile noncreatures first
@@ -1722,7 +1722,7 @@ public class GameAction {
manaCost.decreaseColorlessMana(numToExile);
}
} else if (spell.getSourceCard().hasKeyword("Convoke")) {
- CardList untappedCreats = spell.getActivatingPlayer().getCardsIn(Zone.Battlefield).getType("Creature");
+ CardList untappedCreats = spell.getActivatingPlayer().getCardsIn(ZoneType.Battlefield).getType("Creature");
untappedCreats = untappedCreats.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
@@ -1816,7 +1816,7 @@ public class GameAction {
} // isSpell
// Get Cost Reduction
- CardList cardsInPlay = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList cardsInPlay = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
cardsInPlay = cardsInPlay.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
@@ -1827,8 +1827,8 @@ public class GameAction {
}
});
cardsInPlay.add(originalCard);
- final CardList playerPlay = controller.getCardsIn(Zone.Battlefield);
- final CardList playerHand = controller.getCardsIn(Zone.Hand);
+ final CardList playerPlay = controller.getCardsIn(ZoneType.Battlefield);
+ final CardList playerHand = controller.getCardsIn(ZoneType.Hand);
int xBonus = 0;
final int max = 25;
if (sa.isMultiKicker()) {
@@ -1950,7 +1950,7 @@ public class GameAction {
final String spilt = k[7];
final String[] colorSpilt = spilt.split("/");
k[7] = colorSpilt[1];
- CardList playerList = controller.getCardsIn(Zone.Battlefield);
+ CardList playerList = controller.getCardsIn(ZoneType.Battlefield);
playerList = playerList.getType(k[7]);
k[3] = String.valueOf(playerList.size());
}
@@ -2138,7 +2138,7 @@ public class GameAction {
final String spilt = k[7];
final String[] colorSpilt = spilt.split("/");
k[7] = colorSpilt[1];
- CardList playerList = controller.getCardsIn(Zone.Battlefield);
+ CardList playerList = controller.getCardsIn(ZoneType.Battlefield);
playerList = playerList.getType(k[7]);
k[3] = String.valueOf(playerList.size());
}
diff --git a/src/main/java/forge/GameActionUtil.java b/src/main/java/forge/GameActionUtil.java
index d0cde5d8568..522308bf5b3 100644
--- a/src/main/java/forge/GameActionUtil.java
+++ b/src/main/java/forge/GameActionUtil.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
import javax.swing.JOptionPane;
-import forge.Constant.Zone;
import forge.card.abilityfactory.AbilityFactory;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.spellability.Ability;
@@ -34,7 +33,8 @@ import forge.control.input.InputPayManaCostUtil;
import forge.game.GameLossReason;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
-import forge.game.player.PlayerZone;
+import forge.game.zone.PlayerZone;
+import forge.game.zone.ZoneType;
import forge.gui.GuiUtils;
import forge.util.MyRandom;
@@ -88,8 +88,8 @@ public final class GameActionUtil {
if (!c.isCopiedSpell()) {
final CardList humanNexus = AllZone.getHumanPlayer()
- .getCardsIn(Zone.Battlefield, "Maelstrom Nexus");
- final CardList computerNexus = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield,
+ .getCardsIn(ZoneType.Battlefield, "Maelstrom Nexus");
+ final CardList computerNexus = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield,
"Maelstrom Nexus");
final CardList maelstromNexii = new CardList();
@@ -117,7 +117,7 @@ public final class GameActionUtil {
final Ability ability = new Ability(c, "0") {
@Override
public void resolve() {
- final CardList topOfLibrary = controller.getCardsIn(Zone.Library);
+ final CardList topOfLibrary = controller.getCardsIn(ZoneType.Library);
final CardList revealed = new CardList();
if (topOfLibrary.size() == 0) {
@@ -212,9 +212,9 @@ public final class GameActionUtil {
@Override
public void execute() {
- final CardList humanThrummingStone = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield,
+ final CardList humanThrummingStone = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield,
"Thrumming Stone");
- final CardList computerThrummingStone = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield,
+ final CardList computerThrummingStone = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield,
"Thrumming Stone");
for (int i = 0; i < humanThrummingStone.size(); i++) {
@@ -248,7 +248,7 @@ public final class GameActionUtil {
final Ability ability = new Ability(c, "0") {
@Override
public void resolve() {
- final CardList topOfLibrary = controller.getCardsIn(Zone.Library);
+ final CardList topOfLibrary = controller.getCardsIn(ZoneType.Library);
final CardList revealed = new CardList();
int rippleNumber = rippleCount;
if (topOfLibrary.size() == 0) {
@@ -722,7 +722,7 @@ public final class GameActionUtil {
return;
}
- final CardList playerPerms = player.getCardsIn(Zone.Battlefield);
+ final CardList playerPerms = player.getCardsIn(ZoneType.Battlefield);
if (AllZoneUtil.isCardInPlay("Lich", player)) {
final CardList lichs = playerPerms.getName("Lich");
@@ -732,7 +732,7 @@ public final class GameActionUtil {
@Override
public void resolve() {
for (int i = 0; i < damage; i++) {
- CardList nonTokens = player.getCardsIn(Zone.Battlefield);
+ CardList nonTokens = player.getCardsIn(ZoneType.Battlefield);
nonTokens = nonTokens.filter(CardListFilter.NON_TOKEN);
if (nonTokens.size() == 0) {
player.loseConditionMet(GameLossReason.SpellEffect, lich.getName());
@@ -785,7 +785,7 @@ public final class GameActionUtil {
}
if (c.isCreature() && AllZoneUtil.isCardInPlay("Contested War Zone", player)) {
- final CardList zones = player.getCardsIn(Zone.Battlefield, "Contested War Zone");
+ final CardList zones = player.getCardsIn(ZoneType.Battlefield, "Contested War Zone");
for (final Card zone : zones) {
final Ability ability = new Ability(zone, "0") {
@Override
@@ -996,7 +996,7 @@ public final class GameActionUtil {
@Override
public void resolve() {
- final CardList libList = opponent.getCardsIn(Zone.Library);
+ final CardList libList = opponent.getCardsIn(ZoneType.Library);
int count = 0;
int broken = 0;
for (int i = 0; i < libList.size(); i = i + 4) {
@@ -1108,26 +1108,26 @@ public final class GameActionUtil {
public static boolean specialConditionsMet(final Card sourceCard, final String specialConditions) {
if (specialConditions.contains("CardsInHandMore")) {
- final CardList specialConditionsCardList = sourceCard.getController().getCardsIn(Zone.Hand);
+ final CardList specialConditionsCardList = sourceCard.getController().getCardsIn(ZoneType.Hand);
final String condition = specialConditions.split("/")[1];
if (specialConditionsCardList.size() < Integer.valueOf(condition)) {
return false;
}
}
if (specialConditions.contains("OppHandEmpty")) {
- final CardList oppHand = sourceCard.getController().getOpponent().getCardsIn(Zone.Hand);
+ final CardList oppHand = sourceCard.getController().getOpponent().getCardsIn(ZoneType.Hand);
if (!(oppHand.size() == 0)) {
return false;
}
}
if (specialConditions.contains("TopCardOfLibraryIsBlack")) {
- final PlayerZone lib = sourceCard.getController().getZone(Constant.Zone.Library);
+ final PlayerZone lib = sourceCard.getController().getZone(ZoneType.Library);
if (!(lib.get(0).isBlack())) {
return false;
}
}
if (specialConditions.contains("LibraryLE")) {
- final CardList library = sourceCard.getController().getCardsIn(Zone.Library);
+ final CardList library = sourceCard.getController().getCardsIn(ZoneType.Library);
final String maxnumber = specialConditions.split("/")[1];
if (library.size() > Integer.valueOf(maxnumber)) {
return false;
@@ -1141,7 +1141,7 @@ public final class GameActionUtil {
}
}
if (specialConditions.contains("OppCreatureInPlayGE")) {
- CardList oppInPlay = sourceCard.getController().getOpponent().getCardsIn(Zone.Battlefield);
+ CardList oppInPlay = sourceCard.getController().getOpponent().getCardsIn(ZoneType.Battlefield);
oppInPlay = oppInPlay.getType("Creature");
final String maxnumber = specialConditions.split("/")[1];
if (!(oppInPlay.size() >= Integer.valueOf(maxnumber))) {
@@ -1149,7 +1149,7 @@ public final class GameActionUtil {
}
}
if (specialConditions.contains("LandYouCtrlLE")) {
- CardList landInPlay = sourceCard.getController().getCardsIn(Zone.Battlefield);
+ CardList landInPlay = sourceCard.getController().getCardsIn(ZoneType.Battlefield);
landInPlay = landInPlay.getType("Land");
final String maxnumber = specialConditions.split("/")[1];
if (!(landInPlay.size() <= Integer.valueOf(maxnumber))) {
@@ -1157,7 +1157,7 @@ public final class GameActionUtil {
}
}
if (specialConditions.contains("LandOppCtrlLE")) {
- CardList oppLandInPlay = sourceCard.getController().getOpponent().getCardsIn(Zone.Battlefield);
+ CardList oppLandInPlay = sourceCard.getController().getOpponent().getCardsIn(ZoneType.Battlefield);
oppLandInPlay = oppLandInPlay.getType("Land");
final String maxnumber = specialConditions.split("/")[1];
if (!(oppLandInPlay.size() <= Integer.valueOf(maxnumber))) {
@@ -1165,18 +1165,18 @@ public final class GameActionUtil {
}
}
if (specialConditions.contains("OppCtrlMoreCreatures")) {
- CardList creaturesInPlayYou = sourceCard.getController().getCardsIn(Zone.Battlefield);
+ CardList creaturesInPlayYou = sourceCard.getController().getCardsIn(ZoneType.Battlefield);
creaturesInPlayYou = creaturesInPlayYou.getType("Creature");
- CardList creaturesInPlayOpp = sourceCard.getController().getOpponent().getCardsIn(Zone.Battlefield);
+ CardList creaturesInPlayOpp = sourceCard.getController().getOpponent().getCardsIn(ZoneType.Battlefield);
creaturesInPlayOpp = creaturesInPlayOpp.getType("Creature");
if (creaturesInPlayYou.size() > creaturesInPlayOpp.size()) {
return false;
}
}
if (specialConditions.contains("OppCtrlMoreLands")) {
- CardList landsInPlayYou = sourceCard.getController().getCardsIn(Zone.Battlefield);
+ CardList landsInPlayYou = sourceCard.getController().getCardsIn(ZoneType.Battlefield);
landsInPlayYou = landsInPlayYou.getType("Land");
- CardList landsInPlayOpp = sourceCard.getController().getOpponent().getCardsIn(Zone.Battlefield);
+ CardList landsInPlayOpp = sourceCard.getController().getOpponent().getCardsIn(ZoneType.Battlefield);
landsInPlayOpp = landsInPlayOpp.getType("Land");
if (landsInPlayYou.size() > landsInPlayOpp.size()) {
return false;
@@ -1184,7 +1184,7 @@ public final class GameActionUtil {
}
if (specialConditions.contains("EnchantedControllerCreaturesGE")) {
CardList enchantedControllerInPlay = sourceCard.getEnchantingCard().getController()
- .getCardsIn(Zone.Battlefield);
+ .getCardsIn(ZoneType.Battlefield);
enchantedControllerInPlay = enchantedControllerInPlay.getType("Creature");
final String maxnumber = specialConditions.split("/")[1];
if (!(enchantedControllerInPlay.size() >= Integer.valueOf(maxnumber))) {
@@ -1209,20 +1209,20 @@ public final class GameActionUtil {
}
}
if (specialConditions.contains("Hellbent")) {
- final CardList handcards = sourceCard.getController().getCardsIn(Zone.Hand);
+ final CardList handcards = sourceCard.getController().getCardsIn(ZoneType.Hand);
if (handcards.size() > 0) {
return false;
}
}
if (specialConditions.contains("Metalcraft")) {
- CardList cardsinPlay = sourceCard.getController().getCardsIn(Zone.Battlefield);
+ CardList cardsinPlay = sourceCard.getController().getCardsIn(ZoneType.Battlefield);
cardsinPlay = cardsinPlay.getType("Artifact");
if (cardsinPlay.size() < 3) {
return false;
}
}
if (specialConditions.contains("Morbid")) {
- final CardList res = CardUtil.getThisTurnEntered(Zone.Graveyard, Zone.Battlefield, "Creature", sourceCard);
+ final CardList res = CardUtil.getThisTurnEntered(ZoneType.Graveyard, ZoneType.Battlefield, "Creature", sourceCard);
if (res.size() < 1) {
return false;
}
@@ -1231,7 +1231,7 @@ public final class GameActionUtil {
if (specialConditions.contains("isPresent")) {
final String requirements = specialConditions.replaceAll("isPresent ", "");
- CardList cardsinPlay = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList cardsinPlay = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
final String[] conditions = requirements.split(",");
cardsinPlay = cardsinPlay.getValidCards(conditions, sourceCard.getController(), sourceCard);
if (cardsinPlay.isEmpty()) {
@@ -1241,7 +1241,7 @@ public final class GameActionUtil {
//is a card of a certain type/color present in yard
if (specialConditions.contains("isInGraveyard")) {
final String requirements = specialConditions.replaceAll("isInGraveyard ", "");
- CardList cardsinYards = AllZoneUtil.getCardsIn(Zone.Graveyard);
+ CardList cardsinYards = AllZoneUtil.getCardsIn(ZoneType.Graveyard);
final String[] conditions = requirements.split(",");
cardsinYards = cardsinYards.getValidCards(conditions, sourceCard.getController(), sourceCard);
if (cardsinYards.isEmpty()) {
@@ -1251,7 +1251,7 @@ public final class GameActionUtil {
//is no card of a certain type/color present?
if (specialConditions.contains("isNotPresent")) {
final String requirements = specialConditions.replaceAll("isNotPresent ", "");
- CardList cardsInPlay = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList cardsInPlay = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
final String[] conditions = requirements.split(",");
cardsInPlay = cardsInPlay.getValidCards(conditions, sourceCard.getController(), sourceCard);
if (!cardsInPlay.isEmpty()) {
@@ -1412,15 +1412,15 @@ public final class GameActionUtil {
}
// add +1/+1 to cards
list.clear();
- final int num = AllZoneUtil.getCardsIn(Zone.Battlefield, "Coat of Arms").size();
+ final int num = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Coat of Arms").size();
// for each zone found add +1/+1 to each card
for (int j = 0; j < num; j++) {
- final CardList creature = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final CardList creature = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
for (int i = 0; i < creature.size(); i++) {
final Card crd = creature.get(i);
- CardList type = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList type = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
type = type.filter(new CardListFilter() {
@Override
public boolean addCard(final Card card) {
@@ -1458,12 +1458,12 @@ public final class GameActionUtil {
@Override
public void execute() {
- final CardList alphaStatuses = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield)
+ final CardList alphaStatuses = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield)
.getName("Alpha Status");
- alphaStatuses.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield).getName("Alpha Status"));
+ alphaStatuses.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield).getName("Alpha Status"));
- final CardList allCreatures = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield).getType("Creature");
- allCreatures.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield).getType("Creature"));
+ final CardList allCreatures = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield).getType("Creature");
+ allCreatures.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield).getType("Creature"));
for (int i = 0; i < this.previouslyPumped.size(); i++) {
this.previouslyPumped.get(i).addSemiPermanentAttackBoost(0 - this.previouslyPumpedValue.get(i));
@@ -1498,10 +1498,10 @@ public final class GameActionUtil {
@Override
public void execute() {
// get all creatures
- final CardList cards = AllZoneUtil.getCardsIn(Zone.Battlefield, "Umbra Stalker");
+ final CardList cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Umbra Stalker");
for (final Card c : cards) {
final Player player = c.getController();
- final CardList grave = player.getCardsIn(Zone.Graveyard);
+ final CardList grave = player.getCardsIn(ZoneType.Graveyard);
final int pt = CardFactoryUtil.getNumberOfManaSymbolsByColor("B", grave);
c.setBaseAttack(pt);
c.setBaseDefense(pt);
@@ -1515,7 +1515,7 @@ public final class GameActionUtil {
@Override
public void execute() {
- CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
list = list.filter(new CardListFilter() {
@Override
@@ -1538,7 +1538,7 @@ public final class GameActionUtil {
@Override
public void execute() {
- final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield, "Old Man of the Sea");
+ final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Old Man of the Sea");
for (final Card oldman : list) {
if (!oldman.getGainControlTargets().isEmpty()) {
if (oldman.getNetAttack() < oldman.getGainControlTargets().get(0).getNetAttack()) {
@@ -1559,7 +1559,7 @@ public final class GameActionUtil {
@Override
public void execute() {
- final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield, "Liu Bei, Lord of Shu");
+ final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Liu Bei, Lord of Shu");
if (list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
@@ -1578,7 +1578,7 @@ public final class GameActionUtil {
} // execute()
private boolean getsBonus(final Card c) {
- CardList list = c.getController().getCardsIn(Zone.Battlefield);
+ CardList list = c.getController().getCardsIn(ZoneType.Battlefield);
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
@@ -1598,7 +1598,7 @@ public final class GameActionUtil {
@Override
public void execute() {
- CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
@@ -1616,7 +1616,7 @@ public final class GameActionUtil {
}
private int countSoundTheCalls() {
- CardList list = AllZoneUtil.getCardsIn(Zone.Graveyard);
+ CardList list = AllZoneUtil.getCardsIn(ZoneType.Graveyard);
list = list.getName("Sound the Call");
return list.size();
}
@@ -1630,7 +1630,7 @@ public final class GameActionUtil {
@Override
public void execute() {
// get all creatures
- final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield, "Tarmogoyf");
+ final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Tarmogoyf");
for (int i = 0; i < list.size(); i++) {
final Card c = list.get(i);
@@ -1641,7 +1641,7 @@ public final class GameActionUtil {
} // execute()
private int countDiffTypes() {
- final CardList list = AllZoneUtil.getCardsIn(Zone.Graveyard);
+ final CardList list = AllZoneUtil.getCardsIn(ZoneType.Graveyard);
int count = 0;
for (int q = 0; q < list.size(); q++) {
diff --git a/src/main/java/forge/NameChanger.java b/src/main/java/forge/NameChanger.java
index fb7df2318af..2863b01909a 100644
--- a/src/main/java/forge/NameChanger.java
+++ b/src/main/java/forge/NameChanger.java
@@ -24,7 +24,7 @@ import java.util.Map.Entry;
import java.util.StringTokenizer;
import java.util.TreeMap;
-import net.slightlymagic.braids.util.generator.GeneratorFunctions;
+import net.slightlymagic.braids.GeneratorFunctions;
import com.google.code.jyield.Generator;
import com.google.code.jyield.YieldUtils;
diff --git a/src/main/java/forge/StaticEffects.java b/src/main/java/forge/StaticEffects.java
index 702d552de66..651d2979112 100644
--- a/src/main/java/forge/StaticEffects.java
+++ b/src/main/java/forge/StaticEffects.java
@@ -23,12 +23,12 @@ import java.util.HashMap;
import com.esotericsoftware.minlog.Log;
-import forge.Constant.Zone;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.replacement.ReplacementEffect;
import forge.card.spellability.SpellAbility;
import forge.card.staticability.StaticAbility;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
/**
*
@@ -318,7 +318,7 @@ public class StaticEffects {
public final void rePopulateStateBasedList() {
this.reset();
- final CardList cards = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final CardList cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
Log.debug("== Start add state effects ==");
for (int i = 0; i < cards.size(); i++) {
diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactory.java b/src/main/java/forge/card/abilityfactory/AbilityFactory.java
index 238e57e8f41..4700a75c881 100644
--- a/src/main/java/forge/card/abilityfactory/AbilityFactory.java
+++ b/src/main/java/forge/card/abilityfactory/AbilityFactory.java
@@ -26,8 +26,6 @@ import forge.Card;
import forge.CardList;
import forge.CardUtil;
import forge.Command;
-import forge.Constant;
-import forge.Constant.Zone;
import forge.GameActionUtil;
import forge.Singletons;
import forge.card.cardfactory.CardFactoryUtil;
@@ -43,6 +41,7 @@ import forge.card.spellability.Target;
import forge.game.phase.PhaseType;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
/**
*
@@ -386,7 +385,7 @@ public class AbilityFactory {
// something
// not in play, this Key
// should be set
- this.abTgt.setZone(Zone.listValueOf(this.mapParams.get("TgtZone")));
+ this.abTgt.setZone(ZoneType.listValueOf(this.mapParams.get("TgtZone")));
}
// Target Type mostly for Counter: Spell,Activated,Triggered,Ability
@@ -571,7 +570,7 @@ public class AbilityFactory {
if (this.isTargeted) { // Since all "CopySpell" ABs copy things on
// the
// Stack no need for it to be everywhere
- this.abTgt.setZone(Zone.Stack);
+ this.abTgt.setZone(ZoneType.Stack);
}
if (this.isAb) {
@@ -591,7 +590,7 @@ public class AbilityFactory {
// Since all "Counter" ABs Counter things on the Stack no need for
// it to be everywhere
if (this.isTargeted) {
- this.abTgt.setZone(Zone.Stack);
+ this.abTgt.setZone(ZoneType.Stack);
}
if (this.isAb) {
@@ -1746,7 +1745,7 @@ public class AbilityFactory {
}
else if (defined.equals("TopOfLibrary")) {
- final CardList lib = hostCard.getController().getCardsIn(Constant.Zone.Library);
+ final CardList lib = hostCard.getController().getCardsIn(ZoneType.Library);
if (lib.size() > 0) {
c = lib.get(0);
} else {
@@ -1807,12 +1806,12 @@ public class AbilityFactory {
}
} else if (defined.startsWith("ThisTurnEntered")) {
final String[] workingCopy = defined.split("_");
- Zone destination, origin;
+ ZoneType destination, origin;
String validFilter;
- destination = Zone.smartValueOf(workingCopy[1]);
+ destination = ZoneType.smartValueOf(workingCopy[1]);
if (workingCopy[2].equals("from")) {
- origin = Zone.smartValueOf(workingCopy[3]);
+ origin = ZoneType.smartValueOf(workingCopy[3]);
validFilter = workingCopy[4];
} else {
origin = null;
@@ -2127,7 +2126,7 @@ public class AbilityFactory {
sas.add(spell);
}
} //is it exiled?
- if (!sas.get(0).getSourceCard().isInZone(Constant.Zone.Exile)) {
+ if (!sas.get(0).getSourceCard().isInZone(ZoneType.Exile)) {
sas.clear();
}
}
diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryAnimate.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryAnimate.java
index 4a4f416fbfe..48d79207052 100644
--- a/src/main/java/forge/card/abilityfactory/AbilityFactoryAnimate.java
+++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryAnimate.java
@@ -29,7 +29,6 @@ import forge.Card;
import forge.CardList;
import forge.CardUtil;
import forge.Command;
-import forge.Constant.Zone;
import forge.Singletons;
import forge.card.replacement.ReplacementEffect;
import forge.card.spellability.AbilityActivated;
@@ -43,6 +42,7 @@ import forge.card.trigger.TriggerHandler;
import forge.game.phase.PhaseType;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
/**
*
@@ -1210,9 +1210,9 @@ public final class AbilityFactoryAnimate {
}
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
- list = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
} else {
- list = tgtPlayers.get(0).getCardsIn(Zone.Battlefield);
+ list = tgtPlayers.get(0).getCardsIn(ZoneType.Battlefield);
}
list = list.getValidCards(valid.split(","), host.getController(), host);
diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java
index 2855ef63061..b597642b8f0 100644
--- a/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java
+++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java
@@ -30,7 +30,6 @@ import forge.CardList;
import forge.CardListFilter;
import forge.CardUtil;
import forge.Command;
-import forge.Constant.Zone;
import forge.GameActionUtil;
import forge.GameEntity;
import forge.Singletons;
@@ -47,6 +46,7 @@ import forge.game.phase.CombatUtil;
import forge.game.phase.PhaseType;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
import forge.gui.GuiUtils;
import forge.util.MyRandom;
@@ -324,7 +324,7 @@ public class AbilityFactoryAttach {
// I believe this is the only case where mandatory will be true, so just
// check that when starting that work
// But we shouldn't attach to things with Protection
- if (tgt.getZone().contains(Zone.Battlefield) && !mandatory) {
+ if (tgt.getZone().contains(ZoneType.Battlefield) && !mandatory) {
list = list.getTargetableCards(sa);
} else {
list = list.getUnprotectedCards(attachSource);
@@ -1486,7 +1486,7 @@ public class AbilityFactoryAttach {
// If Cast Targets will be checked on the Stack
for (final Object o : targets) {
String valid = params.get("UnattachValid");
- CardList unattachList = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList unattachList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
unattachList = unattachList.getValidCards(valid.split(","), source.getController(), source);
for (final Card c : unattachList) {
AbilityFactoryAttach.handleUnattachment(o, c, af);
diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java
index 98d72cbfc56..b1d798c838d 100644
--- a/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java
+++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java
@@ -30,8 +30,6 @@ import forge.CardList;
import forge.CardListFilter;
import forge.CardListUtil;
import forge.CardUtil;
-import forge.Constant;
-import forge.Constant.Zone;
import forge.GameActionUtil;
import forge.GameEntity;
import forge.Singletons;
@@ -49,7 +47,8 @@ import forge.game.phase.CombatUtil;
import forge.game.phase.PhaseType;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
-import forge.game.player.PlayerZone;
+import forge.game.zone.PlayerZone;
+import forge.game.zone.ZoneType;
import forge.gui.GuiUtils;
import forge.util.MyRandom;
@@ -198,7 +197,7 @@ public final class AbilityFactoryChangeZone {
* @return a boolean.
*/
public static boolean isHidden(final String origin, final boolean hiddenOverride) {
- return hiddenOverride || Zone.smartValueOf(origin).isHidden();
+ return hiddenOverride || ZoneType.smartValueOf(origin).isHidden();
}
@@ -212,7 +211,7 @@ public final class AbilityFactoryChangeZone {
* @return a boolean.
*/
public static boolean isKnown(final String origin) {
- return Zone.smartValueOf(origin).isKnown();
+ return ZoneType.smartValueOf(origin).isKnown();
}
/**
@@ -227,9 +226,9 @@ public final class AbilityFactoryChangeZone {
*/
private static void setMiscellaneous(final AbilityFactory af, final SpellAbility sa) {
final HashMap params = af.getMapParams();
- List origin = new ArrayList();
+ List origin = new ArrayList();
if (params.containsKey("Origin")) {
- origin = Constant.Zone.listValueOf(params.get("Origin"));
+ origin = ZoneType.listValueOf(params.get("Origin"));
}
final Target tgt = sa.getTarget();
@@ -240,7 +239,7 @@ public final class AbilityFactoryChangeZone {
}
if (!(sa instanceof AbilitySub)) {
- if (origin.contains(Zone.Battlefield) || params.get("Destination").equals("Battlefield")) {
+ if (origin.contains(ZoneType.Battlefield) || params.get("Destination").equals("Battlefield")) {
af.getHostCard().setSVar("PlayMain1", "TRUE");
}
}
@@ -430,9 +429,9 @@ public final class AbilityFactoryChangeZone {
final Cost abCost = af.getAbCost();
final Card source = af.getHostCard();
final HashMap params = af.getMapParams();
- Constant.Zone origin = null;
+ ZoneType origin = null;
if (params.containsKey("Origin")) {
- origin = Constant.Zone.smartValueOf(params.get("Origin"));
+ origin = ZoneType.smartValueOf(params.get("Origin"));
}
final String destination = params.get("Destination");
@@ -562,9 +561,9 @@ public final class AbilityFactoryChangeZone {
final HashMap params = af.getMapParams();
- List origin = new ArrayList();
+ List origin = new ArrayList();
if (params.containsKey("Origin")) {
- origin = Zone.listValueOf(params.get("Origin"));
+ origin = ZoneType.listValueOf(params.get("Origin"));
}
// this works for hidden because the mana is paid first.
@@ -816,18 +815,18 @@ public final class AbilityFactoryChangeZone {
}
}
- List origin = new ArrayList();
+ List origin = new ArrayList();
if (params.containsKey("Origin")) {
- origin = Zone.listValueOf(params.get("Origin"));
+ origin = ZoneType.listValueOf(params.get("Origin"));
}
- Zone destination = Zone.smartValueOf(params.get("Destination"));
+ ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
// this needs to be zero indexed. Top = 0, Third = 2
int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0;
if (params.containsKey("OriginChoice")) {
// Currently only used for Mishra, but may be used by other things
// Improve how this message reacts for other cards
- final List alt = Zone.listValueOf(params.get("OriginAlternative"));
+ final List alt = ZoneType.listValueOf(params.get("OriginAlternative"));
CardList altFetchList = player.getCardsIn(alt);
altFetchList = AbilityFactory.filterListByType(altFetchList, params.get("ChangeType"), sa);
@@ -846,7 +845,7 @@ public final class AbilityFactoryChangeZone {
sb.append(params.get("AlternativeDestinationMessage"));
if (!GameActionUtil.showYesNoDialog(card, sb.toString())) {
- destination = Zone.smartValueOf(params.get("DestinationAlternative"));
+ destination = ZoneType.smartValueOf(params.get("DestinationAlternative"));
libraryPos = params.containsKey("LibraryPositionAlternative") ? Integer.parseInt(params
.get("LibraryPositionAlternative")) : 0;
}
@@ -861,26 +860,26 @@ public final class AbilityFactoryChangeZone {
if (!params.containsKey("ChangeNum")) {
changeNum = fetchList.size();
}
- } else if (!origin.contains(Zone.Library) && !origin.contains(Zone.Hand)) {
+ } else if (!origin.contains(ZoneType.Library) && !origin.contains(ZoneType.Hand)) {
fetchList = AllZoneUtil.getCardsIn(origin);
} else {
fetchList = player.getCardsIn(origin);
}
if (!defined) {
- if (origin.contains(Zone.Library) && !defined) { // Look at whole
+ if (origin.contains(ZoneType.Library) && !defined) { // Look at whole
// library before
// moving onto
// choosing
// a card{
GuiUtils.chooseOneOrNone(af.getHostCard().getName() + " - Looking at Library",
- player.getCardsIn(Zone.Library).toArray());
+ player.getCardsIn(ZoneType.Library).toArray());
}
// Look at opponents hand before moving onto choosing a card
- if (origin.contains(Zone.Hand) && player.isComputer()) {
+ if (origin.contains(ZoneType.Hand) && player.isComputer()) {
GuiUtils.chooseOneOrNone(af.getHostCard().getName() + " - Looking at Opponent's Hand", player
- .getCardsIn(Zone.Hand).toArray());
+ .getCardsIn(ZoneType.Hand).toArray());
}
fetchList = AbilityFactory.filterListByType(fetchList, params.get("ChangeType"), sa);
}
@@ -915,17 +914,17 @@ public final class AbilityFactoryChangeZone {
fetchList.remove(c);
Card movedCard = null;
- if (destination.equals(Zone.Library)) {
+ if (destination.equals(ZoneType.Library)) {
// do not shuffle the library once we have placed a fetched
// card on top.
if (params.containsKey("Reveal")) {
GuiUtils.chooseOne(card + " - Revealed card: ", c);
}
- if (origin.contains(Zone.Library) && (i < 1)) {
+ if (origin.contains(ZoneType.Library) && (i < 1)) {
player.shuffle();
}
movedCard = Singletons.getModel().getGameAction().moveToLibrary(c, libraryPos);
- } else if (destination.equals(Zone.Battlefield)) {
+ } else if (destination.equals(ZoneType.Battlefield)) {
if (params.containsKey("Tapped")) {
c.setTapped(true);
}
@@ -956,7 +955,7 @@ public final class AbilityFactoryChangeZone {
}
movedCard = Singletons.getModel().getGameAction().moveTo(c.getController().getZone(destination), c);
- } else if (destination.equals(Zone.Exile)) {
+ } else if (destination.equals(ZoneType.Exile)) {
movedCard = Singletons.getModel().getGameAction().exile(c);
if (params.containsKey("ExileFaceDown")) {
movedCard.setState(CardCharactersticName.FaceDown);
@@ -984,7 +983,7 @@ public final class AbilityFactoryChangeZone {
}
}
- if ((origin.contains(Zone.Library) && !destination.equals(Zone.Library) && !defined)
+ if ((origin.contains(ZoneType.Library) && !destination.equals(ZoneType.Library) && !defined)
|| params.containsKey("Shuffle")) {
player.shuffle();
}
@@ -1017,9 +1016,9 @@ public final class AbilityFactoryChangeZone {
}
}
- List origin = new ArrayList();
+ List origin = new ArrayList();
if (params.containsKey("Origin")) {
- origin = Zone.listValueOf(params.get("Origin"));
+ origin = ZoneType.listValueOf(params.get("Origin"));
}
String type = params.get("ChangeType");
@@ -1036,7 +1035,7 @@ public final class AbilityFactoryChangeZone {
if (!params.containsKey("ChangeNum")) {
changeNum = fetchList.size();
}
- } else if (!origin.contains(Zone.Library) && !origin.contains(Zone.Hand)) {
+ } else if (!origin.contains(ZoneType.Library) && !origin.contains(ZoneType.Hand)) {
fetchList = AllZoneUtil.getCardsIn(origin);
fetchList = AbilityFactory.filterListByType(fetchList, type, sa);
} else {
@@ -1044,7 +1043,7 @@ public final class AbilityFactoryChangeZone {
fetchList = AbilityFactory.filterListByType(fetchList, type, sa);
}
- final Zone destination = Zone.smartValueOf(params.get("Destination"));
+ final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
final PlayerZone destZone = player.getZone(destination);
@@ -1077,9 +1076,9 @@ public final class AbilityFactoryChangeZone {
// creatures
// take the
// best
- } else if (Zone.Battlefield.equals(destination) || Zone.Graveyard.equals(destination)) {
+ } else if (ZoneType.Battlefield.equals(destination) || ZoneType.Graveyard.equals(destination)) {
c = CardFactoryUtil.getMostExpensivePermanentAI(fetchList, sa, false);
- } else if (Zone.Exile.equals(destination)) {
+ } else if (ZoneType.Exile.equals(destination)) {
// Exiling your own stuff, if Exiling opponents stuff choose
// best
if (destZone.getPlayer().isHuman()) {
@@ -1089,7 +1088,7 @@ public final class AbilityFactoryChangeZone {
}
} else {
// Don't fetch another tutor with the same name
- if (origin.contains(Zone.Library) && !fetchList.getNotName(card.getName()).isEmpty()) {
+ if (origin.contains(ZoneType.Library) && !fetchList.getNotName(card.getName()).isEmpty()) {
fetchList = fetchList.getNotName(card.getName());
}
@@ -1101,17 +1100,17 @@ public final class AbilityFactoryChangeZone {
fetchList.remove(c);
}
- if (origin.contains(Zone.Library) && !defined) {
+ if (origin.contains(ZoneType.Library) && !defined) {
player.shuffle();
}
for (final Card c : fetched) {
Card newCard = null;
- if (Zone.Library.equals(destination)) {
+ if (ZoneType.Library.equals(destination)) {
final int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params
.get("LibraryPosition")) : 0;
Singletons.getModel().getGameAction().moveToLibrary(c, libraryPos);
- } else if (Zone.Battlefield.equals(destination)) {
+ } else if (ZoneType.Battlefield.equals(destination)) {
if (params.containsKey("Tapped")) {
c.tap();
}
@@ -1148,7 +1147,7 @@ public final class AbilityFactoryChangeZone {
}
newCard = Singletons.getModel().getGameAction().moveTo(c.getController().getZone(destination), c);
- } else if (destination.equals(Zone.Exile)) {
+ } else if (destination.equals(ZoneType.Exile)) {
newCard = Singletons.getModel().getGameAction().exile(c);
if (params.containsKey("ExileFaceDown")) {
newCard.setState(CardCharactersticName.FaceDown);
@@ -1166,7 +1165,7 @@ public final class AbilityFactoryChangeZone {
}
}
- if (!Zone.Battlefield.equals(destination) && !"Card".equals(type) && !defined) {
+ if (!ZoneType.Battlefield.equals(destination) && !"Card".equals(type) && !defined) {
final String picked = af.getHostCard().getName() + " - Computer picked:";
if (fetched.size() > 0) {
GuiUtils.chooseOne(picked, fetched.toArray());
@@ -1207,8 +1206,8 @@ public final class AbilityFactoryChangeZone {
// basic
// land
// types
- final CardList combined = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
- combined.addAll(AllZone.getComputerPlayer().getCardsIn(Zone.Hand));
+ final CardList combined = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
+ combined.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand));
final String[] names = type.split(",");
final ArrayList basics = new ArrayList();
@@ -1294,10 +1293,10 @@ public final class AbilityFactoryChangeZone {
final Card source = af.getHostCard();
final HashMap params = af.getMapParams();
- final Zone origin = Zone.smartValueOf(params.get("Origin"));
- final Zone destination = Zone.smartValueOf(params.get("Destination"));
+ final ZoneType origin = ZoneType.smartValueOf(params.get("Origin"));
+ final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
- float pct = origin.equals(Zone.Battlefield) ? .8f : .667f;
+ float pct = origin.equals(ZoneType.Battlefield) ? .8f : .667f;
final Random r = MyRandom.getRandom();
@@ -1345,7 +1344,7 @@ public final class AbilityFactoryChangeZone {
// return this card from battlefield: cards like Blinking Spirit
// in general this should only be used to protect from Imminent Harm
// (dying or losing control of)
- if (origin.equals(Zone.Battlefield)) {
+ if (origin.equals(ZoneType.Battlefield)) {
if (AllZone.getStack().size() == 0) {
return false;
}
@@ -1357,8 +1356,8 @@ public final class AbilityFactoryChangeZone {
}
// only use blink or bounce effects
- if (!(destination.equals(Zone.Exile) && (subAPI.equals("DelayedTrigger") || subAPI.equals("ChangeZone")))
- && !destination.equals(Zone.Hand)) {
+ if (!(destination.equals(ZoneType.Exile) && (subAPI.equals("DelayedTrigger") || subAPI.equals("ChangeZone")))
+ && !destination.equals(ZoneType.Hand)) {
return false;
}
@@ -1419,8 +1418,8 @@ public final class AbilityFactoryChangeZone {
final boolean mandatory) {
final HashMap params = af.getMapParams();
final Card source = sa.getSourceCard();
- final Zone origin = Zone.smartValueOf(params.get("Origin"));
- final Zone destination = Zone.smartValueOf(params.get("Destination"));
+ final ZoneType origin = ZoneType.smartValueOf(params.get("Origin"));
+ final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
final Target tgt = sa.getTarget();
final AbilitySub abSub = sa.getSubAbility();
@@ -1447,13 +1446,13 @@ public final class AbilityFactoryChangeZone {
}
// Narrow down the list:
- if (origin.equals(Zone.Battlefield)) {
+ if (origin.equals(ZoneType.Battlefield)) {
// filter out untargetables
list = list.getTargetableCards(sa);
CardList aiPermanents = list.getController(AllZone.getComputerPlayer());
// if it's blink or bounce, try to save my about to die stuff
- if ((destination.equals(Zone.Hand) || (destination.equals(Zone.Exile) && (subAPI.equals("DelayedTrigger") || (subAPI
+ if ((destination.equals(ZoneType.Hand) || (destination.equals(ZoneType.Exile) && (subAPI.equals("DelayedTrigger") || (subAPI
.equals("ChangeZone") && subAffected.equals("Remembered")))))
&& (tgt.getMinTargets(sa.getSourceCard(), sa) <= 1)) {
@@ -1517,8 +1516,8 @@ public final class AbilityFactoryChangeZone {
}
}
- } else if (origin.equals(Zone.Graveyard)) {
- if (destination.equals(Zone.Hand)) {
+ } else if (origin.equals(ZoneType.Graveyard)) {
+ if (destination.equals(ZoneType.Hand)) {
// only retrieve cards from computer graveyard
list = list.getController(AllZone.getComputerPlayer());
}
@@ -1526,8 +1525,8 @@ public final class AbilityFactoryChangeZone {
}
// blink human targets only during combat
- if (origin.equals(Zone.Battlefield)
- && destination.equals(Zone.Exile)
+ if (origin.equals(ZoneType.Battlefield)
+ && destination.equals(ZoneType.Exile)
&& (subAPI.equals("DelayedTrigger") || (subAPI.equals("ChangeZone") && subAffected.equals("Remembered")))
&& !(Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || sa
.isAbility())) {
@@ -1535,7 +1534,7 @@ public final class AbilityFactoryChangeZone {
}
// Exile and bounce opponents stuff
- if (destination.equals(Zone.Exile) || origin.equals(Zone.Battlefield)) {
+ if (destination.equals(ZoneType.Exile) || origin.equals(ZoneType.Battlefield)) {
// don't rush bouncing stuff when not going to attack
if (!sa.isTrigger() && sa.getPayCosts() != null
@@ -1578,10 +1577,10 @@ public final class AbilityFactoryChangeZone {
if (!list.isEmpty()) {
final Card mostExpensive = CardFactoryUtil.getMostExpensivePermanentAI(list, sa, false);
- if (destination.equals(Zone.Battlefield) || origin.equals(Zone.Battlefield)) {
+ if (destination.equals(ZoneType.Battlefield) || origin.equals(ZoneType.Battlefield)) {
if (mostExpensive.isCreature()) {
// if a creature is most expensive take the best one
- if (destination.equals(Zone.Exile)) {
+ if (destination.equals(ZoneType.Exile)) {
// If Exiling things, don't give bonus to Tokens
choice = CardFactoryUtil.getBestCreatureAI(list);
} else {
@@ -1637,15 +1636,15 @@ public final class AbilityFactoryChangeZone {
final HashMap params = af.getMapParams();
final Card source = sa.getSourceCard();
- final Zone origin = Zone.smartValueOf(params.get("Origin"));
- final Zone destination = Zone.smartValueOf(params.get("Destination"));
+ final ZoneType origin = ZoneType.smartValueOf(params.get("Origin"));
+ final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
final Target tgt = sa.getTarget();
CardList list = AllZoneUtil.getCardsIn(origin);
list = list.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), source);
// Narrow down the list:
- if (origin.equals(Zone.Battlefield)) {
+ if (origin.equals(ZoneType.Battlefield)) {
// filter out untargetables
list = list.getTargetableCards(sa);
@@ -1653,7 +1652,7 @@ public final class AbilityFactoryChangeZone {
// or save my about to die stuff
// if Destination is exile, filter out my cards
- } else if (origin.equals(Zone.Graveyard)) {
+ } else if (origin.equals(ZoneType.Graveyard)) {
// Retrieve from Graveyard to:
}
@@ -1673,10 +1672,10 @@ public final class AbilityFactoryChangeZone {
if (!list.isEmpty()) {
if (CardFactoryUtil.getMostExpensivePermanentAI(list, sa, false).isCreature()
- && (destination.equals(Zone.Battlefield) || origin.equals(Zone.Battlefield))) {
+ && (destination.equals(ZoneType.Battlefield) || origin.equals(ZoneType.Battlefield))) {
// if a creature is most expensive take the best
choice = CardFactoryUtil.getBestCreatureToBounceAI(list);
- } else if (destination.equals(Zone.Battlefield) || origin.equals(Zone.Battlefield)) {
+ } else if (destination.equals(ZoneType.Battlefield) || origin.equals(ZoneType.Battlefield)) {
choice = CardFactoryUtil.getMostExpensivePermanentAI(list, sa, false);
} else {
// TODO AI needs more improvement to it's retrieval (reuse
@@ -1772,8 +1771,8 @@ public final class AbilityFactoryChangeZone {
sb.append(" ");
- final Zone destination = Zone.smartValueOf(params.get("Destination"));
- final Zone origin = Zone.smartValueOf(params.get("Origin"));
+ final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
+ final ZoneType origin = ZoneType.smartValueOf(params.get("Origin"));
final StringBuilder sbTargets = new StringBuilder();
@@ -1798,9 +1797,9 @@ public final class AbilityFactoryChangeZone {
final String fromGraveyard = " from the graveyard";
- if (destination.equals(Zone.Battlefield)) {
+ if (destination.equals(ZoneType.Battlefield)) {
sb.append("Put").append(targetname);
- if (origin.equals(Zone.Graveyard)) {
+ if (origin.equals(ZoneType.Graveyard)) {
sb.append(fromGraveyard);
}
@@ -1814,15 +1813,15 @@ public final class AbilityFactoryChangeZone {
sb.append(".");
}
- if (destination.equals(Zone.Hand)) {
+ if (destination.equals(ZoneType.Hand)) {
sb.append("Return").append(targetname);
- if (origin.equals(Zone.Graveyard)) {
+ if (origin.equals(ZoneType.Graveyard)) {
sb.append(fromGraveyard);
}
sb.append(" to").append(pronoun).append("owners hand.");
}
- if (destination.equals(Zone.Library)) {
+ if (destination.equals(ZoneType.Library)) {
if (params.containsKey("Shuffle")) { // for things like Gaea's
// Blessing
sb.append("Shuffle").append(targetname);
@@ -1830,7 +1829,7 @@ public final class AbilityFactoryChangeZone {
sb.append(" into").append(pronoun).append("owner's library.");
} else {
sb.append("Put").append(targetname);
- if (origin.equals(Zone.Graveyard)) {
+ if (origin.equals(ZoneType.Graveyard)) {
sb.append(fromGraveyard);
}
@@ -1850,20 +1849,20 @@ public final class AbilityFactoryChangeZone {
}
}
- if (destination.equals(Zone.Exile)) {
+ if (destination.equals(ZoneType.Exile)) {
sb.append("Exile").append(targetname);
- if (origin.equals(Zone.Graveyard)) {
+ if (origin.equals(ZoneType.Graveyard)) {
sb.append(fromGraveyard);
}
sb.append(".");
}
- if (destination.equals(Zone.Ante)) {
+ if (destination.equals(ZoneType.Ante)) {
sb.append("Ante").append(targetname);
sb.append(".");
}
- if (destination.equals(Zone.Graveyard)) {
+ if (destination.equals(ZoneType.Graveyard)) {
sb.append("Put").append(targetname);
sb.append(" from ").append(origin);
sb.append(" into").append(pronoun).append("owner's graveyard.");
@@ -1894,8 +1893,8 @@ public final class AbilityFactoryChangeZone {
final Player player = sa.getActivatingPlayer();
final Card hostCard = sa.getSourceCard();
- final Zone destination = Zone.valueOf(params.get("Destination"));
- final Zone origin = Zone.valueOf(params.get("Origin"));
+ final ZoneType destination = ZoneType.valueOf(params.get("Destination"));
+ final ZoneType origin = ZoneType.valueOf(params.get("Origin"));
if (tgt != null) {
tgtCards = tgt.getTargetCards();
@@ -1921,7 +1920,7 @@ public final class AbilityFactoryChangeZone {
continue;
}
- if ((tgt != null) && origin.equals(Zone.Battlefield)) {
+ if ((tgt != null) && origin.equals(ZoneType.Battlefield)) {
// check targeting
if (!tgtC.canBeTargetedBy(sa)) {
continue;
@@ -1930,11 +1929,11 @@ public final class AbilityFactoryChangeZone {
Card movedCard = null;
Player pl = player;
- if (!destination.equals(Zone.Battlefield)) {
+ if (!destination.equals(ZoneType.Battlefield)) {
pl = tgtC.getOwner();
}
- if (destination.equals(Zone.Library)) {
+ if (destination.equals(ZoneType.Library)) {
// library position is zero indexed
final int libraryPosition = params.containsKey("LibraryPosition") ? Integer.parseInt(params
.get("LibraryPosition")) : 0;
@@ -1946,7 +1945,7 @@ public final class AbilityFactoryChangeZone {
tgtC.getOwner().shuffle();
}
} else {
- if (destination.equals(Zone.Battlefield)) {
+ if (destination.equals(ZoneType.Battlefield)) {
if (params.containsKey("Tapped") || params.containsKey("Ninjutsu")) {
tgtC.setTapped(true);
}
@@ -1993,7 +1992,7 @@ public final class AbilityFactoryChangeZone {
if (params.containsKey("Fizzle")) {
ArrayList spells = tgtC.getSpellAbilities();
for (SpellAbility spell : spells) {
- if (tgtC.isInZone(Zone.Exile)) {
+ if (tgtC.isInZone(ZoneType.Exile)) {
final SpellAbilityStackInstance si = AllZone.getStack().getInstanceFromSpellAbility(spell);
AllZone.getStack().remove(si);
}
@@ -2029,7 +2028,7 @@ public final class AbilityFactoryChangeZone {
* a {@link java.lang.String} object.
* @return a {@link forge.CardList} object.
*/
- private static CardList knownDetermineDefined(final SpellAbility sa, final String defined, final Zone origin) {
+ private static CardList knownDetermineDefined(final SpellAbility sa, final String defined, final ZoneType origin) {
final CardList ret = new CardList();
final ArrayList list = AbilityFactory.getDefinedCards(sa.getSourceCard(), defined, sa);
@@ -2176,7 +2175,7 @@ public final class AbilityFactoryChangeZone {
final Card source = sa.getSourceCard();
final HashMap params = af.getMapParams();
final String destination = params.get("Destination");
- final Constant.Zone origin = Constant.Zone.smartValueOf(params.get("Origin"));
+ final ZoneType origin = ZoneType.smartValueOf(params.get("Origin"));
if (abCost != null) {
// AI currently disabled for these costs
@@ -2208,17 +2207,17 @@ public final class AbilityFactoryChangeZone {
// TODO improve restrictions on when the AI would want to use this
// spBounceAll has some AI we can compare to.
- if (origin.equals(Zone.Hand) || origin.equals(Zone.Library)) {
+ if (origin.equals(ZoneType.Hand) || origin.equals(ZoneType.Library)) {
final Target tgt = sa.getTarget();
if (tgt != null) {
- if (AllZone.getHumanPlayer().getCardsIn(Zone.Hand).isEmpty()
+ if (AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand).isEmpty()
|| !AllZone.getHumanPlayer().canBeTargetedBy(sa)) {
return false;
}
tgt.resetTargets();
tgt.addTarget(AllZone.getHumanPlayer());
}
- } else if (origin.equals(Zone.Battlefield)) {
+ } else if (origin.equals(ZoneType.Battlefield)) {
// this statement is assuming the AI is trying to use this spell
// offensively
// if the AI is using it defensively, then something else needs to
@@ -2241,19 +2240,19 @@ public final class AbilityFactoryChangeZone {
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.MAIN1, AllZone.getComputerPlayer())) {
return false;
}
- } else if (origin.equals(Zone.Graveyard)) {
+ } else if (origin.equals(ZoneType.Graveyard)) {
final Target tgt = sa.getTarget();
if (tgt != null) {
- if (AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard).isEmpty()
+ if (AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard).isEmpty()
|| !AllZone.getHumanPlayer().canBeTargetedBy(sa)) {
return false;
}
tgt.resetTargets();
tgt.addTarget(AllZone.getHumanPlayer());
}
- } else if (origin.equals(Zone.Exile)) {
+ } else if (origin.equals(ZoneType.Exile)) {
- } else if (origin.equals(Zone.Stack)) {
+ } else if (origin.equals(ZoneType.Stack)) {
// time stop can do something like this:
// Origin$ Stack | Destination$ Exile | SubAbility$ DBSkip
// DBSKipToPhase | DB$SkipToPhase | Phase$ Cleanup
@@ -2261,7 +2260,7 @@ public final class AbilityFactoryChangeZone {
return false;
}
- if (destination.equals(Constant.Zone.Battlefield)) {
+ if (destination.equals(ZoneType.Battlefield)) {
if (params.get("GainControl") != null) {
// Check if the cards are valuable enough
if ((humanType.getNotType("Creature").size() == 0) && (computerType.getNotType("Creature").size() == 0)) {
@@ -2368,8 +2367,8 @@ public final class AbilityFactoryChangeZone {
*/
private static void changeZoneAllResolve(final AbilityFactory af, final SpellAbility sa) {
final HashMap params = af.getMapParams();
- final Zone destination = Zone.smartValueOf(params.get("Destination"));
- final List origin = Zone.listValueOf(params.get("Origin"));
+ final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
+ final List origin = ZoneType.listValueOf(params.get("Origin"));
CardList cards = null;
@@ -2401,7 +2400,7 @@ public final class AbilityFactoryChangeZone {
final int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition"))
: 0;
for (final Card c : cards) {
- if (destination.equals(Zone.Battlefield)) {
+ if (destination.equals(ZoneType.Battlefield)) {
// Auras without Candidates stay in their current location
if (c.isAura()) {
final SpellAbility saAura = AbilityFactoryAttach.getAttachSpellAbility(c);
diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java
index a1179cb3f51..3dce2e9dfaf 100644
--- a/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java
+++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java
@@ -36,7 +36,6 @@ import forge.CardList;
import forge.CardListFilter;
import forge.CardUtil;
import forge.Constant;
-import forge.Constant.Zone;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.spellability.AbilityActivated;
import forge.card.spellability.AbilitySub;
@@ -45,6 +44,7 @@ import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
import forge.gui.GuiUtils;
import forge.gui.ListChooser;
import forge.item.CardDb;
@@ -350,15 +350,15 @@ public final class AbilityFactoryChoose {
final String logic = params.get("AILogic");
if (logic.equals("MostProminentOnBattlefield")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZoneUtil
- .getCardsIn(Zone.Battlefield));
+ .getCardsIn(ZoneType.Battlefield));
}
if (logic.equals("MostProminentComputerControls")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZone.getComputerPlayer()
- .getCardsIn(Zone.Battlefield));
+ .getCardsIn(ZoneType.Battlefield));
}
if (logic.equals("MostProminentHumanControls")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZone.getHumanPlayer()
- .getCardsIn(Zone.Battlefield));
+ .getCardsIn(ZoneType.Battlefield));
}
if (logic.equals("MostProminentInComputerDeck")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZoneUtil.getCardsInGame()
@@ -366,7 +366,7 @@ public final class AbilityFactoryChoose {
}
if (logic.equals("MostProminentInComputerGraveyard")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZone.getComputerPlayer()
- .getCardsIn(Zone.Graveyard));
+ .getCardsIn(ZoneType.Graveyard));
}
}
if (!CardUtil.isACreatureType(chosen) || invalidTypes.contains(chosen)) {
@@ -687,10 +687,10 @@ public final class AbilityFactoryChoose {
}
else if (logic.equals("MostProminentComputerControls")) {
chosen = CardFactoryUtil.getMostProminentColor(AllZone.getComputerPlayer().getCardsIn(
- Zone.Battlefield));
+ ZoneType.Battlefield));
}
else if (logic.equals("MostProminentPermanent")) {
- final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
chosen = CardFactoryUtil.getMostProminentColor(list);
}
else if (logic.equals("MostProminentAttackers")) {
@@ -1500,10 +1500,10 @@ public final class AbilityFactoryChoose {
final String logic = params.get("AILogic");
if (logic.equals("MostProminentInComputerDeck")) {
chosen = CardFactoryUtil.getMostProminentCardName(AllZone.getComputerPlayer()
- .getCardsIn(Constant.Zone.Library));
+ .getCardsIn(ZoneType.Library));
} else if (logic.equals("MostProminentInHumanDeck")) {
chosen = CardFactoryUtil.getMostProminentCardName(AllZone.getHumanPlayer()
- .getCardsIn(Constant.Zone.Library));
+ .getCardsIn(ZoneType.Library));
}
} else {
CardList list = AllZoneUtil.getCardsInGame().getController(AllZone.getHumanPlayer());
@@ -1738,7 +1738,7 @@ public final class AbilityFactoryChoose {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
- CardList choices = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList choices = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
if (params.containsKey("Choices")) {
choices = choices.getValidCards(params.get("Choices"), host.getController(), host);
}
diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java
index 4fc5b58fdb6..c054bb08595 100644
--- a/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java
+++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java
@@ -26,7 +26,6 @@ import javax.swing.JOptionPane;
import forge.AllZone;
import forge.Card;
import forge.CardList;
-import forge.Constant;
import forge.GameActionUtil;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.spellability.AbilityActivated;
@@ -36,6 +35,7 @@ import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target;
import forge.card.trigger.TriggerType;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
import forge.gui.GuiUtils;
/**
@@ -598,10 +598,10 @@ public final class AbilityFactoryClash {
private static boolean twoPilesCanPlayAI(final AbilityFactory af, final SpellAbility sa) {
final HashMap params = af.getMapParams();
final Card card = af.getHostCard();
- Constant.Zone zone = null;
+ ZoneType zone = null;
if (params.containsKey("Zone")) {
- zone = Constant.Zone.smartValueOf(params.get("Zone"));
+ zone = ZoneType.smartValueOf(params.get("Zone"));
}
String valid = "";
@@ -641,11 +641,11 @@ public final class AbilityFactoryClash {
private static void twoPilesResolve(final AbilityFactory af, final SpellAbility sa) {
final HashMap params = af.getMapParams();
final Card card = af.getHostCard();
- Constant.Zone zone = null;
+ ZoneType zone = null;
boolean pile1WasChosen = true;
if (params.containsKey("Zone")) {
- zone = Constant.Zone.smartValueOf(params.get("Zone"));
+ zone = ZoneType.smartValueOf(params.get("Zone"));
}
String valid = "";
diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryCombat.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryCombat.java
index 373e7652572..35f074161ea 100644
--- a/src/main/java/forge/card/abilityfactory/AbilityFactoryCombat.java
+++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryCombat.java
@@ -24,7 +24,6 @@ import forge.AllZone;
import forge.Card;
import forge.CardList;
import forge.CardListFilter;
-import forge.Constant.Zone;
import forge.Singletons;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.spellability.AbilityActivated;
@@ -36,6 +35,7 @@ import forge.game.phase.CombatUtil;
import forge.game.phase.PhaseType;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
/**
*
@@ -952,7 +952,7 @@ public final class AbilityFactoryCombat {
boolean chance = false;
if (abTgt != null) {
- CardList list = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield).getType("Creature");
+ CardList list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield).getType("Creature");
list = list.getTargetableCards(sa);
list = list.getValidCards(abTgt.getValidTgts(), source.getController(), source);
list = list.filter(new CardListFilter() {
diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryCopy.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryCopy.java
index cce978edfdc..59a14cb297b 100644
--- a/src/main/java/forge/card/abilityfactory/AbilityFactoryCopy.java
+++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryCopy.java
@@ -30,7 +30,6 @@ import forge.CardCharactersticName;
import forge.CardList;
import forge.CardListFilter;
import forge.Command;
-import forge.Constant.Zone;
import forge.Singletons;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.spellability.Ability;
@@ -43,6 +42,7 @@ import forge.card.trigger.TriggerType;
import forge.game.phase.PhaseType;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
import forge.gui.GuiUtils;
import forge.util.MyRandom;
@@ -280,7 +280,7 @@ public final class AbilityFactoryCopy {
final Target abTgt = sa.getTarget();
if (abTgt != null) {
- CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
list = list.getValidCards(abTgt.getValidTgts(), source.getController(), source);
abTgt.resetTargets();
// target loop
diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryCounters.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryCounters.java
index 4b43378a51b..ae8e7ea3519 100644
--- a/src/main/java/forge/card/abilityfactory/AbilityFactoryCounters.java
+++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryCounters.java
@@ -28,8 +28,6 @@ import forge.AllZoneUtil;
import forge.Card;
import forge.CardList;
import forge.CardListFilter;
-import forge.Constant;
-import forge.Constant.Zone;
import forge.Counters;
import forge.Singletons;
import forge.card.cardfactory.CardFactoryUtil;
@@ -45,7 +43,8 @@ import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
-import forge.game.player.PlayerZone;
+import forge.game.zone.PlayerZone;
+import forge.game.zone.ZoneType;
import forge.gui.GuiUtils;
import forge.util.MyRandom;
import forge.view.ButtonUtil;
@@ -280,7 +279,7 @@ public class AbilityFactoryCounters {
final Player player = af.isCurse() ? AllZone.getHumanPlayer() : AllZone.getComputerPlayer();
- list = player.getCardsIn(Zone.Battlefield);
+ list = player.getCardsIn(ZoneType.Battlefield);
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
@@ -432,7 +431,7 @@ public class AbilityFactoryCounters {
final Player player = af.isCurse() ? AllZone.getHumanPlayer() : AllZone.getComputerPlayer();
- list = player.getCardsIn(Zone.Battlefield);
+ list = player.getCardsIn(ZoneType.Battlefield);
list = list.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
@@ -545,7 +544,7 @@ public class AbilityFactoryCounters {
// things like Powder Keg, which are way too complex for the AI
}
} else {
- list = player.getCardsIn(Zone.Battlefield);
+ list = player.getCardsIn(ZoneType.Battlefield);
list = list.getTargetableCards(sa);
if (abTgt != null) {
list = list.getValidCards(abTgt.getValidTgts(), source.getController(), source);
@@ -553,7 +552,7 @@ public class AbilityFactoryCounters {
if (list.isEmpty() && mandatory) {
// If there isn't any prefered cards to target, gotta choose
// non-preferred ones
- list = player.getOpponent().getCardsIn(Zone.Battlefield);
+ list = player.getOpponent().getCardsIn(ZoneType.Battlefield);
list = list.getTargetableCards(sa);
if (abTgt != null) {
list = list.getValidCards(abTgt.getValidTgts(), source.getController(), source);
@@ -724,7 +723,7 @@ public class AbilityFactoryCounters {
final PlayerZone zone = AllZone.getZoneOf(tgtCard);
if (zone == null) {
// Do nothing, token disappeared
- } else if (zone.is(Constant.Zone.Battlefield)) {
+ } else if (zone.is(ZoneType.Battlefield)) {
tgtCard.addCounter(Counters.valueOf(type), counterAmount);
} else {
// adding counters to something like re-suspend cards
@@ -1171,7 +1170,7 @@ public class AbilityFactoryCounters {
}
}
else {
- if (zone.is(Constant.Zone.Battlefield) || zone.is(Constant.Zone.Exile)) {
+ if (zone.is(ZoneType.Battlefield) || zone.is(ZoneType.Exile)) {
if (params.containsKey("UpTo") && sa.getActivatingPlayer().isHuman()) {
final ArrayList choices = new ArrayList();
for (int i = 0; i <= counterAmount; i++) {
@@ -1351,8 +1350,8 @@ public class AbilityFactoryCounters {
if (subAb != null && !subAb.chkAIDrawback()) {
return false;
}
- CardList hperms = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
- CardList cperms = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
+ CardList hperms = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
+ CardList cperms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
cperms = cperms.filter(new CardListFilter() {
@Override
public boolean addCard(final Card crd) {
@@ -1417,8 +1416,8 @@ public class AbilityFactoryCounters {
* a {@link forge.card.spellability.SpellAbility} object.
*/
private static void proliferateResolve(final AbilityFactory af, final SpellAbility sa) {
- CardList hperms = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
- CardList cperms = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
+ CardList hperms = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
+ CardList cperms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
if (af.getHostCard().getController().isHuman()) {
cperms.addAll(hperms);
@@ -1742,8 +1741,8 @@ public class AbilityFactoryCounters {
final boolean curse = af.isCurse();
final Target tgt = sa.getTarget();
- hList = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
- cList = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
+ hList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
+ cList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
hList = hList.getValidCards(valid, source.getController(), source);
cList = cList.getValidCards(valid, source.getController(), source);
@@ -1878,7 +1877,7 @@ public class AbilityFactoryCounters {
final int counterAmount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("CounterNum"), sa);
final String valid = params.get("ValidCards");
- CardList cards = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
cards = cards.getValidCards(valid, sa.getSourceCard().getController(), sa.getSourceCard());
final Target tgt = sa.getTarget();
@@ -1888,7 +1887,7 @@ public class AbilityFactoryCounters {
}
for (final Card tgtCard : cards) {
- if (AllZone.getZoneOf(tgtCard).is(Constant.Zone.Battlefield)) {
+ if (AllZone.getZoneOf(tgtCard).is(ZoneType.Battlefield)) {
tgtCard.addCounter(Counters.valueOf(type), counterAmount);
} else {
// adding counters to something like re-suspend cards
@@ -2101,7 +2100,7 @@ public class AbilityFactoryCounters {
int counterAmount = AbilityFactory.calculateAmount(af.getHostCard(), params.get("CounterNum"), sa);
final String valid = params.get("ValidCards");
- CardList cards = AllZoneUtil.getCardsIn(Zone.Battlefield);
+ CardList cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
cards = cards.getValidCards(valid, sa.getSourceCard().getController(), sa.getSourceCard());
final Target tgt = sa.getTarget();
@@ -2394,13 +2393,13 @@ public class AbilityFactoryCounters {
}
} else { // targeted
final Player player = af.isCurse() ? AllZone.getHumanPlayer() : AllZone.getComputerPlayer();
- CardList list = player.getCardsIn(Zone.Battlefield);
+ CardList list = player.getCardsIn(ZoneType.Battlefield);
list = list.getTargetableCards(sa);
list = list.getValidCards(abTgt.getValidTgts(), host.getController(), host);
if (list.isEmpty() && mandatory) {
// If there isn't any prefered cards to target, gotta choose
// non-preferred ones
- list = player.getOpponent().getCardsIn(Zone.Battlefield);
+ list = player.getOpponent().getCardsIn(ZoneType.Battlefield);
list = list.getTargetableCards(sa);
list = list.getValidCards(abTgt.getValidTgts(), host.getController(), host);
preferred = false;
diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java
index adf12c130cb..b8ecfdfb07b 100644
--- a/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java
+++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java
@@ -27,7 +27,6 @@ import forge.Card;
import forge.CardList;
import forge.CardListFilter;
import forge.CardUtil;
-import forge.Constant.Zone;
import forge.Singletons;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost;
@@ -41,6 +40,7 @@ import forge.card.spellability.TargetSelection;
import forge.game.phase.PhaseType;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
+import forge.game.zone.ZoneType;
import forge.util.MyRandom;
/**
@@ -434,7 +434,7 @@ public class AbilityFactoryDealDamage {
return false;
}
- final CardList hand = comp.getCardsIn(Zone.Hand);
+ final CardList hand = comp.getCardsIn(ZoneType.Hand);
if (this.abilityFactory.isSpell()) {
// If this is a spell, cast it instead of discarding
@@ -473,7 +473,7 @@ public class AbilityFactoryDealDamage {
final Target tgt = saMe.getTarget();
final Card source = saMe.getSourceCard();
final HashMap params = this.abilityFactory.getMapParams();
- CardList hPlay = pl.getCardsIn(Zone.Battlefield);
+ CardList hPlay = pl.getCardsIn(ZoneType.Battlefield);
hPlay = hPlay.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), source);
final ArrayList