an http based roguelike rpg about jelqing
Commit 8599b930cebf
tarball1 file changed+9-4
@@ -59,7 +59,10 @@ let excuses = [];
5959
let nonce = null;6060
let inventorySeq = 0;6161
const STATS = [62
+ ["x-turn", "Turn"],63
+ ["x-floor-turn", "Floor turn"],6264
["x-floor", "Floor"],65
+ ["x-cash", "Cash"],6366
["x-self-reported-length", "Self-reported length"],6467
["x-girth", "Girth"],6568
["x-foreskin", "Foreskin"],@@ -68,7 +71,6 @@ const STATS = [
6871
["x-stamina", "Stamina"],6972
["x-suspicion", "Suspicion"],7073
["x-shame", "Shame"],71
- ["x-cash", "Cash"],7274
];7375
const MEASURED = ["x-length", "Length"];7476
const GROWTH = new Set(["x-length", "x-self-reported-length", "x-girth", "x-foreskin"]);@@ -221,7 +223,8 @@ function renderStats(headers) {
221223
const cell = el("td", {}, value === undefined ? "—" : value);222224
const changed = value === undefined ? null : change(name, value);223225
if (changed) cell.append(" ", changed);224
- row.append(el("th", { align: "left", textContent: label }), cell);226
+ const measured = name === MEASURED[0] && "x-self-reported-length" in lastStats;227
+ row.append(el("th", { align: "left", textContent: label, style: measured ? "color: green" : "" }), cell);225228
}226229
table.append(row);227230
}@@ -234,7 +237,7 @@ function fromIdeal(arousal) {
234237
235238
function change(name, value) {236239
const before = lastStats[name];237
- if (before === undefined || before === value) return null;240
+ if (before === undefined || before === value || !(name in BETTER || name === "x-eq")) return null;238241
if (name === "x-eq") {239242
const closer = Math.sign(fromIdeal(before) - fromIdeal(value));240243
const was = el("b", { textContent: before, style: closer ? "color: " + (closer > 0 ? "green" : "red") : "" });@@ -250,14 +253,16 @@ function renderAlerts(list) {
250253
const box = $("alerts");251254
box.replaceChildren();252255
const alerts = [];256
+ let door = null;253257
for (const [name, value] of list || []) {254
- if (name === "via") alerts.push(titled(value.split(" ").pop()) + " is at the door.");258
+ if (name === "via") door = titled(value.split(" ").pop()) + " is at the door.";255259
if (name === "x-observed-by") alerts.push((value === "cat" ? "The cat" : titled(value)) + " is watching.");256260
if (name === "warning") {257261
const text = (value.match(/"([^"]*)"/) || [, value])[1];258262
alerts.push(titled(text) + (/[.!?]$/.test(text) ? "" : "."));259263
}260264
}265
+ if (door && !alerts.some(a => a.startsWith(door))) alerts.unshift(door);261266
const stamina = (list || []).find(([name]) => name === "x-stamina");262267
if (stamina && stamina[1].startsWith("0/")) alerts.push("Exhausted. HOLD for the refractory period.");263268
for (const alert of alerts) box.append(el("h2", { textContent: alert }));