From 00f07027150fc544b6654ff3c762f5ffb3f965ad Mon Sep 17 00:00:00 2001 From: jendave Date: Sun, 7 Aug 2011 01:03:25 +0000 Subject: [PATCH] - Setup Game State now supports changing the current phase via the ActivePhase option (valid values are Untap, Upkeep, Draw, Main1, Declare Attackers, Declare Blockers, Main2, End of Turn, Cleanup). --- src/forge/GuiDisplayUtil.java | 10 +++++++++- src/forge/Phase.java | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/forge/GuiDisplayUtil.java b/src/forge/GuiDisplayUtil.java index da78ad6c3b4..76dfde068b8 100644 --- a/src/forge/GuiDisplayUtil.java +++ b/src/forge/GuiDisplayUtil.java @@ -941,6 +941,7 @@ public class GuiDisplayUtil implements NewConstants { String t_humanSetupLibrary = "NONE"; String t_computerSetupLibrary = "NONE"; String t_changePlayer = "NONE"; + String t_changePhase = "NONE"; String wd = "."; JFileChooser fc = new JFileChooser(wd); @@ -988,6 +989,8 @@ public class GuiDisplayUtil implements NewConstants { t_computerSetupLibrary = categoryValue; else if (categoryName.toLowerCase().equals("activeplayer")) t_changePlayer = categoryValue; + else if (categoryName.toLowerCase().equals("activephase")) + t_changePhase = categoryValue; } in.close(); @@ -1027,6 +1030,11 @@ public class GuiDisplayUtil implements NewConstants { AllZone.Phase.updateObservers(); } + if (!t_changePhase.trim().toLowerCase().equals("none")) { + AllZone.Phase.setDevPhaseState(t_changePhase); + AllZone.Phase.updateObservers(); + } + if (!t_humanSetupCardsInPlay.trim().toLowerCase().equals("none")) { for (int i = 0; i < humanSetupCardsInPlay.length; i ++) { Card c = AllZone.CardFactory.getCard(humanSetupCardsInPlay[i].trim(), AllZone.HumanPlayer); @@ -1173,7 +1181,7 @@ public class GuiDisplayUtil implements NewConstants { if(computerDevLibrarySetup.size() > 0) AllZone.Computer_Library.setCards(computerDevLibrarySetup.toArray()); - AllZone.GameAction.checkStateEffects(); + AllZone.GameAction.checkStateEffects(); } } diff --git a/src/forge/Phase.java b/src/forge/Phase.java index 093e0725935..eed74c8e8d4 100644 --- a/src/forge/Phase.java +++ b/src/forge/Phase.java @@ -610,4 +610,11 @@ public class Phase extends MyObservable public static int getGameBegins() { return GameBegins; } + + // this is a hack for the setup game state mode, do not use outside of devSetupGameState code + // as it avoids calling any of the phase effects that may be necessary in a less enforced context + public void setDevPhaseState(String phaseID) + { + this.phaseIndex = findIndex(phaseID); + } }