- 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 url;
String difficulty;
String description;
int turns;
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]);
} else if ("Difficulty".equalsIgnoreCase(split[0])) {
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(this.turns);
if (this.description != null) {
desc.append("\n\n");
desc.append(this.description);
}
return desc.toString();
}

View File

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