- Added an ability to show puzzle descriptions on the puzzle goal card.

This commit is contained in:
Agetian
2017-07-25 03:14:40 +00:00
parent e7f6e5c740
commit 63be38a3c3
2 changed files with 9 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ public class Puzzle extends GameState implements InventoryItem, Comparable {
String goal; String goal;
String url; String url;
String difficulty; String difficulty;
String description;
int turns; int turns;
public Puzzle(Map<String, List<String>> puzzleLines) { public Puzzle(Map<String, List<String>> puzzleLines) {
@@ -41,6 +42,8 @@ public class Puzzle extends GameState implements InventoryItem, Comparable {
this.turns = Integer.parseInt(split[1]); this.turns = Integer.parseInt(split[1]);
} else if ("Difficulty".equalsIgnoreCase(split[0])) { } else if ("Difficulty".equalsIgnoreCase(split[0])) {
this.difficulty = split[1]; this.difficulty = split[1];
} else if ("Description".equalsIgnoreCase(split[0])) {
this.description = split[1];
} }
} }
} }
@@ -61,6 +64,11 @@ public class Puzzle extends GameState implements InventoryItem, Comparable {
desc.append("\nTurns Limit: "); desc.append("\nTurns Limit: ");
desc.append(this.turns); desc.append(this.turns);
if (this.description != null) {
desc.append("\n\n");
desc.append(this.description);
}
return desc.toString(); return desc.toString();
} }

View File

@@ -17,7 +17,7 @@ public class PuzzleIO {
public static ArrayList<Puzzle> loadPuzzles() { public static ArrayList<Puzzle> loadPuzzles() {
String[] pList; String[] pList;
// get list of custom draft files // get list of puzzles
final File pFolder = new File(ForgeConstants.PUZZLE_DIR); final File pFolder = new File(ForgeConstants.PUZZLE_DIR);
if (!pFolder.exists()) { if (!pFolder.exists()) {
throw new RuntimeException("Puzzles : folder not found -- folder is " + pFolder.getAbsolutePath()); throw new RuntimeException("Puzzles : folder not found -- folder is " + pFolder.getAbsolutePath());