From d509992fbf6e36d963958d31373d04c77808995f Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 14:43:07 +0000 Subject: [PATCH] update a few custom Yes/No dialogs to use GameActionUtil.showYesNoDialog() --- src/forge/AbilityFactory_CounterMagic.java | 6 +++--- src/forge/Phase.java | 11 ++++------- src/forge/PlayerZone_ComesIntoPlay.java | 22 +++++++++------------- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/forge/AbilityFactory_CounterMagic.java b/src/forge/AbilityFactory_CounterMagic.java index d48ac881bf3..866eb5042d5 100644 --- a/src/forge/AbilityFactory_CounterMagic.java +++ b/src/forge/AbilityFactory_CounterMagic.java @@ -362,7 +362,7 @@ public class AbilityFactory_CounterMagic { else if(ActionID.equals("GainLife")) { if(isOptional) { if(Target == AllZone.HumanPlayer) { - if(AllZone.Display.getChoice("Do you want to gain" + SplitActionParams[0] + "life?","Yes","No").equals("Yes")) { + if(GameActionUtil.showYesNoDialog(srcSA.getSourceCard(), "Do you want to gain" + SplitActionParams[0] + "life?")) { Target.gainLife(Integer.parseInt(SplitActionParams[0]), srcSA.getSourceCard()); } } @@ -379,7 +379,7 @@ public class AbilityFactory_CounterMagic { if(isOptional) { System.out.println(Target); if(Target == AllZone.HumanPlayer) { - if(AllZone.Display.getChoice("Do you want to reveal your hand?","Yes","No").equals("Yes")) { + if(GameActionUtil.showYesNoDialog(srcSA.getSourceCard(), "Do you want to reveal your hand?")) { //Does nothing now, of course, but sometime in the future the AI may be able to remember cards revealed and prioritize discard spells accordingly. } } @@ -401,7 +401,7 @@ public class AbilityFactory_CounterMagic { else if(ActionID.equals("RearrangeTopOfLibrary")) { if(isOptional) { if(Target == AllZone.HumanPlayer) { - if(AllZone.Display.getChoice("Do you want to rearrange the top " + SplitActionParams[0] + " cards of your library?","Yes","No").equals("Yes")) { + if(GameActionUtil.showYesNoDialog(srcSA.getSourceCard(), "Do you want to rearrange the top " + SplitActionParams[0] + " cards of your library?")) { AllZoneUtil.rearrangeTopOfLibrary(Target, Integer.parseInt(SplitActionParams[0]), false); } } diff --git a/src/forge/Phase.java b/src/forge/Phase.java index a29fe2bc56e..cc71a92fb7d 100644 --- a/src/forge/Phase.java +++ b/src/forge/Phase.java @@ -385,13 +385,10 @@ public class Phase extends MyObservable final Card crd = vaults.get(0); if(turn.equals(AllZone.HumanPlayer)) { - String[] choices = {"Yes", "No"}; - Object q = null; - q = AllZone.Display.getChoiceOptional("Untap " + crd + "?", choices); - if("Yes".equals(q)) { - crd.untap(); - turn = extraTurns.isEmpty() ? turn.getOpponent() : extraTurns.pop(); - } + if(GameActionUtil.showYesNoDialog(crd, "Untap " + crd + "?")) { + crd.untap(); + turn = extraTurns.isEmpty() ? turn.getOpponent() : extraTurns.pop(); + } } else{ // TODO: Should AI skip his turn for time vault? diff --git a/src/forge/PlayerZone_ComesIntoPlay.java b/src/forge/PlayerZone_ComesIntoPlay.java index d9bfa1fceb0..b436cbc6c92 100644 --- a/src/forge/PlayerZone_ComesIntoPlay.java +++ b/src/forge/PlayerZone_ComesIntoPlay.java @@ -338,19 +338,15 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone { @Override public void resolve() { if(crd.getController().equals(AllZone.HumanPlayer)) { - String[] choices = {"Yes", "No"}; - - Object q = null; - - q = AllZone.Display.getChoiceOptional("Attach " + crd + " to " + creat + "?", choices); - if(q == null || q.equals("No")) ; - else if(AllZone.GameAction.isCardInZone(crd, graveZone) - && AllZone.GameAction.isCardInPlay(creat) && creat.isCreature() - && creat.getNetAttack() == 1 && creat.getNetDefense() == 1) { - graveZone.remove(crd); - playZone.add(crd); - - crd.equipCard(creat); + if(GameActionUtil.showYesNoDialog(crd, "Attach " + crd + " to " + creat + "?")) { + if(AllZone.GameAction.isCardInZone(crd, graveZone) + && AllZone.GameAction.isCardInPlay(creat) && creat.isCreature() + && creat.getNetAttack() == 1 && creat.getNetDefense() == 1) { + graveZone.remove(crd); + playZone.add(crd); + + crd.equipCard(creat); + } } } else //computer