-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
77 lines (71 loc) · 1.86 KB
/
index.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
70
71
72
73
74
75
76
77
/*
A more flexible character generation libary for Ranvier
Ideally, a chaining API of sorts:
```javascript
let startingAttributes = { ... };
let startingClass = 'warrior';
const scenario = Choices
.createScenario('toughChoice', {
title: 'Make a tough decision',
description: 'This will have an effect on your character\'s starting equipment or whatever.'
})
.addChoices({
beGood: {
description: 'Do the right thing',
effect() {
startingAttributes.willpower++;
}
},
beBad: {
description: 'Do the wrong thing via brute force.',
effect() {
startingAttributes.might++;
}
}
});
const secondScenario = Choices
.createScenario('job', {
title: 'Choose a career path'.
description: 'This will have an effect on your character\'s starting skills or whatever.'
})
.addChoices({
bePaladin: {
description: 'Become a paladin',
effect() {
startingClass = 'paladin';
},
prerequisite(choices) {
return choices.toughChoice !== 'beBad'
}
}
},
{
beThief: {
description: 'Become a thief',
effect() {
startingClass = 'thief';
}
prerequisite(choices) {
return choices.toughChoice === 'beBad'
}
}
});
Choices.run({
scenarios: [ // a list of scenarios, ran in the order they are defined
scenario,
secondScenario
],
socket // socket to emit input-events to
say // function to broadcast to socket or player
})
.then(() => socket.emit('done'));
```
*/
const Choice = require('./lib/Choice');
const Choices = require('./lib/Choices');
const Scenario = require('./lib/Scenario');
module.exports = {
Choice,
Choices,
Scenario
};