From 74ddfdb5ca7c88c7d0775ae491cbaf7a3bef344f Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 14 Apr 2020 22:08:49 -0400 Subject: [PATCH] Add some random noise to struggle progress. Hide the stat bar after swallowing --- stories/geta-unaware.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/stories/geta-unaware.js b/stories/geta-unaware.js index f146c0e..7c29e1a 100644 --- a/stories/geta-unaware.js +++ b/stories/geta-unaware.js @@ -466,15 +466,28 @@ state.geta.slurps = 0; state.geta.chews = 0; + startTimer({ + id: "maw-random-movement", + func: state => { + changeStat("mawPos", Math.random()/50 - 0.01, state); + return true; + }, + delay: 100, + loop: true, + classes: [ + "maw-struggle" + ] + }, state); + startTimer({ id: "maw-struggle", func: state => { - if (getStat("mawPos", state) <= 0) { + if (getStat("mawPos", state) <= 0.05) { print(["Swallowed!"]); goToRoom("throat", state); return false; - } else if (getStat("mawPos", state) >= 1) { + } else if (getStat("mawPos", state) >= 0.95) { print(["Chewed!"]); changeStat("health", -90, state); goToRoom("stomach", state); @@ -492,7 +505,7 @@ } if (choice == "swallow") { - if (getStat("mawPos", state) < 0.3) { + if (getStat("mawPos", state) < 0.15) { print(["Swallowed!"]); goToRoom("throat", state); return false; @@ -510,7 +523,7 @@ state.geta.slurps += 1; return Math.random() * 1000 + 1500; } else if (choice == "chew") { - if (getStat("mawPos", state) > 0.7) { + if (getStat("mawPos", state) > 0.85) { print(["Chewed!"]); changeStat("health", -90, state); goToRoom("stomach", state); @@ -526,7 +539,7 @@ delay: 0, loop: true, classes: [ - + "maw-struggle" ] }, state); @@ -588,6 +601,8 @@ state.player.stats.mawPos.hidden = true; + stopClassTimers("maw-struggle", state); + startTimer({ id: "throat-swallow", func: state => { @@ -657,6 +672,8 @@ }, "enter": (room, state) => { playLoop("loop/stomach.ogg"); + stopClassTimers("maw-struggle", state); + startTimer({ id: "digest", func: state => {