(Code Samples) Events
igium / Liber Ludens / (Code Samples) Events-Events)
Event Definition - brainstorming (non-final)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 {
"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"
:
""
}
]
}
]
}