Parcourir la source

Switch to using getStat in some places

geta
Fen Dweller il y a 6 ans
Parent
révision
38f83e0d19
1 fichiers modifiés avec 24 ajouts et 6 suppressions
  1. +24
    -6
      stories/geta-unaware.js

+ 24
- 6
stories/geta-unaware.js Voir le fichier

@@ -1,10 +1,13 @@
(() => { (() => {
function checkSuspicion(state, add = 0) { 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."]); print(["Geta spots you!", "You're snatched up and tossed into the fox's bowl of cereal."]);
goToRoom("in-bowl", state); goToRoom("in-bowl", state);
return false; 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; return true;
@@ -40,6 +43,20 @@
] ]
}, state); }, state);


startTimer({
id: "suspicion-decay",
func: state => {
checkSuspicion(state, -0.1);
return true;
},
delay: 100,
loop: true,
classes: [
"free"
]
}, state);


startTimer({ startTimer({
id: "timeout", id: "timeout",
func: state => { func: state => {
@@ -64,7 +81,7 @@


}, },
"intro": state => { "intro": state => {
print(["Game started"]);
print(["Game started", "", "Exposition goes here later."]);
} }
}, },
"sounds": [ "sounds": [
@@ -202,9 +219,10 @@
"desc": "You're in the cereal bowl...", "desc": "You're in the cereal bowl...",
"move": (room, state) => { "move": (room, state) => {
print(["Why did you do that?"]); print(["Why did you do that?"]);
stopClassTimers("free", state);
}, },
"enter": (room, state) => { "enter": (room, state) => {
stopClassTimers("free", state);

startTimer({ startTimer({
id: "geta-eat", id: "geta-eat",
func: state => { func: state => {
@@ -364,9 +382,9 @@
startTimer({ startTimer({
id: "digest", id: "digest",
func: state => { 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."]); print(["You're digested before too long."]);
goToRoom("digested", state); goToRoom("digested", state);
return false; return false;


Chargement…
Annuler
Enregistrer