(Code Samples) Events

igium / Liber Ludens / (Code Samples) Events-Events)

Event Definition - brainstorming (non-final)

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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
    "events":
    [
        {
            "key": "dungeon.massive.guard.attack",
            "durationBefore": "5:00",
            "durationAfter": "5:00",
            "duration": "15:00",
            "trigger":
            {
                "condition":
                {
                    "and":
                    {
                        "implicitDataEquals": { "key": "priestsKilledCount", "value": 5 },
                        "isAfterTime": "12:30",
                        "hasTimerElapsed": "timers.firstPriestEncounter",    //    returns true if the timer has ticked at least once, no matter whether it has stopped or not
                        "isTimerTicking": "timers.firstPriestEncounter",    //    returns true if the timer is active and ticks at least once within the current measurement interval (source exit + current room for conditions tested from a room; selected exit + destination room for conditions tested from an exit)
                        "isTimerActive": "timers.firstPriestEncounter",        //    returns true if the timer is active
                    }
                }
            }
        }
    ],
    "rooms":
    [
        {
            "key": "dungeon.firstPriestEncounter",
            "file": "room-dungeon.firstPriestEncounter.txt",
            "duration": "7:00",
            "onRoomEnter":
            {
                "startTimers":
                [
                    {
                        "key": "timers.firstPriestEncounter",
                        "interval": "45:00",
                        "once": false
                    }
                ]
            },
            "exits":
            [
                {
                    "text": "next",
                    "target": ""
                }
            ]
        },
        {
            "key": "dungeon.some.other.place",
            "file": "room-dungeon.some.other.place.txt",
            "duration": "7:00",
            "on dungeon.massive.guard.attack":
            {
                "insertText":
                [
                    {
                        "condition":
                        {
                            "hasEventHappened": "dungeon.massive.guard.attack"
                        },
                        "textId": "dungeon.massive.guard.attack.1.A"
                    },
                    {
                        "condition":
                        {
                            "hasEventHappenedNTimes": { "key": "dungeon.massive.guard.attack", "value": 3 }
                        },
                        "textId": "dungeon.massive.guard.attack.1.B"
                    },
                    {
                        "condition":
                        {
                            "isBeforeEvent": { "key": "dungeon.massive.guard.attack", "time": "10:00" }
                        },
                        "textId": "dungeon.massive.guard.attack.1.C"
                    },
                    {
                        "condition":
                        {
                            "isBeforeEvent": "dungeon.massive.guard.attack"    //    uses the event "durationBefore" value
                        },
                        "textId": "dungeon.massive.guard.attack.1.C"
                    },
                    {
                        "condition":
                        {
                            "isAfterEvent": { "key": "dungeon.massive.guard.attack", "time": "10:00" }
                        },
                        "textId": "dungeon.massive.guard.attack.1.C"
                    },
                    {
                        "condition":
                        {
                            "isAfterEvent": "dungeon.massive.guard.attack"    //    uses the event "durationAfter" value
                        },
                        "textId": "dungeon.massive.guard.attack.1.C"
                    },
                    {
                        "condition":
                        {
                            "isDuringEvent": "dungeon.massive.guard.attack"
                        },
                        "textId": "dungeon.massive.guard.attack.1.C"
                    },
                    {
                        "condition":
                        {
                            "isEventTimeElapsed": { "key": "dungeon.massive.guard.attack", "time": "7:00" }    //    tests whether the event is active and the specified amount of time has elapsed since the event start
                        },
                        "textId": "dungeon.massive.guard.attack.1.C"
                    }
                ]
            },
            "onRoomExit":
            {
                "stopTimers":
                [
                  {
                      "key": "timers.firstPriestEncounter"
                  }
                ]
            },
            "exits":
            [
                {
                    "text": "next",
                    "target": ""
                }
            ]
        }
    ]
}