forked from MousAIDungeon/Scripting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauthorsNote.js
40 lines (34 loc) · 820 Bytes
/
authorsNote.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
const themes = [
{
text: 'ghost story',
matcher: /ghost|halloween|spooky/i,
},
{
text: 'trick-or-treat',
matcher: /trick.or.treat|halloween|spooky/i,
},
{
text: 'spooky',
matcher: /halloween|spooky/i,
},
]
const modifier = (text) => {
if (!state.setup) {
state.theme = Math.floor(Math.random() * themes.length)
state.setup = true
state.matched = false
}
const theme = themes[state.theme]
if (!state.matched && text.match(theme.matcher)) {
state.matched = true
}
if (state.matched) {
state.memory = {}
} else {
const halloween = ` It involves Halloween and has a ${theme.text} theme.`
state.memory = { authorsNote: `the rest of this story is silly & playful.${halloween}` }
}
return {text}
}
// Don't modify this part
modifier(text)