diff --git a/src/forge/AIPlayer.java b/src/forge/AIPlayer.java index 3bae0e85e7c..2f8d65b3382 100644 --- a/src/forge/AIPlayer.java +++ b/src/forge/AIPlayer.java @@ -140,11 +140,10 @@ public class AIPlayer extends Player{ if(r.nextBoolean()) libPos = "top"; else libPos = "bottom"; } - CardList hand = new CardList(); - hand.addAll(AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer).getCards()); + CardList hand = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer); - CardList blIP = new CardList(); - blIP.addAll(AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards()); + CardList blIP = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer); + blIP = blIP.getType("Basic"); if(blIP.size() > 5) { CardList blIH = hand.getType("Basic"); @@ -183,8 +182,7 @@ public class AIPlayer extends Player{ for(int i = 0; i < num; i++) { boolean b = false; if(topN.get(i).getType().contains("Basic")) { - CardList bl = new CardList( - AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards()); + CardList bl = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer); bl = bl.filter(new CardListFilter() { public boolean addCard(Card c) { if(c.getType().contains("Basic")) return true; @@ -196,8 +194,7 @@ public class AIPlayer extends Player{ if(bl.size() > 5) // if control more than 5 Basic land, probably don't need more b = true; } else if(topN.get(i).getType().contains("Creature")) { - CardList cl = new CardList( - AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards()); + CardList cl = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer); cl = cl.filter(new CardListFilter() { public boolean addCard(Card c) { if(c.getType().contains("Creature")) return true; diff --git a/src/forge/AbilityFactory_ChangeZone.java b/src/forge/AbilityFactory_ChangeZone.java index 823b9736ee4..4c490906e92 100644 --- a/src/forge/AbilityFactory_ChangeZone.java +++ b/src/forge/AbilityFactory_ChangeZone.java @@ -361,10 +361,10 @@ public class AbilityFactory_ChangeZone { if (origin.equals("Library") && i < 1) { player.shuffle(); } - destZone.add(c, libraryPos); + AllZone.GameAction.moveToLibrary(c, libraryPos); } else { - destZone.add(c); + AllZone.GameAction.moveTo(destZone, c); if (destination.equals("Battlefield") && params.containsKey("Tapped")) c.tap(); } @@ -456,10 +456,11 @@ public class AbilityFactory_ChangeZone { origZone.remove(c); if (destination.equals("Library")){ int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0; - destZone.add(c, libraryPos); + AllZone.GameAction.moveToLibrary(c, libraryPos); } else - destZone.add(c); + AllZone.GameAction.moveTo(destZone, c); + if (destination.equals("Battlefield") && params.containsKey("Tapped")) c.tap(); } @@ -808,6 +809,7 @@ public class AbilityFactory_ChangeZone { for(Card tgtC : tgtCards){ PlayerZone originZone = AllZone.getZone(tgtC); + // if Target isn't in the expected Zone, continue if (!originZone.is(origin)) continue; @@ -835,10 +837,8 @@ public class AbilityFactory_ChangeZone { if (libraryPosition == -1) libraryPosition = library.size(); - Card cardCopy = AllZone.CardFactory.copyCard(tgtC); - - library.add(cardCopy, libraryPosition); //move to library - + AllZone.GameAction.moveToLibrary(tgtC, libraryPosition); + if (params.containsKey("Shuffle")) // for things like Gaea's Blessing player.shuffle(); } diff --git a/src/forge/AbilityFactory_CounterMagic.java b/src/forge/AbilityFactory_CounterMagic.java index b7d46fc5ac8..2d7594ef432 100644 --- a/src/forge/AbilityFactory_CounterMagic.java +++ b/src/forge/AbilityFactory_CounterMagic.java @@ -344,7 +344,8 @@ public class AbilityFactory_CounterMagic { } else { //AI decision-making, only draws a card if it doesn't risk discarding it. - if(AllZone.getZone(Constant.Zone.Hand,AllZone.ComputerPlayer).getCards().length + Integer.parseInt(SplitActionParams[0]) < 6) { + + if(AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer).size() + Integer.parseInt(SplitActionParams[0]) < 6) { Target.drawCards(Integer.parseInt(SplitActionParams[0])); } } @@ -419,7 +420,7 @@ public class AbilityFactory_CounterMagic { //Does nothing now, of course, but sometime in the future the AI may be able to remember cards revealed and prioritize discard spells accordingly. } else { - CardList list = new CardList(AllZone.getZone(Constant.Zone.Hand,AllZone.ComputerPlayer).getCards()); + CardList list = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer); AllZone.Display.getChoiceOptional("Revealed cards",list.toArray()); } } @@ -440,7 +441,7 @@ public class AbilityFactory_CounterMagic { AllZoneUtil.rearrangeTopOfLibrary(Target, Integer.parseInt(SplitActionParams[0]), false); } else { - CardList list = new CardList(AllZone.getZone(Constant.Zone.Hand,AllZone.ComputerPlayer).getCards()); + CardList list = AllZoneUtil.getCardsInZone(Constant.Zone.Hand, AllZone.ComputerPlayer); AllZone.Display.getChoiceOptional("Revealed cards",list.toArray()); } } diff --git a/src/forge/AbilityFactory_Counters.java b/src/forge/AbilityFactory_Counters.java index 1a6eddd7130..cd2f7179c36 100644 --- a/src/forge/AbilityFactory_Counters.java +++ b/src/forge/AbilityFactory_Counters.java @@ -136,8 +136,9 @@ public class AbilityFactory_Counters { String amountStr = af.getMapParams().get("CounterNum"); Player player = af.isCurse() ? AllZone.HumanPlayer : AllZone.ComputerPlayer; + - list = new CardList(AllZone.getZone(Constant.Zone.Battlefield, player).getCards()); + list = AllZoneUtil.getPlayerCardsInPlay(player); list = list.filter(new CardListFilter() { public boolean addCard(Card c) { return CardFactoryUtil.canTarget(source, c); @@ -273,7 +274,7 @@ public class AbilityFactory_Counters { Player player = af.isCurse() ? AllZone.HumanPlayer : AllZone.ComputerPlayer; - list = new CardList(AllZone.getZone(Constant.Zone.Battlefield, player).getCards()); + list = AllZoneUtil.getPlayerCardsInPlay(player); list = list.filter(new CardListFilter() { public boolean addCard(Card c) { return CardFactoryUtil.canTarget(source, c); diff --git a/src/forge/AbilityFactory_DealDamage.java b/src/forge/AbilityFactory_DealDamage.java index ef4645c9196..3468d4030fa 100644 --- a/src/forge/AbilityFactory_DealDamage.java +++ b/src/forge/AbilityFactory_DealDamage.java @@ -208,8 +208,7 @@ public class AbilityFactory_DealDamage { if (restDamage == 0) return false; - PlayerZone compHand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer); - CardList hand = new CardList(compHand.getCards()); + CardList hand = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer); if(AF.isSpell() && hand.size() > 7) // anti-discard-at-EOT return true; diff --git a/src/forge/AbilityFactory_Destroy.java b/src/forge/AbilityFactory_Destroy.java index b10dfdb5b73..e249ed5e7bf 100644 --- a/src/forge/AbilityFactory_Destroy.java +++ b/src/forge/AbilityFactory_Destroy.java @@ -151,8 +151,8 @@ public class AbilityFactory_Destroy { Target abTgt = sa.getTarget(); final Card source = sa.getSourceCard(); CardList list; - - list = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer).getCards()); + + list = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer); list = list.getTargetableCards(source); if (abTgt != null){ @@ -246,8 +246,8 @@ public class AbilityFactory_Destroy { if(params.containsKey("ValidCards")) Valid = params.get("ValidCards"); - CardList humanlist = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer).getCards()); - CardList computerlist = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards()); + CardList humanlist = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer); + CardList computerlist = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer); humanlist = humanlist.getValidCards(Valid.split(","), source.getController(), source); computerlist = computerlist.getValidCards(Valid.split(","), source.getController(), source); @@ -339,8 +339,8 @@ public class AbilityFactory_Destroy { if(params.containsKey("ValidCards")) Valid = params.get("ValidCards"); - CardList list = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer).getCards()); - list.addAll(AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards()); + + CardList list = AllZoneUtil.getCardsInPlay(); list = list.getValidCards(Valid.split(","), card.getController(), card); diff --git a/src/forge/AbilityFactory_Regenerate.java b/src/forge/AbilityFactory_Regenerate.java index 2e364215357..19c6a520fb5 100644 --- a/src/forge/AbilityFactory_Regenerate.java +++ b/src/forge/AbilityFactory_Regenerate.java @@ -151,8 +151,7 @@ public class AbilityFactory_Regenerate { else weight[0] = 0; // if there are many cards in hand, then maybe it's not such a great idea to waste mana - CardList HandList = new CardList(AllZone.getZone(Constant.Zone.Hand, - AllZone.ComputerPlayer).getCards()); + CardList HandList = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer); if(HandList.size() >= 4) weight[1] = 25; else weight[1] = 75; @@ -164,8 +163,7 @@ public class AbilityFactory_Regenerate { if(CardUtil.getConvertedManaCost(HandList.getCard(i).getManaCost()) > hCMC) hCMC = CardUtil.getConvertedManaCost(HandList.getCard( i).getManaCost()); - CardList LandList = new CardList(AllZone.getZone(Constant.Zone.Battlefield, - AllZone.ComputerPlayer).getCards()); + CardList LandList = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer); LandList = LandList.getType("Land"); //most regenerate abilities cost 2 or less diff --git a/src/forge/Ability_Activated.java b/src/forge/Ability_Activated.java index abcd3c8cf94..7d080ed6864 100644 --- a/src/forge/Ability_Activated.java +++ b/src/forge/Ability_Activated.java @@ -32,8 +32,8 @@ abstract public class Ability_Activated extends SpellAbility implements java.io. }); if(Pithing.size() != 0) return false; - - if(c.isCreature() && AllZone.getZone(c).getZoneName().equals(Constant.Zone.Battlefield)) { + + if(c.isCreature() && AllZone.getZone(c).is(Constant.Zone.Battlefield)) { CardList Silence = AllZoneUtil.getPlayerCardsInPlay(getSourceCard().getController().getOpponent()); Silence = Silence.getName("Linvala, Keeper of Silence"); if (Silence.size() != 0) diff --git a/src/forge/EndOfTurn.java b/src/forge/EndOfTurn.java index 73edc52c111..276e6089ade 100644 --- a/src/forge/EndOfTurn.java +++ b/src/forge/EndOfTurn.java @@ -35,8 +35,8 @@ public class EndOfTurn implements java.io.Serializable if(creature.isEmpty()) { CardList sacrifice = new CardList(); - sacrifice.addAll(all.getName("Pyrohemia").toArray()); - sacrifice.addAll(all.getName("Pestilence").toArray()); + sacrifice.add(all.getName("Pyrohemia")); + sacrifice.add(all.getName("Pestilence")); for(int i = 0; i < sacrifice.size(); i++) AllZone.GameAction.sacrifice(sacrifice.get(i)); @@ -54,17 +54,7 @@ public class EndOfTurn implements java.io.Serializable AllZone.GameInfo.setPreventCombatDamageThisTurn(false); AllZone.StaticEffects.rePopulateStateBasedList(); - - /* - PlayerZone cz = AllZone.getZone(Constant.Zone.Removed_From_Play, AllZone.ComputerPlayer); - PlayerZone hz = AllZone.getZone(Constant.Zone.Removed_From_Play, AllZone.HumanPlayer); - - CardList c = new CardList(cz.getCards()); - CardList h = new CardList(hz.getCards()); - - System.out.println("number of cards in compy removed zone: " + c.size()); - System.out.println("number of cards in human removed zone: " + h.size()); - */ + for(Card c : all) { if(!c.isFaceDown() && c.getKeyword().contains("At the beginning of the end step, sacrifice CARDNAME.")) diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index e6c21196c44..917173a4c77 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -32,7 +32,7 @@ public class GameAction { sa.getRestrictions().resetTurnActivations(); } } - + public Card moveTo(PlayerZone zone, Card c) { // Remove card from Current Zone, if it has one String prevZone = ""; @@ -51,6 +51,8 @@ public class GameAction { moving = addSuspendTriggers(moving); } + //boolean dontTrigger = p != null && p.is(Constant.Zone.Battlefield) && zone.is(Constant.Zone.Battlefield); + zone.add(moving); //Run triggers @@ -59,7 +61,7 @@ public class GameAction { runParams.put("Origin", prevZone); runParams.put("Destination", zone.getZoneName()); AllZone.TriggerHandler.runTrigger("ChangesZone", runParams); - + return moving; } @@ -191,7 +193,17 @@ public class GameAction { } public void moveToLibrary(Card c) { - moveToTopOfLibrary(c); + moveToLibrary(c, 0); + } + + public void moveToLibrary(Card c, int libPosition){ + PlayerZone p = AllZone.getZone(c); + PlayerZone library = AllZone.getZone(Constant.Zone.Library, c.getOwner()); + + if(p != null) p.remove(c); + if(!c.isToken()) c = AllZone.CardFactory.copyCard(c); + + library.add(c, libPosition); } /** diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 1ec938eb1e0..edf21d17536 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -123,25 +123,18 @@ public class GameActionUtil { // Win / Lose final Player player = AllZone.Phase.getPlayerTurn(); - PlayerZone playZone = AllZone.getZone(Constant.Zone.Battlefield, player); - PlayerZone OpplayZone = AllZone.getZone(Constant.Zone.Battlefield, player.getOpponent()); - CardList Platinumlist = new CardList(OpplayZone.getCards()); - Platinumlist = Platinumlist.getName("Platinum Angel"); - CardList Abyssallist = new CardList(playZone.getCards()); - Abyssallist = Abyssallist.getName("Abyssal Persecutor"); - if(Platinumlist.size() == 0 && Abyssallist.size() == 0) { - upkeep_Battle_of_Wits(); - upkeep_Mortal_Combat(); - upkeep_Epic_Struggle(); - upkeep_Near_Death_Experience(); - upkeep_Test_of_Endurance(); - upkeep_Helix_Pinnacle(); - upkeep_Barren_Glory(); - upkeep_Felidar_Sovereign(); - upkeep_Klass(); - } + //Win / Lose - + // Checks for can't win or can't lose happen in Player.altWinConditionMet() + upkeep_Battle_of_Wits(); + upkeep_Mortal_Combat(); + upkeep_Epic_Struggle(); + upkeep_Near_Death_Experience(); + upkeep_Test_of_Endurance(); + upkeep_Helix_Pinnacle(); + upkeep_Barren_Glory(); + upkeep_Felidar_Sovereign(); + upkeep_Convalescence(); upkeep_Convalescent_Care(); upkeep_Ancient_Runes(); @@ -10063,33 +10056,6 @@ public class GameActionUtil { }// for }// upkeep_Power_Surge() - private static void upkeep_Klass() { - final Player player = AllZone.Phase.getPlayerTurn(); - PlayerZone playZone = AllZone.getZone(Constant.Zone.Battlefield, player); - - CardList elf = new CardList(playZone.getCards()); - elf = elf.getType("Elf"); - - CardList list = new CardList(playZone.getCards()); - list = list.getName("Klaas, Elf Friend"); - - if(0 < list.size() && 10 <= elf.size()) { - final Card source = list.get(0); - Ability ability = new Ability(source, "0") { - @Override - public void resolve() { - player.getOpponent().setLife(0, source); - } - };// Ability - - StringBuilder sb = new StringBuilder(); - sb.append("Klaas, Elf Friend - ").append(player).append(" wins the game"); - ability.setStackDescription(sb.toString()); - - AllZone.Stack.add(ability); - }// if - }// upkeep_Klass - private static void upkeep_Felidar_Sovereign() { final Player player = AllZone.Phase.getPlayerTurn(); PlayerZone playZone = AllZone.getZone(Constant.Zone.Battlefield, player); diff --git a/src/forge/Input_Mulligan.java b/src/forge/Input_Mulligan.java index 2108b34c7f7..87886a93eee 100644 --- a/src/forge/Input_Mulligan.java +++ b/src/forge/Input_Mulligan.java @@ -53,7 +53,7 @@ public class Input_Mulligan extends Input { void end() { ButtonUtil.reset(); - CardList HHandList = new CardList(AllZone.getZone(Constant.Zone.Hand, AllZone.HumanPlayer).getCards()); + CardList HHandList = AllZoneUtil.getPlayerHand(AllZone.HumanPlayer); PlayerZone HPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer); PlayerZone HHand = AllZone.getZone(Constant.Zone.Hand, AllZone.HumanPlayer); for(int i = 0; i < HHandList.size() ; i++) { @@ -68,7 +68,7 @@ public class Input_Mulligan extends Input { } } } - CardList CHandList = new CardList(AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer).getCards()); + CardList CHandList = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer); PlayerZone CPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer); PlayerZone CHand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer); for(int i = 0; i < CHandList.size() ; i++) { diff --git a/src/forge/MagicStack.java b/src/forge/MagicStack.java index 2bb4f3777ce..c3bd288d59e 100644 --- a/src/forge/MagicStack.java +++ b/src/forge/MagicStack.java @@ -609,8 +609,7 @@ public class MagicStack extends MyObservable { private static final long serialVersionUID = -2559488318473330418L; public void execute() { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, crd.getOwner()); - AllZone.GameAction.moveTo(hand, crd); + AllZone.GameAction.moveToHand(crd); } }); } diff --git a/src/forge/Phase.java b/src/forge/Phase.java index 036e2a21e9c..4b281495595 100644 --- a/src/forge/Phase.java +++ b/src/forge/Phase.java @@ -457,10 +457,8 @@ public class Phase extends MyObservable public void resetAttackedThisCombat(Player player) { // resets the status of attacked/blocked this phase - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player); - - CardList list = new CardList(); - list.addAll(play.getCards()); + CardList list = AllZoneUtil.getPlayerCardsInPlay(player); + list = list.getType("Creature"); for(int i = 0; i < list.size(); i++) { diff --git a/src/forge/PhaseUtil.java b/src/forge/PhaseUtil.java index 76947d4f025..758b6227806 100644 --- a/src/forge/PhaseUtil.java +++ b/src/forge/PhaseUtil.java @@ -28,8 +28,7 @@ public class PhaseUtil { runParams.put("Player", AllZone.Phase.getPlayerTurn()); AllZone.TriggerHandler.runTrigger("Phase", runParams); - PlayerZone p = AllZone.getZone(Constant.Zone.Battlefield, turn); - Card[] c = p.getCards(); + AllZone.Phase.turnReset(); @@ -39,8 +38,9 @@ public class PhaseUtil { // For tokens a player starts the game with they don't recover from Sum. Sickness on first turn if (turn.getTurn() > 0){ - for(int i = 0; i < c.length; i++) - c[i].setSickness(false); + CardList list = AllZoneUtil.getPlayerCardsInPlay(turn); + for(Card c : list) + c.setSickness(false); } turn.incrementTurn(); @@ -63,9 +63,8 @@ public class PhaseUtil { private static void doUntap() { Player player = AllZone.Phase.getPlayerTurn(); - PlayerZone p = AllZone.getZone(Constant.Zone.Battlefield, player); - CardList list = new CardList(p.getCards()); - + CardList list = AllZoneUtil.getPlayerCardsInPlay(player); + for(Card c : list) { if (c.getBounceAtUntap() && c.getName().contains("Undiscovered Paradise") ) { @@ -325,9 +324,8 @@ public class PhaseUtil { return true; Player turn = AllZone.Phase.getPlayerTurn(); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, turn); - if (turn.getCards(hand).size() == 0 && AllZoneUtil.isCardInPlay("Gibbering Descent", turn)) + if (AllZoneUtil.getPlayerHand(turn).size() == 0 && AllZoneUtil.isCardInPlay("Gibbering Descent", turn)) return true; return false; @@ -405,13 +403,10 @@ public class PhaseUtil { if (list.size() == 1){ AllZone.GameAction.checkWheneverKeyword(list.get(0), "Attack - Alone", null); Player attackingPlayer = AllZone.Combat.getAttackingPlayer(); - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, attackingPlayer); - CardList exalted = new CardList(play.getCards()); - exalted = exalted.filter(new CardListFilter() { - public boolean addCard(Card c) { - return c.getKeyword().contains("Exalted"); - } - }); + + CardList exalted = AllZoneUtil.getPlayerCardsInPlay(attackingPlayer); + exalted = exalted.getKeyword("Exalted"); + if(exalted.size() > 0) CombatUtil.executeExaltedAbility(list.get(0), exalted.size()); // Make sure exalted effects get applied only once per combat } diff --git a/src/forge/Player.java b/src/forge/Player.java index 320ee547685..84203959478 100644 --- a/src/forge/Player.java +++ b/src/forge/Player.java @@ -675,8 +675,9 @@ public abstract class Player extends MyObservable{ public void discardRandom(final int num, final SpellAbility sa) { for(int i = 0; i < num; i++) { - Card[] c = AllZone.getZone(Constant.Zone.Hand, this).getCards(); - if(c.length != 0) doDiscard(CardUtil.getRandom(c), sa); + CardList list = AllZoneUtil.getPlayerHand(this); + if(list.size() != 0) + doDiscard(CardUtil.getRandom(list.toArray()), sa); } } diff --git a/src/forge/SpellAbilityUtil.java b/src/forge/SpellAbilityUtil.java index f1dfb064adf..89fea9b5b0e 100644 --- a/src/forge/SpellAbilityUtil.java +++ b/src/forge/SpellAbilityUtil.java @@ -40,23 +40,22 @@ public class SpellAbilityUtil static public CardList getAvailableMana(Player player) { - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player); - CardList all = new CardList(play.getCards()); - CardList mana = all.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - if(c.isTapped()) - return false; + CardList all = AllZoneUtil.getPlayerCardsInPlay(player); + CardList mana = all.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + if(c.isTapped()) + return false; + + ArrayList a = c.getManaAbility(); + for(Ability_Mana am : a) + return am.isBasic(); + + return false; + }//addCard() + });//CardListFilter - ArrayList a = c.getManaAbility(); - for(Ability_Mana am : a) - return am.isBasic(); - - return false; - }//addCard() - });//CardListFilter - - return mana; + return mana; }//getUntappedMana } \ No newline at end of file diff --git a/src/forge/SpellAbility_Requirements.java b/src/forge/SpellAbility_Requirements.java index ebc3c09103c..0db976ed377 100644 --- a/src/forge/SpellAbility_Requirements.java +++ b/src/forge/SpellAbility_Requirements.java @@ -24,6 +24,8 @@ public class SpellAbility_Requirements { bCasting = true; if (!ability.getSourceCard().isCopiedSpell()){ Card c = ability.getSourceCard(); + + // todo(sol): move Spell to Stack here? fromZone = AllZone.getZone(c); if (fromZone != null) fromZone.remove(c); diff --git a/src/forge/SpellAbility_Restriction.java b/src/forge/SpellAbility_Restriction.java index db34978db78..cdd3092f5da 100644 --- a/src/forge/SpellAbility_Restriction.java +++ b/src/forge/SpellAbility_Restriction.java @@ -171,13 +171,13 @@ public class SpellAbility_Restriction { if (nCardsInHand != -1){ // Can handle Library of Alexandria, or Hellbent - if (AllZone.getZone(Constant.Zone.Hand, activator).size() != nCardsInHand) + if (AllZoneUtil.getPlayerHand(activator).size() != nCardsInHand) return false; } if (bNeedsThreshold){ // Threshold - if (AllZone.getZone(Constant.Zone.Graveyard, activator).size() < THRESHOLD) + if (AllZoneUtil.getPlayerGraveyard(activator).size() < THRESHOLD) return false; } diff --git a/src/forge/StaticEffects.java b/src/forge/StaticEffects.java index 763f3c20466..f5deb5d141e 100644 --- a/src/forge/StaticEffects.java +++ b/src/forge/StaticEffects.java @@ -89,15 +89,8 @@ public class StaticEffects public void rePopulateStateBasedList() { reset(); - PlayerZone playerZone = AllZone.getZone(Constant.Zone.Battlefield, - AllZone.HumanPlayer); - PlayerZone computerZone = AllZone.getZone(Constant.Zone.Battlefield, - AllZone.ComputerPlayer); - CardList cards = new CardList(); - cards.addAll(playerZone.getCards()); - cards.addAll(computerZone.getCards()); - + CardList cards = AllZoneUtil.getCardsInPlay(); Log.debug("== Start add state effects =="); for (int i=0;i