an http based roguelike rpg about jelqing
Commit aef6f6498ea2
tarball4 files changed+20-12
@@ -2,7 +2,7 @@ use axum::http::{StatusCode, header};
22
use serde_json::json;33
44
use super::{5
- Cause, Floor, Item, Outcome, Run, Story,5
+ Cause, Floor, Item, Notice, Outcome, Run, Story,66
balance::{77
CAUGHT_MELONED, COCONUT_ODDS, ENERGY_ODDS, KETTLE_ODDS, KITCHEN_ICE_ODDS, KITCHEN_TOLD,88
MELON_SHAME, RAID_NOISE, RUPTURE_LINE, WATERMELON,@@ -75,6 +75,11 @@ impl Run {
7575
) {7676
self.here.kitchen.closed = true;7777
self.end_kitchen_visit();78
+ self.notices.push(if self.floor == Floor::Nans {79
+ Notice::StopRaidingTheFridge80
+ } else {81
+ Notice::StopRaidingTheKitchen82
+ });7883
return Err(self.off_limits());7984
}8085
if melon {@@ -85,12 +90,11 @@ impl Run {
8590
}8691
8792
fn off_limits(&self) -> Problem {88
- let detail = if self.floor == Floor::Nans {89
- "Stop raiding the fridge. The kitchen is off limits."90
- } else {91
- "Stop raiding the kitchen. The kitchen is off limits."92
- };93
- Problem::new(StatusCode::GONE, "kitchen-off-limits", detail)93
+ Problem::new(94
+ StatusCode::GONE,95
+ "kitchen-off-limits",96
+ "The kitchen is off limits.",97
+ )9498
}9599
96100
fn unpack(&mut self, loot: usize) -> Outcome {@@ -4,6 +4,8 @@ pub enum Notice {
44
BrotherTriedTheDoor,55
GymStaffLeaveIt,66
HousekeepingReadTheSign,7
+ StopRaidingTheKitchen,8
+ StopRaidingTheFridge,79
KevIsTheBar,810
DrawerJammed,911
DrawerComesLoose,@@ -19,6 +21,8 @@ impl Notice {
1921
Self::BrotherTriedTheDoor => "your brother tried the door",2022
Self::GymStaffLeaveIt => "the gym staff have seen worse, and they leave it there",2123
Self::HousekeepingReadTheSign => "housekeeping read the sign",24
+ Self::StopRaidingTheKitchen => "Stop raiding the kitchen.",25
+ Self::StopRaidingTheFridge => "Stop raiding the fridge.",2226
Self::KevIsTheBar => "Kev is 8 inches, he says. Nobody asked you, which is worse.",2327
Self::DrawerJammed => "The drawer has jammed.",2428
Self::DrawerComesLoose => "The drawer comes loose. That took a while.",@@ -355,11 +355,11 @@ async fn one_telling_closes_the_kitchen_and_its_link() {
355355
}356356
let told = told.expect("a noisy house tells within twenty raids");357357
assert!(358
- json(told).await["detail"]359
- .as_str()360
- .unwrap()361
- .starts_with("Stop raiding the kitchen.")358
+ warnings(&told)359
+ .iter()360
+ .any(|w| w.contains("Stop raiding the kitchen."))362361
);362
+ assert_eq!(json(told).await["detail"], "The kitchen is off limits.");363363
let view = send(&app, "GET", "/runs/cafebabe", &[], "").await;364364
assert!(!header(&view, "link").contains("/kitchen"));365365
}@@ -230,7 +230,7 @@ function renderAlerts(list) {
230230
if (name === "x-observed-by") alerts.push((value === "cat" ? "The cat" : titled(value)) + " is watching.");231231
if (name === "warning") {232232
const text = (value.match(/"([^"]*)"/) || [, value])[1];233
- alerts.push(titled(text) + ".");233
+ alerts.push(titled(text) + (/[.!?]$/.test(text) ? "" : "."));234234
}235235
}236236
const stamina = (list || []).find(([name]) => name === "x-stamina");