mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Create a Puzzle: allow to choose to start the game either with the Human or with the AI player taking the first turn.
- Improved the opening warning message for this mode.
This commit is contained in:
@@ -13,6 +13,7 @@ import forge.menus.IMenuProvider;
|
|||||||
import forge.menus.MenuUtil;
|
import forge.menus.MenuUtil;
|
||||||
import forge.player.GamePlayerUtil;
|
import forge.player.GamePlayerUtil;
|
||||||
import forge.puzzle.Puzzle;
|
import forge.puzzle.Puzzle;
|
||||||
|
import forge.util.gui.SGuiChoose;
|
||||||
import forge.util.gui.SOptionPane;
|
import forge.util.gui.SOptionPane;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -52,7 +53,7 @@ public enum CSubmenuPuzzleCreate implements ICDoc, IMenuProvider {
|
|||||||
return menus;
|
return menus;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, List<String>> generateEmptyPuzzle() {
|
private Map<String, List<String>> generateEmptyPuzzle(String firstPlayer) {
|
||||||
Map<String, List<String>> emptyPuzzle = Maps.newHashMap();
|
Map<String, List<String>> emptyPuzzle = Maps.newHashMap();
|
||||||
|
|
||||||
emptyPuzzle.put("metadata", Arrays.asList(
|
emptyPuzzle.put("metadata", Arrays.asList(
|
||||||
@@ -66,7 +67,7 @@ public enum CSubmenuPuzzleCreate implements ICDoc, IMenuProvider {
|
|||||||
);
|
);
|
||||||
|
|
||||||
emptyPuzzle.put("state", Arrays.asList(
|
emptyPuzzle.put("state", Arrays.asList(
|
||||||
"ActivePlayer=human",
|
"ActivePlayer=" + firstPlayer,
|
||||||
"ActivePhase=upkeep",
|
"ActivePhase=upkeep",
|
||||||
"HumanLife=20",
|
"HumanLife=20",
|
||||||
"AILife=20"
|
"AILife=20"
|
||||||
@@ -77,7 +78,10 @@ public enum CSubmenuPuzzleCreate implements ICDoc, IMenuProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startPuzzleCreate() {
|
private void startPuzzleCreate() {
|
||||||
final Puzzle emptyPuzzle = new Puzzle(generateEmptyPuzzle());
|
String firstPlayer = SGuiChoose.one("Who should be the first to take a turn?",
|
||||||
|
Arrays.asList(new String[] {"Human", "AI"}));
|
||||||
|
|
||||||
|
final Puzzle emptyPuzzle = new Puzzle(generateEmptyPuzzle(firstPlayer));
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -91,12 +95,11 @@ public enum CSubmenuPuzzleCreate implements ICDoc, IMenuProvider {
|
|||||||
hostedMatch.setStartGameHook(new Runnable() {
|
hostedMatch.setStartGameHook(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public final void run() {
|
public final void run() {
|
||||||
SOptionPane.showMessageDialog("This mode presents you with a clean battlefield.\n\n"
|
SOptionPane.showMessageDialog("Welcome to the Create a Puzzle mode.\n\n"
|
||||||
+ "Please make sure that Developer Mode is enabled in Forge preferences.\n"
|
+ "Please make sure that Developer Mode is enabled in Forge preferences.\n"
|
||||||
+ "You can use the Developer Mode tools to set up the battlefield, and then\n"
|
+ "Remember that rule enforcement is active, so players will lose the game\n"
|
||||||
+ "export the game state to a text file using the Dump Game State command.\n"
|
+ "for drawing from empty library!",
|
||||||
+ "Please use existing puzzle files as a reference for what is possible.",
|
"Create a New Puzzle", SOptionPane.WARNING_ICON);
|
||||||
"Create a New Puzzle", SOptionPane.INFORMATION_ICON);
|
|
||||||
emptyPuzzle.applyToGame(hostedMatch.getGame());
|
emptyPuzzle.applyToGame(hostedMatch.getGame());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user