ソースを参照

Tell the player how long they survived (fen-snack)

tags/v0.1.2
Fen Dweller 5年前
コミット
f4cc337b78
1個のファイルの変更30行の追加0行の削除
  1. +30
    -0
      stories/fen-snack.js

+ 30
- 0
stories/fen-snack.js ファイルの表示

@@ -95,6 +95,36 @@ stories.push({
if (state.player.stats.health.value <= 0) {
state.player.stats.health.value = 0;

const start = 86400 - 60 * 25 - 25;
const end = state.info.time.value;

const time_survived = end - start;
const minutes = Math.floor(time_survived / 60);
const seconds = time_survived % 60;
const minute_text = minutes + (minutes == 1 ? " minute" : " minutes");
const second_text = seconds + (seconds == 1 ? " second" : " seconds");

let time_text;

if (minutes == 0)
time_text = "You survived for " + second_text + ".";
else
time_text = "You survived for " + minute_text + " and " + second_text + ".";

startTimer({
id: "time-text",
func: state => {
print([time_text]);
return true;
},
delay: 2000,
loop: false,
classes: [
]
}, state);

if (location.startsWith("stomach")) {
goToRoom("digested-stomach", state);
}


読み込み中…
キャンセル
保存