Procházet zdrojové kódy

Switch to using getStat in some places

geta
Fen Dweller před 6 roky
rodič
revize
38f83e0d19
1 změnil soubory, kde provedl 24 přidání a 6 odebrání
  1. +24
    -6
      stories/geta-unaware.js

+ 24
- 6
stories/geta-unaware.js Zobrazit soubor

@@ -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;


Načítá se…
Zrušit
Uložit