From efd4f76aa156d5271c97d36748f92f993cf5e1d0 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 04:14:50 +0000 Subject: [PATCH] (forgot GameAction.java in last commit) - break out more reusable code to GameAction.promptForShuffle(Player); updated Natural Selection to exercise this new function --- src/forge/GameAction.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index bed3c0b6580..0d4627f377c 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -904,6 +904,22 @@ public class GameAction { library.setCards(c); }//shuffle + /** + * prompts Human to see if a target player's library should be shuffled. This should + * only be called when the choice is made by the Human (target can be either), then + * shuffles that player's library if appropriate + * + * @param player the player's library we want to shuffle + */ + public void promptForShuffle(final String player) { + String[] choices = new String[] {"Yes", "No"}; + Object o = AllZone.Display.getChoice("Shuffle "+player+"'s library?", choices); + String myChoice = (String) o; + if(myChoice.equals("Yes")) { + AllZone.GameAction.shuffle(player); + } + } + public boolean isCardInZone(Card card, PlayerZone p) { ArrayList list = new ArrayList(Arrays.asList(p.getCards())); return list.contains(card);