-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
executable file
·69 lines (60 loc) · 1.73 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { readFileSync, readdirSync, writeFileSync } from "node:fs";
import { Terminal, Party, Adventure, Character } from "./classes.js";
global.SETTINGS = JSON.parse(readFileSync("./settings.json"));
global.CHAT = new Terminal();
class Game {
constructor() {
this.party = new Party();
this.adventure = new Adventure();
}
async start() {
global.CHAT.clear();
global.CHAT.title("Welcome to Adventure Carryout!");
global.CHAT.text("Press ENTER to begin.");
await global.CHAT.await();
this.party.init();
global.CHAT.clear();
global.CHAT.title("Character Selection");
global.CHAT.text("Loaded the following characters:");
this.party.show();
global.CHAT.text("Press ENTER to select adventure.");
await global.CHAT.await();
await this.adventure.init();
global.CHAT.clear();
global.CHAT.title("Game Settings");
global.CHAT.text("Starting:");
this.adventure.show();
global.CHAT.text("With the following characters:");
this.party.show();
global.CHAT.text("Press ENTER to confirm.");
await global.CHAT.await();
this.adventure.play();
}
/*
async characterSelection() {
global.CHAT.askNumber(
(response) => {
this.selectCharacters(response);
},
{ min: 1, max: 4, message: "How many characters will be playing? (1-4)" }
);
}
//Character loading and creation
/*
selectCharacters(partySize) {
global.CHAT.askBinary(
(onTrue) => {
if (onTrue) {
this.loadCharacter();
} else {
global.CHAT.warning("Character creation is not yet supported");
}
},
{ message: "Use existing character?" }
);
}
loadCharacters() {}
*/
}
const GAME = new Game();
GAME.start();