an http based roguelike rpg about jelqing
Blame: src/game/hazards.rs
782069860236 | atagen | 2026-10-10 12:44 UTC | 1 | use std::{ops::ControlFlow, time::SystemTime}; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 2 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 3 | use axum::http::{StatusCode, header}; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 4 | use serde_json::json; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 5 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 6 | use super::{ |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 7 | Cause, Floor, Notice, Outcome, Run, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 8 | balance::{ |
4b1f5f88827d | atagen | 2026-10-13 10:18 UTC | 9 | BURN_RUPTURE, COLD_DEGLOVING, COLD_EQ, CURVE_MISSES, DANGER_EQ, DEGLOVING, |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 10 | DEGLOVING_INTENSITY, EQ_BAND, FRICTION_MAX, FRICTION_TEAR, FRIEND, HOT_EQ, LOST_IT_EQ, |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 11 | PREMATURE_EQ, RAW_DEGLOVING, RUPTURE_HOT, RUPTURE_IN_BAND, RUPTURE_PREMATURE, RUPTURE_WARM, |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 12 | SOFT_INTENSITY, SUSPICION_LIMIT, WANDERER_VISIT, WINDOW, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 13 | }, |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 14 | measure::round3, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 15 | techniques::Training, |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 16 | travel::Exit, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 17 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 18 | use crate::problem::Problem; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 19 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 20 | type Interruption = Result<ControlFlow<Outcome>, Problem>; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 21 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 22 | impl Run { |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 23 | /// EQ with a friction burn dragging every line down. |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 24 | pub(super) fn heat(&self) -> i32 { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 25 | let burn = if self.body.conditions.friction_burn { |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 26 | BURN_RUPTURE |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 27 | } else { |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 28 | 0 |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 29 | }; |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 30 | self.body.eq + burn |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 31 | } |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 32 | |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 33 | pub(super) fn hotter_than(&self, line: i32) -> bool { |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 34 | self.heat() > line |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 35 | } |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 36 | |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 37 | /// Ruptures go by the cooler of now and the turn's start, so a line crossed this turn cannot rupture |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 38 | /// before `X-EQ` has had a chance to name it. |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 39 | pub(super) fn risked(&self, line: i32) -> bool { |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 40 | self.heat().min(self.body.heat_at_turn_start) > line |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 41 | } |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 42 | |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 43 | /// The rupture tier for any turn that is not a jelq, so never the premature band's 1 in 3. |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 44 | pub(super) fn rupture_odds(&self) -> u32 { |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 45 | if !self.risked(DANGER_EQ) { |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 46 | RUPTURE_IN_BAND |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 47 | } else if !self.risked(HOT_EQ) { |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 48 | RUPTURE_WARM |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 49 | } else { |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 50 | RUPTURE_HOT |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 51 | } |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 52 | } |
b85a0d4536c3 | atagen | 2026-10-11 08:50 UTC | 53 | |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 54 | pub(super) fn cold(&self) -> bool { |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 55 | self.body.eq < COLD_EQ |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 56 | } |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 57 | |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 58 | pub(super) fn mishaps( |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 59 | &mut self, |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 60 | training: Training, |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 61 | intensity: i32, |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 62 | cold: bool, |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 63 | ) -> Interruption { |
bf5f8cb6f60f | atagen | 2026-10-13 12:10 UTC | 64 | if cold { |
4b1f5f88827d | atagen | 2026-10-13 10:18 UTC | 65 | if !self.notices.contains(&Notice::ColdStart) { |
4b1f5f88827d | atagen | 2026-10-13 10:18 UTC | 66 | self.notices.push(Notice::ColdStart); |
4b1f5f88827d | atagen | 2026-10-13 10:18 UTC | 67 | } |
4b1f5f88827d | atagen | 2026-10-13 10:18 UTC | 68 | if self.chance( |
4b1f5f88827d | atagen | 2026-10-13 10:18 UTC | 69 | self.decision("cold-degloving", "Cold and unprepared, does the skin tear?"), |
4b1f5f88827d | atagen | 2026-10-13 10:18 UTC | 70 | COLD_DEGLOVING, |
4b1f5f88827d | atagen | 2026-10-13 10:18 UTC | 71 | ) { |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 72 | return Err(self.deglove()); |
4b1f5f88827d | atagen | 2026-10-13 10:18 UTC | 73 | } |
4b1f5f88827d | atagen | 2026-10-13 10:18 UTC | 74 | } |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 75 | if self.body.friction >= FRICTION_MAX { |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 76 | self.tear()?; |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 77 | } |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 78 | if training == Training::Dry |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 79 | && intensity >= DEGLOVING_INTENSITY |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 80 | && self.chance( |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 81 | self.decision("degloving", "Dry at this intensity, does the skin tear?"), |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 82 | DEGLOVING, |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 83 | ) |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 84 | { |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 85 | return Err(self.deglove()); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 86 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 87 | Ok(ControlFlow::Continue(())) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 88 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 89 | |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 90 | fn tear(&mut self) -> Result<(), Problem> { |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 91 | if !self.notices.contains(&Notice::SkinGivingWay) { |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 92 | self.notices.push(Notice::SkinGivingWay); |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 93 | } |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 94 | match self.body.foreskin { |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 95 | Some(left) if left - FRICTION_TEAR > 1e-9 => { |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 96 | self.body.foreskin = Some(left - FRICTION_TEAR); |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 97 | self.body.torn += FRICTION_TEAR; |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 98 | Ok(()) |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 99 | } |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 100 | Some(left) => { |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 101 | self.body.foreskin = None; |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 102 | self.standing.shame += 25; |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 103 | Err(Problem::new( |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 104 | StatusCode::GONE, |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 105 | "foreskin-lost", |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 106 | "The friction has removed the foreskin. It will not be returning.", |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 107 | ) |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 108 | .with("foreskin", -round3(left)) |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 109 | .header(header::CONTENT_LOCATION, self.path("/foreskin"))) |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 110 | } |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 111 | None => { |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 112 | if self.chance( |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 113 | self.decision("raw-degloving", "Rubbed raw, does the skin tear?"), |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 114 | RAW_DEGLOVING, |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 115 | ) { |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 116 | return Err(self.deglove()); |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 117 | } |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 118 | Ok(()) |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 119 | } |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 120 | } |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 121 | } |
3ac624339c98 | atagen | 2026-10-13 12:21 UTC | 122 | |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 123 | fn deglove(&mut self) -> Problem { |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 124 | let lost = self.body.foreskin.take(); |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 125 | let problem = self.end(Cause::Degloved); |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 126 | match lost { |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 127 | Some(lost) => problem.with("foreskin", -round3(lost)), |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 128 | None => problem, |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 129 | } |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 130 | } |
97c05b741d8f | atagen | 2026-10-13 11:27 UTC | 131 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 132 | pub(super) fn hazards(&mut self, intensity: i32) -> Interruption { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 133 | if !self.hotter_than(PREMATURE_EQ) |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 134 | && self.chance( |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 135 | self.decision("rupture", "Does this jelq rupture something?"), |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 136 | self.rupture_odds(), |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 137 | ) |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 138 | { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 139 | return Err(self.rupture()); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 140 | } |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 141 | if self.floor.has_window() |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 142 | && !self.items.kit.blinds |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 143 | && self.oracle.chance_not( |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 144 | self.decision("window", "Are the curtains still closed?"), |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 145 | WINDOW, |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 146 | ) |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 147 | { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 148 | self.standing.shame += 30; |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 149 | self.online.filmed_at.get_or_insert_with(SystemTime::now); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 150 | return Ok(ControlFlow::Break( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 151 | Outcome::json( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 152 | StatusCode::CREATED, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 153 | json!({ "detail": "A neighbour was at the window. A recording has been created. It has been shared." }), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 154 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 155 | .header(header::LOCATION, self.path("/footage")), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 156 | )); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 157 | } |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 158 | if self.floor == Floor::ChangingRoom |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 159 | && self.chance( |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 160 | self.decision("friend", "Does a friend walk in and offer to help?"), |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 161 | FRIEND, |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 162 | ) |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 163 | { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 164 | self.standing.shame += 1; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 165 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 166 | StatusCode::USE_PROXY, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 167 | "friend", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 168 | "A friend has offered to help. Use Proxy is deprecated, and the server has declined on your behalf.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 169 | )); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 170 | } |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 171 | if self.body.conditions.peyronie |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 172 | && self.chance( |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 173 | self.decision( |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 174 | "misdirected", |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 175 | "With the curve, does the stroke land sharply to the left?", |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 176 | ), |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 177 | CURVE_MISSES, |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 178 | ) |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 179 | { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 180 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 181 | StatusCode::MISDIRECTED_REQUEST, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 182 | "misdirected", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 183 | "The technique landed slightly to the left. It was meant for a different server.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 184 | )); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 185 | } |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 186 | if intensity <= SOFT_INTENSITY && self.body.eq < *EQ_BAND.start() { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 187 | self.body.eq = (self.body.eq - LOST_IT_EQ).max(0); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 188 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 189 | StatusCode::REQUEST_TIMEOUT, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 190 | "lost-it", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 191 | "The request took too long. It was lost.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 192 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 193 | .header(header::CONNECTION, "close")); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 194 | } |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 195 | if self.hotter_than(PREMATURE_EQ) { |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 196 | if self.risked(PREMATURE_EQ) |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 197 | && self.chance( |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 198 | self.decision( |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 199 | "rupture", |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 200 | "Right at the edge of finishing, does it rupture instead?", |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 201 | ), |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 202 | RUPTURE_PREMATURE, |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 203 | ) |
53bce0d93000 | atagen | 2026-10-14 13:39 UTC | 204 | { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 205 | return Err(self.rupture()); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 206 | } |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 207 | self.standing.shame += 5; |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 208 | self.next_floor(Exit::Premature); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 209 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 210 | StatusCode::TOO_EARLY, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 211 | "premature", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 212 | "The floor has ended early. Everyone involved has agreed not to discuss it.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 213 | )); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 214 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 215 | Ok(ControlFlow::Continue(())) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 216 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 217 | |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 218 | /// The enemies suspicion summons on floors without Mum. |
782069860236 | atagen | 2026-10-10 12:44 UTC | 219 | pub(super) fn floor_enemy(&mut self) -> Result<(), Problem> { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 220 | let visits = u32::from(self.standing.suspicion) + 1; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 221 | let wanders_in = matches!(self.floor, Floor::Bathroom | Floor::Hotel) |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 222 | && self.oracle.ratio_choice( |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 223 | self.decision("wanderer", "Does anyone else come through the door?"), |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 224 | visits, |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 225 | WANDERER_VISIT, |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 226 | "No", |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 227 | "Yes", |
3f9091557ec3 | atagen | 2026-10-11 11:43 UTC | 228 | ); |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 229 | if self.standing.suspicion < SUSPICION_LIMIT && !wanders_in { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 230 | return Ok(()); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 231 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 232 | match self.floor { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 233 | Floor::Bathroom => { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 234 | self.standing.suspicion = 0; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 235 | self.touch(); |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 236 | if self.items.stores.door_locks > 0 { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 237 | self.items.stores.door_locks -= 1; |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 238 | self.notices.push(Notice::BrotherTriedTheDoor); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 239 | return Ok(()); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 240 | } |
7d3fb63208bf | atagen | 2026-10-11 04:38 UTC | 241 | self.here.brother_told = true; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 242 | Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 243 | StatusCode::CONFLICT, |
7d3fb63208bf | atagen | 2026-10-11 04:38 UTC | 244 | "brother", |
7d3fb63208bf | atagen | 2026-10-11 04:38 UTC | 245 | "Your brother needs the bathroom. He will tell Mum.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 246 | )) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 247 | } |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 248 | Floor::ChangingRoom => { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 249 | self.standing.suspicion = 0; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 250 | self.touch(); |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 251 | if self.girth_respected() { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 252 | self.notices.push(Notice::GymStaffLeaveIt); |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 253 | return Ok(()); |
058650ec79d6 | atagen | 2026-10-12 10:49 UTC | 254 | } |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 255 | self.standing.shame += 5; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 256 | Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 257 | StatusCode::UNAVAILABLE_FOR_LEGAL_REASONS, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 258 | "gym-staff", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 259 | "Gym staff have been notified. The server cannot serve this request for legal reasons.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 260 | )) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 261 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 262 | Floor::Hotel => { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 263 | self.standing.suspicion = 0; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 264 | self.touch(); |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 265 | if self.items.kit.dnd_sign { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 266 | self.notices.push(Notice::HousekeepingReadTheSign); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 267 | return Ok(()); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 268 | } |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 269 | self.standing.shame += 3; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 270 | Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 271 | StatusCode::UNAUTHORIZED, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 272 | "housekeeping", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 273 | "Housekeeping has entered. Housekeeping accepts no excuses.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 274 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 275 | .header(header::WWW_AUTHENTICATE, "Excuse realm=\"housekeeping\"")) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 276 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 277 | _ => Ok(()), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 278 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 279 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 280 | } |