(() => { function checkSuspicion(state, add = 0) { const old = getStat("suspicion", state); if (add >= 0) { add *= state.geta.awareness; } changeStat("suspicion", add, state); if (getStat("suspicion", state) >= 100) { print(["Geta spots you!", "You're snatched up and tossed into the fox's bowl of cereal."]); goToRoom("in-bowl", state); return false; } else if (getStat("suspicion", state) >= 75 && old < 75) { print(["The fox is very suspicious. You're going to get caught if you keep this up..."]); } return true; } stories.push({ "id": "unaware-geta", "name": "Geta's Breakfast", "tags": [ "Player Prey", "Digestion", "Macro/Micro" ], "intro": { "start": "pepper-grinder", "setup": state => { state.geta = {}; state.geta.awareness = 1; state.player.stats.health = { name: "Health", type: "meter", value: 100, min: 0, max: 100, color: "rgb(255,55,55)" }; 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: "suspicion-decay", func: state => { checkSuspicion(state, -0.1); return true; }, delay: 100, loop: true, classes: [ "free" ] }, 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); startTimer({ id: "geta-action", func: state => { const random = Math.random(); if (random < 0.7) { print(["Geta slurps up a spoonful of cereal."]); } else if (random < 0.9) { state.geta.awareness = 0.1; print(["The fox yawns and stretches."]); startTimer({ id: "yawn-end", func: state => { print(["Geta finishes his stretch"]); state.geta.awareness = 1; return true; }, delay: 2000, loop: false, classes: [ "free" ] }, state); } else { state.geta.awareness = 2; print(["Geta narrows his eyes and looks around the table. Something seems off to him..."]); startTimer({ id: "squint-end", func: state => { print(["He goes back to his breakfast."]); state.geta.awareness = 1; return true; }, delay: 4000, loop: false, classes: [ "free" ] }, state); } return 5000 }, delay: 5000, loop: true, classes: [ "free" ] }, state); }, "intro": state => { print(["Game started", newline, "Exposition goes here later."]); } }, "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: [ ] }, { 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": { "up": { "target": "bowl", "desc": "Walk up to the cereal bowl", "show": [ ], "conditions": [ ], "hooks": [ (room, exit, state) => { return checkSuspicion(state, 10); } ] }, "left": { "target": "table", "desc": "Run out into the open", "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": [ ] }, }, "hooks": [ ], "data": { "stats": { } } }, "table": { "id": "table", "name": "Table", "desc": "You're out in the open!", "move": (room, state) => { }, "enter": (room, state) => { startTimer({ id: "table-suspicion", func: state => { checkSuspicion(state, 1.5); return true; }, delay: 100, loop: true, classes: [ "free" ] }, state); }, "exit": (room, state) => { stopTimer("table-suspicion", state); }, "actions": [ ], "exits": { "right": { "target": "pepper-grinder", "desc": "Run back to cover", "show": [ ], "conditions": [ ], "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?"]); }, "enter": (room, state) => { stopClassTimers("free", 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": [ ], "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) => { stopClassTimers("free", 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: "throat-swallow", 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": [ { name: "Struggle", desc: "Try to climb back out!", execute: (room, state) => { print(["Nope"]); }, show: [ ], conditions: [ ] }, { name: "Give up", desc: "Dive down into Geta's stomach", execute: (room, state) => { print(["You submit to your predator."]); goToRoom("stomach", state); stopTimer("throat-swallow", state); }, show: [ ], conditions: [ ] }, ], "exits": { }, "hooks": [ ], "data": { "stats": { } } }, "stomach": { "id": "stomach", "name": "Geta's Stomach", "desc": "Glorp", "move": (room, state) => { }, "enter": (room, state) => { startTimer({ id: "digest", func: state => { changeStat("health", -0.3, state); if (getStat("health", state) <= 0) { print(["You're digested before too long."]); goToRoom("digested", state); return false; } return true; }, delay: 100, loop: true, 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": { }, "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": { } } }, } }); })();