mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
break out more reusable code to GameAction.promptForShuffle(Player);
updated Natural Selection to exercise this new function
This commit is contained in:
@@ -287,15 +287,14 @@ public class AllZoneUtil {
|
||||
|
||||
//zone manipulation, maybe be better off in GameAction.java...
|
||||
/**
|
||||
* use this when you need to rearrange the top X cards in a player's library. You
|
||||
* use this when Human needs to rearrange the top X cards in a player's library. You
|
||||
* may also specify a shuffle when done
|
||||
*
|
||||
* @param player the player to target (currently *cannot* be Computer - no effect)
|
||||
* @param player the player to target
|
||||
* @param numCards the number of cards from the top to rearrange
|
||||
* @param shuffle true if a shuffle is desired at the end, false otherwise
|
||||
*/
|
||||
public static void rearrangeTopOfLibrary(final String player, final int numCards, boolean shuffle) {
|
||||
if(player.equals(Constant.Player.Human)) {
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
int maxCards = lib.size();
|
||||
maxCards = Math.min(maxCards, numCards);
|
||||
@@ -325,8 +324,4 @@ public class AllZoneUtil {
|
||||
AllZone.GameAction.shuffle(player);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//this does not and is not expected to work for the AI at this time
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17779,12 +17779,7 @@ public class CardFactory implements NewConstants {
|
||||
public void resolve() {
|
||||
String player = getTargetPlayer();
|
||||
AllZoneUtil.rearrangeTopOfLibrary(player, 3, false);
|
||||
String[] choices = new String[] {"Yes", "No"};
|
||||
Object o = AllZone.Display.getChoice("Shuffle target player's library?", choices);
|
||||
String myChoice = (String) o;
|
||||
if(myChoice.equals("Yes")) {
|
||||
AllZone.GameAction.shuffle(player);
|
||||
}
|
||||
AllZone.GameAction.promptForShuffle(player);
|
||||
}
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
|
||||
Reference in New Issue
Block a user