From 38f83e0d19978811da3c8b5b0e5e5a61f66d39a1 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 14 Apr 2020 19:34:01 -0400 Subject: [PATCH] Switch to using getStat in some places --- stories/geta-unaware.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/stories/geta-unaware.js b/stories/geta-unaware.js index 6a7de05..7038e44 100644 --- a/stories/geta-unaware.js +++ b/stories/geta-unaware.js @@ -1,10 +1,13 @@ (() => { function checkSuspicion(state, add = 0) { - state.player.stats.suspicion.value += add; - if (state.player.stats.suspicion.value >= 100) { + const old = getStat("suspicion", state); + 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; @@ -40,6 +43,20 @@ ] }, 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 => { @@ -64,7 +81,7 @@ }, "intro": state => { - print(["Game started"]); + print(["Game started", "", "Exposition goes here later."]); } }, "sounds": [ @@ -202,9 +219,10 @@ "desc": "You're in the cereal bowl...", "move": (room, state) => { print(["Why did you do that?"]); - stopClassTimers("free", state); }, "enter": (room, state) => { + stopClassTimers("free", state); + startTimer({ id: "geta-eat", func: state => { @@ -364,9 +382,9 @@ startTimer({ id: "digest", func: state => { - state.player.stats.health.value -= 0.3; + changeStat("health", -0.3, state); - if (state.player.stats.health.value <= 0) { + if (getStat("health", state) <= 0) { print(["You're digested before too long."]); goToRoom("digested", state); return false;