From 1e1f002f9668dfa338360e7b94f58f3768099535 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Wed, 15 Apr 2020 10:11:09 -0400 Subject: [PATCH] Let Geta tilt back his muzzle d uring the maw struggle. Remove the id argument from statLerp statLerp now generates a random id, which should prevent collisions. --- stories/geta-unaware.js | 45 +++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/stories/geta-unaware.js b/stories/geta-unaware.js index c575610..96f106a 100644 --- a/stories/geta-unaware.js +++ b/stories/geta-unaware.js @@ -32,7 +32,9 @@ }).length; } - function statLerp(id, stat, change, duration) { + function statLerp(stat, change, duration) { + // pretty sure this'll be a random id... + const id = new Date().getTime() + Math.random(); const iterations = duration / 1000 * 60; startTimer({ id: id, @@ -569,8 +571,12 @@ let choice; - if (Math.random() < 0.1) { - choice = "slosh"; + if (Math.random() < 0.2) { + const choices = [ + "slosh", + "tilt-back" + ]; + choice = choices[Math.floor(Math.random() * choices.length)]; } else if (Math.random() > state.geta.slurps / 3) { choice = "slurp"; } else if (state.geta.chews - Math.floor(Math.random() * 3) < state.geta.slurps) { @@ -586,7 +592,7 @@ return false; } else { print(["Swallows"]); - statLerp("maw-swallow", "mawPos", -0.25, 500); + statLerp("mawPos", -0.25, 500); state.geta.slurps = 0; state.geta.chews = 0; state.geta.swallowsLeft -= 1; @@ -594,7 +600,7 @@ } } else if (choice == "slurp") { - statLerp("maw-swallow", "mawPos", -0.1, 250); + statLerp("mawPos", -0.1, 250); print(["Slurps"]); state.geta.slurps += 1; return Math.random() * 1000 + 1500; @@ -637,6 +643,29 @@ }); return Math.random() * 1500 + 4500; + } else if (choice == "tilt-back") { + print(["Geta tilts his head back, sending rivults of slobber flowing down into that yawning gullet."]); + state.geta.mawMovement = 0.2; + statLerp("mawPos", -1, 4000); + + startTimer({ + id: "maw-tilt-text", + func: () => { + print(["The fox's muzzle tilts back down as he SWALLOWS hard."]); + statLerp("mawPos", -0.3, 500); + state.geta.swallowsLeft -= 1; + state.geta.slurps = 0; + state.geta.chews = 0; + return true; + }, + delay: 4000, + loop: false, + classes: [ + + ] + }); + + return 5000 + Math.random() * 1000; } }, delay: 0, @@ -675,7 +704,7 @@ desc: "Pull yourself away from the fox's throat! Just don't go too far forward...", execute: (room) => { print(["You drag yourself forward"]); - statLerp("maw-swallow", "mawPos", 0.15 + Math.random() * 0.05, 250); + statLerp("mawPos", 0.15 + Math.random() * 0.05, 250); }, show: [ @@ -690,10 +719,10 @@ execute: (room) => { if (Math.random() < 0.9){ print(["You let yourself slip back."]); - statLerp("maw-swallow", "mawPos", -0.2 - Math.random() * 0.1, 250); + statLerp("mawPos", -0.2 - Math.random() * 0.1, 250); } else { print(["You lose your grip, sliding back quite far!"]); - statLerp("maw-swallow", "mawPos", -0.3 - Math.random() * 0.15, 250); + statLerp("mawPos", -0.3 - Math.random() * 0.15, 250); } },