diff --git a/stories/geta-unaware.js b/stories/geta-unaware.js index 86eb66f..2c3b6c9 100644 --- a/stories/geta-unaware.js +++ b/stories/geta-unaware.js @@ -1,5 +1,5 @@ (() => { - function checkSuspicion(state, add=0) { + function checkSuspicion(state, add = 0) { state.player.stats.suspicion.value += add; if (state.player.stats.suspicion.value >= 100) { print(["Geta spots you!", "You're snatched up and tossed into the fox's bowl of cereal."]); @@ -20,17 +20,57 @@ "intro": { "start": "pepper-grinder", "setup": state => { - state.player.stats.suspicion = {name: "Suspicion", type: "meter", value: 0, min: 0, max: 100, color: "rgb(100,100,100)"}; + state.player.stats.suspicion = { name: "Suspicion", type: "meter", value: 0, min: 0, max: 100, color: "rgb(100,100,100)" }; + state.info.time.value = 60 * 60 * 7 + 60 * 17; + + state.player.flags.caught = false; + + startTimer({ + id: "clock", + func: state => { + state.info.time.value += 1; + state.info.time.value %= 86000; + return true; + }, + delay: 1000, + loop: true, + classes: [ + + ] + }, state); + + startTimer({ + id: "timeout", + func: state => { + if (state.info.time.value == 60 * 60 * 7 + 60 * 19) { + print(["The fox is almost done with his breakfast..."]); + } + + if (state.info.time.value >= 60 * 60 * 7 + 60 * 20) { + print(["Time's up! In you go."]); + goToRoom("maw", state); + return false; + } + return true; + }, + delay: 1000, + loop: true, + classes: [ + "free" + ] + }, state); + + }, "intro": state => { print(["Game started"]); } }, "sounds": [ - + ], "preload": [ - + ], "world": { "pepper-grinder": { @@ -41,25 +81,38 @@ print(["You dart over to the pepper grinder, which looms over you like a greatwood."]); }, "enter": (room, state) => { - + }, "exit": (room, state) => { - + }, "actions": [ { - name: "Tap", - desc: "Bang on the pepper shaker", - execute: (room, state) => { - print(["You thump the pepper shaker, making a dull thud."]); - checkSuspicion(state, 25); - }, - show: [ - - ], - conditions: [ - - ] + name: "Tap", + desc: "Bang on the pepper shaker", + execute: (room, state) => { + print(["You thump the pepper shaker, making a dull thud."]); + checkSuspicion(state, 25); + }, + show: [ + + ], + conditions: [ + + ] + }, + { + name: "Wait", + desc: "Wait for the fox to finish his breakfast. Surely you'll be able to escape after that...right?", + execute: (room, state) => { + state.info.time.value = 60 * 60 * 7 + 60 * 20; + }, + show: [ + + ], + conditions: [ + + ] }, ], "exits": { @@ -67,80 +120,80 @@ "target": "bowl", "desc": "Walk up to the cereal bowl", "show": [ - + ], "conditions": [ - + ], "hooks": [ (room, exit, state) => { - return checkSuspicion(state, 10); + return checkSuspicion(state, 10); } - + ] }, }, "hooks": [ - + ], "data": { "stats": { - + } } }, "bowl": { - "id": "bowl", - "name": "Behind the Bowl", - "desc": "You're crouched behind Geta's bowl of cereal", - "move": (room, state) => { - print(["You scurry up to the looming bowl, staying low and out of Geta's sight."]); - }, - "enter": (room, state) => { - - }, - "exit": (room, state) => { - - }, - "actions": [ - - ], - "exits": { - "ascend": { - "target": "in-bowl", - "desc": "Climb into Geta's cereal", - "show": [ - - ], - "conditions": [ - - ], - "hooks": [ - - ] - }, - "down": { - "target": "pepper-grinder", - "desc": "Run back behind the pepper grinder", - "show": [ - - ], - "conditions": [ - - ], - "hooks": [ - - ] - }, - }, - "hooks": [ - - ], - "data": { - "stats": { - + "id": "bowl", + "name": "Behind the Bowl", + "desc": "You're crouched behind Geta's bowl of cereal", + "move": (room, state) => { + print(["You scurry up to the looming bowl, staying low and out of Geta's sight."]); + }, + "enter": (room, state) => { + + }, + "exit": (room, state) => { + + }, + "actions": [ + + ], + "exits": { + "ascend": { + "target": "in-bowl", + "desc": "Climb into Geta's cereal", + "show": [ + + ], + "conditions": [ + + ], + "hooks": [ + + ] + }, + "down": { + "target": "pepper-grinder", + "desc": "Run back behind the pepper grinder", + "show": [ + + ], + "conditions": [ + + ], + "hooks": [ + + ] + }, + }, + "hooks": [ + + ], + "data": { + "stats": { + + } } - } }, "in-bowl": { "id": "in-bowl", @@ -148,6 +201,7 @@ "desc": "You're in the cereal bowl...", "move": (room, state) => { print(["Why did you do that?"]); + stopClassTimers("free", state); }, "enter": (room, state) => { startTimer({ @@ -161,31 +215,31 @@ goToRoom("maw", state); return false; } - + }, delay: 3000, loop: true, classes: [ - + ] }, state); - + }, "exit": (room, state) => { - + }, "actions": [ - + ], "exits": { - + }, "hooks": [ - + ], "data": { "stats": { - + } } }, @@ -194,7 +248,7 @@ "name": "Geta's Maw", "desc": "You've been slurped up into the fox's jaws", "move": (room, state) => { - + stopClassTimers("free", state); }, "enter": (room, state) => { startTimer({ @@ -207,26 +261,26 @@ delay: 5000, loop: false, classes: [ - + ] }, state); - + }, "exit": (room, state) => { - + }, "actions": [ - + ], "exits": { - + }, "hooks": [ - + ], "data": { "stats": { - + } } }, @@ -235,7 +289,7 @@ "name": "Geta's Gullet", "desc": "GULP!", "move": (room, state) => { - + }, "enter": (room, state) => { startTimer({ @@ -248,26 +302,38 @@ delay: 7000, loop: false, classes: [ - + ] }, state); - + }, "exit": (room, state) => { - + }, "actions": [ - + { + name: "Struggle", + desc: "Try to climb back out!", + execute: (room, state) => { + print(["Nope"]); + }, + show: [ + + ], + conditions: [ + + ] + }, ], "exits": { - + }, "hooks": [ - + ], "data": { "stats": { - + } } }, @@ -276,7 +342,7 @@ "name": "Geta's Stomach", "desc": "Glorp", "move": (room, state) => { - + }, "enter": (room, state) => { startTimer({ @@ -289,42 +355,42 @@ delay: 10000, loop: false, classes: [ - + ] }, state); - + }, "exit": (room, state) => { - + }, "actions": [ { - name: "Squirm", - desc: "Rub at the walls of the fox's churning stomach", - execute: (room, state) => { - printRandom([ - ["You punch and kick at the walls"], - ["A powerful churn grabs hold of you, stifling any attempts at struggling"], - ["Your little thumps and kicks do little to faze your captor"] - ]); - }, - show: [ - - ], - conditions: [ - - ] + name: "Squirm", + desc: "Rub at the walls of the fox's churning stomach", + execute: (room, state) => { + printRandom([ + ["You punch and kick at the walls"], + ["A powerful churn grabs hold of you, stifling any attempts at struggling"], + ["Your little thumps and kicks do little to faze your captor"] + ]); + }, + show: [ + + ], + conditions: [ + + ] }, ], "exits": { - + }, "hooks": [ - + ], "data": { "stats": { - + } } }, @@ -333,47 +399,47 @@ "name": "Fat", "desc": "You're just fat now", "move": (room, state) => { - + }, "enter": (room, state) => { - + }, "exit": (room, state) => { - + }, "actions": [ { - name: "Gurgle", - desc: "Glorp", - execute: (room, state) => { - printRandom([ - ["Grrrrgle"], - ["Glorp"], - ["Glrrrrrrnnnnnn..."], - ["Gwoooooorgle"] - ]); - }, - show: [ - - ], - conditions: [ - - ] + name: "Gurgle", + desc: "Glorp", + execute: (room, state) => { + printRandom([ + ["Grrrrgle"], + ["Glorp"], + ["Glrrrrrrnnnnnn..."], + ["Gwoooooorgle"] + ]); + }, + show: [ + + ], + conditions: [ + + ] }, ], "exits": { - + }, "hooks": [ - + ], "data": { "stats": { - + } } }, } }); - + })(); \ No newline at end of file