From 660dd9e6ead962d5bacfc7d49f0a045e3d5679ed Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 14 Apr 2020 18:14:04 -0400 Subject: [PATCH] Add a suspicion meter --- stories/geta-unaware.js | 673 +++++++++++++++++++++------------------- 1 file changed, 351 insertions(+), 322 deletions(-) diff --git a/stories/geta-unaware.js b/stories/geta-unaware.js index 255e4e6..86eb66f 100644 --- a/stories/geta-unaware.js +++ b/stories/geta-unaware.js @@ -1,350 +1,379 @@ -stories.push({ - "id": "unaware-geta", - "name": "Geta's Breakfast", - "tags": [ - "Player Prey", - "Digestion", - "Macro/Micro" - ], - "intro": { - "start": "pepper-grinder", - "setup": state => { - - }, - "intro": state => { - print(["Game started"]); +(() => { + 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."]); + goToRoom("in-bowl", state); + return false; } - }, - "sounds": [ - - ], - "preload": [ - - ], - "world": { - "pepper-grinder": { - "id": "pepper-grinder", - "name": "Pepper Grinder", - "desc": "You're hiding behind a pepper grinder", - "move": (room, state) => { - print(["You dart over to the pepper grinder, which looms over you like a greatwood."]); - }, - "enter": (room, state) => { + return true; + } + stories.push({ + "id": "unaware-geta", + "name": "Geta's Breakfast", + "tags": [ + "Player Prey", + "Digestion", + "Macro/Micro" + ], + "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)"}; }, - "exit": (room, state) => { - + "intro": state => { + print(["Game started"]); + } + }, + "sounds": [ + + ], + "preload": [ + + ], + "world": { + "pepper-grinder": { + "id": "pepper-grinder", + "name": "Pepper Grinder", + "desc": "You're hiding behind a pepper grinder", + "move": (room, state) => { + 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: [ + + ] + }, + ], + "exits": { + "up": { + "target": "bowl", + "desc": "Walk up to the cereal bowl", + "show": [ + + ], + "conditions": [ + + ], + "hooks": [ + (room, exit, state) => { + return checkSuspicion(state, 10); + } + + ] + }, + }, + "hooks": [ + + ], + "data": { + "stats": { + + } + } }, - "actions": [ - - ], - "exits": { - "up": { - "target": "bowl", - "desc": "Walk up to the cereal bowl", + "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": [ - + ] - }, - }, - "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": [ + + ] + }, }, - "down": { - "target": "pepper-grinder", - "desc": "Run back behind the pepper grinder", - "show": [ + "hooks": [ + + ], + "data": { + "stats": { + } + } + }, + "in-bowl": { + "id": "in-bowl", + "name": "Bowl", + "desc": "You're in the cereal bowl...", + "move": (room, state) => { + print(["Why did you do that?"]); + }, + "enter": (room, state) => { + startTimer({ + id: "geta-eat", + func: state => { + if (Math.random() < 0.6) { + print(["Geta scoops up a spoonful of cereal; you narrowly avoid being caught."]); + return true; + } else { + print(["Geta scoops you up and slurps you into his maw."]); + goToRoom("maw", state); + return false; + } + + }, + delay: 3000, + loop: true, + classes: [ + + ] + }, state); + + }, + "exit": (room, state) => { + + }, + "actions": [ + ], - "conditions": [ - - ], + "exits": { + + }, "hooks": [ - - ] - }, - }, - "hooks": [ - - ], - "data": { - "stats": { - - } - } - }, - "in-bowl": { - "id": "in-bowl", - "name": "Bowl", - "desc": "You're in the cereal bowl...", - "move": (room, state) => { - print(["Why did you do that?"]); + + ], + "data": { + "stats": { + + } + } }, - "enter": (room, state) => { - startTimer({ - id: "geta-eat", - func: state => { - if (Math.random() < 0.6) { - print(["Geta scoops up a spoonful of cereal; you narrowly avoid being caught."]); + "maw": { + "id": "maw", + "name": "Geta's Maw", + "desc": "You've been slurped up into the fox's jaws", + "move": (room, state) => { + + }, + "enter": (room, state) => { + startTimer({ + id: "swallow", + func: state => { + print(["It's too late to escape. You're swallowed down."]); + goToRoom("throat", state); return true; - } else { - print(["Geta scoops you up and slurps you into his maw."]); - goToRoom("maw", state); - return false; - } - - }, - delay: 3000, - loop: true, - classes: [ - - ] - }, state); - - }, - "exit": (room, state) => { - - }, - "actions": [ - - ], - "exits": { - - }, - "hooks": [ - - ], - "data": { - "stats": { - + }, + delay: 5000, + loop: false, + classes: [ + + ] + }, state); + + }, + "exit": (room, state) => { + + }, + "actions": [ + + ], + "exits": { + + }, + "hooks": [ + + ], + "data": { + "stats": { + + } } - } - }, - "maw": { - "id": "maw", - "name": "Geta's Maw", - "desc": "You've been slurped up into the fox's jaws", - "move": (room, state) => { - }, - "enter": (room, state) => { - startTimer({ - id: "swallow", - func: state => { - print(["It's too late to escape. You're swallowed down."]); - goToRoom("throat", state); - return true; - }, - delay: 5000, - loop: false, - classes: [ - - ] - }, state); - - }, - "exit": (room, state) => { - - }, - "actions": [ - - ], - "exits": { - - }, - "hooks": [ - - ], - "data": { - "stats": { - + "throat": { + "id": "throat", + "name": "Geta's Gullet", + "desc": "GULP!", + "move": (room, state) => { + + }, + "enter": (room, state) => { + startTimer({ + id: "gut", + func: state => { + print(["You slush down into Geta's stomach"]); + goToRoom("stomach", state); + return true; + }, + delay: 7000, + loop: false, + classes: [ + + ] + }, state); + + }, + "exit": (room, state) => { + + }, + "actions": [ + + ], + "exits": { + + }, + "hooks": [ + + ], + "data": { + "stats": { + + } } - } - }, - "throat": { - "id": "throat", - "name": "Geta's Gullet", - "desc": "GULP!", - "move": (room, state) => { - }, - "enter": (room, state) => { - startTimer({ - id: "gut", - func: state => { - print(["You slush down into Geta's stomach"]); - goToRoom("stomach", state); - return true; + "stomach": { + "id": "stomach", + "name": "Geta's Stomach", + "desc": "Glorp", + "move": (room, state) => { + + }, + "enter": (room, state) => { + startTimer({ + id: "digest", + func: state => { + print(["You're digested before too long."]); + goToRoom("digested", state); + return true; + }, + 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: [ + + ] }, - delay: 7000, - loop: false, - classes: [ - - ] - }, state); - - }, - "exit": (room, state) => { - - }, - "actions": [ - - ], - "exits": { - - }, - "hooks": [ - - ], - "data": { - "stats": { - + ], + "exits": { + + }, + "hooks": [ + + ], + "data": { + "stats": { + + } } - } - }, - "stomach": { - "id": "stomach", - "name": "Geta's Stomach", - "desc": "Glorp", - "move": (room, state) => { - }, - "enter": (room, state) => { - startTimer({ - id: "digest", - func: state => { - print(["You're digested before too long."]); - goToRoom("digested", state); - return true; + "digested": { + "id": "digested", + "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: [ + + ] }, - 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: [ - - ] + ], + "exits": { + }, - ], - "exits": { - - }, - "hooks": [ - - ], - "data": { - "stats": { - + "hooks": [ + + ], + "data": { + "stats": { + + } } - } - }, - "digested": { - "id": "digested", - "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: [ - - ] - }, - ], - "exits": { - }, - "hooks": [ - - ], - "data": { - "stats": { - - } - } - }, - } -}); + } + }); + +})(); \ No newline at end of file