-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetective_state.röd
49 lines (48 loc) · 1.36 KB
/
detective_state.röd
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
{
/* Role Party */
roles["DETECTIVE"] = "TOWN"
}
record DetectiveState(session) : State(session) {
name : string = "INVESTIGATION"
function pushDetective {
session.pushPlayers | { push p for p if [ p.role = "DETECTIVE" ] }
}
function gmText {
return `It's night. The detective wakes up.`
}
function killTexts {
return "Select target.", "You will be told if the target is a member of the mafia."
}
function onIntro {
player := self.pushDetective()
if [ player.state = "DEAD" ] do
session.broadcasts += "The detective is dead."
session.substate = "END"
return
done
session.broadcasts += "The detective wakes up."
player.state = "KILL"
session.substate = "KILL"
}
function onKill player, target {
return FALSE unless [ player.role = "DETECTIVE" and player.state = "KILL" ]
session.substate = "INFO"
player.state = "INFO"
player.info = `${target.name} is MAFIA.` if [ target.role = "MAFIA" ]
player.info = `${target.name} is NOT MAFIA.` if [ target.role != "MAFIA" ]
return TRUE
}
function onOK player {
return FALSE unless [ player.role = "DETECTIVE" and player.state = "INFO" ]
session.substate = "OUTRO"
player.state = "WAIT"
player.info = ""
return TRUE
}
function onOutro {
player := self.pushDetective()
player.state = "SLEEP"
session.broadcasts += "The detective sleeps."
session.substate = "END"
}
}