From a0ce0114d0d863f5dff4f65388b2798eb819755b Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 14 Apr 2020 22:03:21 -0400 Subject: [PATCH] Make the slurping/chewing/swallowing more predictable Slurps now come before chews, and there is a limit to both --- stories/geta-unaware.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/stories/geta-unaware.js b/stories/geta-unaware.js index b71315d..f146c0e 100644 --- a/stories/geta-unaware.js +++ b/stories/geta-unaware.js @@ -463,10 +463,12 @@ state.player.stats.mawPos.hidden = false; + state.geta.slurps = 0; + state.geta.chews = 0; + startTimer({ id: "maw-struggle", func: state => { - const choice = Math.random(); if (getStat("mawPos", state) <= 0) { print(["Swallowed!"]); @@ -479,7 +481,17 @@ return false; } - if (choice < 0.3) { + let choice; + + if (Math.random() > state.geta.slurps / 3) { + choice = "slurp"; + } else if (state.geta.chews - Math.floor(Math.random()*3) < state.geta.slurps) { + choice = "chew"; + } else { + choice = "swallow"; + } + + if (choice == "swallow") { if (getStat("mawPos", state) < 0.3) { print(["Swallowed!"]); goToRoom("throat", state); @@ -487,14 +499,17 @@ } else { print(["Swallows"]); changeStat("mawPos", -0.25, state); + state.geta.slurps = 0; + state.geta.chews = 0; return Math.random() * 1500 + 2500; } - } else if (choice < 0.7) { + } else if (choice == "slurp") { changeStat("mawPos", -0.1, state); print(["Slurps"]); + state.geta.slurps += 1; return Math.random() * 1000 + 1500; - } else { + } else if (choice == "chew") { if (getStat("mawPos", state) > 0.7) { print(["Chewed!"]); changeStat("health", -90, state); @@ -502,6 +517,7 @@ return false; } else { print(["Chews"]); + state.geta.chews += 1; return Math.random() * 500 + 1000; }