an http based roguelike rpg about jelqing
Blame: src/game/turn.rs
782069860236 | atagen | 2026-10-10 12:44 UTC | 1 | use std::{fmt::Write as _, ops::ControlFlow, time::Instant}; |
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 rand::Rng; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 5 | use serde_json::json; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 6 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 7 | use super::{ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 8 | Floor, Grip, LUBRICANTS, Lube, Outcome, Payload, Run, Story, Technique, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 9 | balance::{ |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 10 | ARRIVAL_BONUS, BAND_BONUS, BRANCH_TURN, BURN_RUPTURE, CAT_TAKES_TOWEL, CHANGING_ROOM_CHILL, |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 11 | DANGER_EQ, EQ_BAND, EQ_WOBBLE, EXTENDER_GAIN, FRICTION_BURN, FRICTION_BURN_AT, |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 12 | FRICTION_DRY, FRICTION_GRIP, FRICTION_HOLD, FRICTION_MAX, FRICTION_MEDITATE, FRICTION_SPIT, |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 13 | GREED_HOT, GREED_WARM, HOLD_EQ, HOT_EQ, MEDITATION_EQ, OBSERVED, PRIAPISM_EQ, |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 14 | PRIAPISM_TURNS, PULLED_MUSCLE, PULLED_MUSCLE_INTENSITY, REFLECTION, RING_PRIAPISM, |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 15 | RING_RUPTURE_LINE, RUPTURE_LINE, STORAGE_GIRTH, SUSPICION_LIMIT, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 16 | }, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 17 | not_extended, round3, |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 18 | state::{MumVisit, Observer, Pending}, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 19 | techniques::{LubeRule, Profile, Training, Utility}, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 20 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 21 | use crate::{headers::SERVER_TIMING, problem::Problem}; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 22 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 23 | impl Run { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 24 | pub fn jelq( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 25 | &mut self, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 26 | techniques: &[Technique], |
782069860236 | atagen | 2026-10-10 12:44 UTC | 27 | intensity: i32, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 28 | lube: Option<Lube>, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 29 | now: Instant, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 30 | ) -> Result<Outcome, Problem> { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 31 | self.check_refractory(now)?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 32 | if self.story == Story::Pending { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 33 | return Ok(self.branch_offer()); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 34 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 35 | if self.floor == Floor::Forum { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 36 | return Ok(Outcome::json( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 37 | StatusCode::SEE_OTHER, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 38 | json!({ "detail": "Refer to the forum." }), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 39 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 40 | .header(header::LOCATION, super::FORUM_THREAD)); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 41 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 42 | if self.items.cage { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 43 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 44 | StatusCode::LOCKED, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 45 | "caged", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 46 | "The cage is locked. The key is not in the box.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 47 | )); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 48 | } |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 49 | self.here.shopping = false; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 50 | match *techniques { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 51 | [Technique::Utility(utility)] => self.utility(utility, lube, now), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 52 | [Technique::Training(training)] => self.single(training, intensity, lube, now), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 53 | [Technique::Training(a), Technique::Training(b)] => { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 54 | self.combo(a, b, intensity, lube, now) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 55 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 56 | [_, _] => Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 57 | StatusCode::BAD_REQUEST, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 58 | "combo-invalid", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 59 | "Only training techniques can be combined.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 60 | )), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 61 | _ => Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 62 | StatusCode::BAD_REQUEST, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 63 | "too-many-techniques", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 64 | "Two techniques at most. The server has limits even if you do not.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 65 | )), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 66 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 67 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 68 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 69 | fn utility( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 70 | &mut self, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 71 | utility: Utility, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 72 | lube: Option<Lube>, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 73 | now: Instant, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 74 | ) -> Result<Outcome, Problem> { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 75 | match utility { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 76 | Utility::Warmup => return self.warm_up(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 77 | Utility::Ice => return self.ice(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 78 | Utility::Supplement => return self.supplement(), |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 79 | Utility::Meditate => return self.meditate(), |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 80 | Utility::Energy => return self.energy(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 81 | Utility::Edge | Utility::Pump => {} |
782069860236 | atagen | 2026-10-10 12:44 UTC | 82 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 83 | if utility == Utility::Pump { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 84 | self.here.edges = 0; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 85 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 86 | self.ready(Technique::Utility(utility), lube)?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 87 | self.check_storage()?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 88 | self.floor_enemy()?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 89 | match utility { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 90 | Utility::Edge => self.edge(now), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 91 | _ => self.pump(now), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 92 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 93 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 94 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 95 | fn single( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 96 | &mut self, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 97 | training: Training, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 98 | intensity: i32, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 99 | lube: Option<Lube>, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 100 | now: Instant, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 101 | ) -> Result<Outcome, Problem> { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 102 | self.here.edges = 0; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 103 | self.ready(Technique::Training(training), lube)?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 104 | self.check_storage()?; |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 105 | self.lube_available(lube)?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 106 | self.floor_enemy()?; |
139164489032 | atagen | 2026-10-11 05:46 UTC | 107 | self.take_lube(lube)?; |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 108 | self.chafe(lube); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 109 | self.commit(intensity, lube, now, 1); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 110 | if let ControlFlow::Break(interrupted) = self.mishaps(training, intensity)? { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 111 | return Ok(interrupted); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 112 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 113 | if let ControlFlow::Break(interrupted) = self.hazards(intensity)? { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 114 | return Ok(interrupted); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 115 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 116 | let outcome = self.roll(training, intensity, lube)?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 117 | Ok(self.gossip(outcome)) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 118 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 119 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 120 | fn combo( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 121 | &mut self, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 122 | a: Training, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 123 | b: Training, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 124 | intensity: i32, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 125 | lube: Option<Lube>, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 126 | now: Instant, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 127 | ) -> Result<Outcome, Problem> { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 128 | if a == b { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 129 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 130 | StatusCode::BAD_REQUEST, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 131 | "combo-invalid", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 132 | "A technique cannot be combined with itself. The server has checked.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 133 | )); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 134 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 135 | self.here.edges = 0; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 136 | self.ready(Technique::Training(a), lube)?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 137 | self.ready(Technique::Training(b), lube)?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 138 | self.check_storage()?; |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 139 | self.lube_available(lube)?; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 140 | self.floor_enemy()?; |
139164489032 | atagen | 2026-10-11 05:46 UTC | 141 | self.take_lube(lube)?; |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 142 | self.chafe(lube); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 143 | self.commit(intensity, lube, now, 2); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 144 | for training in [a, b] { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 145 | if let ControlFlow::Break(interrupted) = self.mishaps(training, intensity)? { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 146 | return Ok(interrupted); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 147 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 148 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 149 | if let ControlFlow::Break(interrupted) = self.hazards(intensity)? { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 150 | return Ok(interrupted); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 151 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 152 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 153 | let mut statuses = Vec::new(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 154 | for training in [a, b] { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 155 | let result = self.roll(training, intensity, lube); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 156 | if self.ended.is_some() { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 157 | return result; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 158 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 159 | let status = match result { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 160 | Ok(outcome) => self.gossip(outcome).status, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 161 | Err(problem) => problem.status(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 162 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 163 | statuses.push((training, status)); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 164 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 165 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 166 | let mut xml = String::from( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 167 | "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<D:multistatus xmlns:D=\"DAV:\">\n", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 168 | ); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 169 | for (training, status) in statuses { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 170 | let _ = write!( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 171 | xml, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 172 | " <D:response>\n <D:href>{}?technique={}</D:href>\n <D:status>HTTP/1.1 {} {}</D:status>\n </D:response>\n", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 173 | self.path(""), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 174 | training.name(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 175 | status.as_u16(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 176 | crate::problem::reason(status), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 177 | ); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 178 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 179 | xml.push_str( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 180 | " <D:responsedescription>Each technique has been reported separately.</D:responsedescription>\n</D:multistatus>\n", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 181 | ); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 182 | Ok(Outcome::raw( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 183 | StatusCode::MULTI_STATUS, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 184 | "application/xml; charset=utf-8", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 185 | xml, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 186 | )) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 187 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 188 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 189 | fn ready(&self, technique: Technique, lube: Option<Lube>) -> Result<(), Problem> { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 190 | self.access(technique)?; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 191 | match technique { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 192 | Technique::Training(training) => Self::check_lube(training, lube), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 193 | Technique::Utility(_) => Ok(()), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 194 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 195 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 196 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 197 | /// Whether the run could attempt the technique now, ignoring the lubricant. |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 198 | fn access(&self, technique: Technique) -> Result<(), Problem> { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 199 | if technique == Technique::Training(Training::Uli) && !self.forum_read() { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 200 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 201 | StatusCode::FORBIDDEN, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 202 | "technique-locked", |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 203 | "uli is discussed on the forum, in a thread from 2009, by a man who never posted again. You have not been to the forum.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 204 | )); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 205 | } |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 206 | if technique == Technique::Utility(Utility::Meditate) { |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 207 | return if self.meditation_taught { |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 208 | Ok(()) |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 209 | } else { |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 210 | Err(Problem::new( |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 211 | StatusCode::FORBIDDEN, |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 212 | "technique-locked", |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 213 | "The breathing technique is described in one of the forum's replies. You have not found it.", |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 214 | )) |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 215 | }; |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 216 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 217 | if !self.warmed_up { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 218 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 219 | StatusCode::PRECONDITION_FAILED, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 220 | "cold-start", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 221 | "Warm-up was skipped. The server has noted this.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 222 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 223 | .with("technique", Utility::Warmup.name())); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 224 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 225 | match technique { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 226 | Technique::Utility(Utility::Pump) if !self.items.pump_pro => Err(Problem::new( |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 227 | StatusCode::FAILED_DEPENDENCY, |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 228 | "no-pump", |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 229 | "The pump technique depends on a pump.", |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 230 | )), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 231 | Technique::Utility(_) => Ok(()), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 232 | Technique::Training(training) => match training.profile().foreskin { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 233 | Some((min, max)) => self.check_foreskin(min, max), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 234 | None => Ok(()), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 235 | }, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 236 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 237 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 238 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 239 | fn check_lube(training: Training, lube: Option<Lube>) -> Result<(), Problem> { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 240 | match (training.profile().lube, lube) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 241 | (LubeRule::Required, None) => Err(Problem::new( |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 242 | StatusCode::UNSUPPORTED_MEDIA_TYPE, |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 243 | "lubricant-required", |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 244 | format!( |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 245 | "The {} technique requires a lubricant. None was declared.", |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 246 | training.name() |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 247 | ), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 248 | ) |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 249 | .with("lubricants", json!(LUBRICANTS))), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 250 | (LubeRule::Forbidden, Some(_)) => Err(Problem::new( |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 251 | StatusCode::UNSUPPORTED_MEDIA_TYPE, |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 252 | "lubricant-declared", |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 253 | format!( |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 254 | "The {} technique was requested. A lubricant was declared.", |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 255 | training.name() |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 256 | ), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 257 | )), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 258 | _ => Ok(()), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 259 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 260 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 261 | |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 262 | /// One unit of whatever was declared. Spit is free and the tap is always on. |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 263 | fn lube_available(&self, lube: Option<Lube>) -> Result<(), Problem> { |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 264 | let (held, name) = match lube { |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 265 | None | Some(Lube::Spit) => return Ok(()), |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 266 | Some(Lube::BabyOil) => (&self.items.baby_oil, "baby-oil"), |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 267 | Some(Lube::CoconutOil) => (&self.items.coconut_oil, "coconut-oil"), |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 268 | Some(Lube::Lotion) => (&self.items.lotion, "lotion"), |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 269 | Some(Lube::Vaseline) => (&self.items.vaseline, "vaseline"), |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 270 | }; |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 271 | if *held == 0 { |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 272 | return Err(Problem::new( |
139164489032 | atagen | 2026-10-11 05:46 UTC | 273 | StatusCode::UNSUPPORTED_MEDIA_TYPE, |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 274 | "lubricant-exhausted", |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 275 | format!("{name} was declared, but the bottle is empty."), |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 276 | )); |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 277 | } |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 278 | Ok(()) |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 279 | } |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 280 | |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 281 | fn take_lube(&mut self, lube: Option<Lube>) -> Result<(), Problem> { |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 282 | self.lube_available(lube)?; |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 283 | let held = match lube { |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 284 | None | Some(Lube::Spit) => return Ok(()), |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 285 | Some(Lube::BabyOil) => &mut self.items.baby_oil, |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 286 | Some(Lube::CoconutOil) => &mut self.items.coconut_oil, |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 287 | Some(Lube::Lotion) => &mut self.items.lotion, |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 288 | Some(Lube::Vaseline) => &mut self.items.vaseline, |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 289 | }; |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 290 | *held -= 1; |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 291 | Ok(()) |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 292 | } |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 293 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 294 | /// The techniques a JELQ could use right now without being refused before the roll. |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 295 | pub fn techniques_now(&self, now: Instant) -> Vec<Technique> { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 296 | let blocked = !self.floor.timed() |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 297 | || self.items.cage |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 298 | || self.refractory_until.is_some_and(|until| now < until); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 299 | if blocked { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 300 | return Vec::new(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 301 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 302 | Technique::ALL |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 303 | .into_iter() |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 304 | .filter(|&technique| match technique { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 305 | Technique::Utility(Utility::Warmup) => true, |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 306 | Technique::Utility(Utility::Ice) => self.items.ice_packs > 0, |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 307 | Technique::Utility(Utility::Supplement) => self.items.supplements > 0, |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 308 | Technique::Utility(Utility::Meditate) => { |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 309 | self.meditation_taught && !self.here.meditated |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 310 | } |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 311 | Technique::Utility(Utility::Energy) => self.items.energy_drinks > 0, |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 312 | _ => self.access(technique).is_ok() && self.check_storage().is_ok(), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 313 | }) |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 314 | .collect() |
782069860236 | atagen | 2026-10-10 12:44 UTC | 315 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 316 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 317 | fn check_foreskin(&self, min: f64, max: f64) -> Result<(), Problem> { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 318 | let Some(f) = self.foreskin else { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 319 | if min <= 0.0 { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 320 | return Ok(()); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 321 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 322 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 323 | StatusCode::GONE, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 324 | "foreskin-gone", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 325 | "This technique requires a foreskin. The foreskin is gone.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 326 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 327 | .header(header::CONTENT_LOCATION, self.path("/foreskin"))); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 328 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 329 | if f < min { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 330 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 331 | StatusCode::LENGTH_REQUIRED, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 332 | "foreskin-insufficient", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 333 | format!( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 334 | "The selected technique requires {min:.1} units of foreskin. {f:.2} units are available. The server has noted the shortfall." |
782069860236 | atagen | 2026-10-10 12:44 UTC | 335 | ), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 336 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 337 | .with("required", min)); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 338 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 339 | if f > max { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 340 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 341 | StatusCode::PAYLOAD_TOO_LARGE, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 342 | "foreskin-excessive", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 343 | format!( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 344 | "The selected technique tolerates at most {max:.1} units of foreskin. {f:.2} units are present." |
782069860236 | atagen | 2026-10-10 12:44 UTC | 345 | ), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 346 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 347 | .with("maximum", max)); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 348 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 349 | Ok(()) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 350 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 351 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 352 | fn check_storage(&self) -> Result<(), Problem> { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 353 | if self.items.extender && self.girth > STORAGE_GIRTH { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 354 | return Err(Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 355 | StatusCode::INSUFFICIENT_STORAGE, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 356 | "jeans-full", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 357 | "The jeans are full. The extender is occupying the remaining storage.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 358 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 359 | .with("extender", self.path("/inventory/extender"))); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 360 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 361 | Ok(()) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 362 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 363 | |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 364 | fn chafe(&mut self, lube: Option<Lube>) { |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 365 | let mut friction = match lube { |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 366 | None => FRICTION_DRY, |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 367 | Some(Lube::Spit) => FRICTION_SPIT, |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 368 | Some(_) => 0, |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 369 | }; |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 370 | if friction > 0 && self.jelq_grip.is_some_and(|grip| grip != self.grip) { |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 371 | friction -= FRICTION_GRIP; |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 372 | } |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 373 | self.jelq_grip = Some(self.grip); |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 374 | self.friction = (self.friction + friction).min(FRICTION_MAX); |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 375 | if self.friction >= FRICTION_BURN_AT |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 376 | && !self.conditions.friction_burn |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 377 | && self.chance(FRICTION_BURN) |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 378 | { |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 379 | self.conditions.friction_burn = true; |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 380 | } |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 381 | } |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 382 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 383 | pub(super) fn commit(&mut self, intensity: i32, lube: Option<Lube>, now: Instant, cost: i32) { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 384 | self.touch(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 385 | self.turn += 1; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 386 | self.here.turns += 1; |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 387 | self.realise(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 388 | if self.items.extender { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 389 | self.length += EXTENDER_GAIN; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 390 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 391 | self.stamina -= cost + i32::from(lube == Some(Lube::Lotion)); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 392 | if self.stamina <= 0 { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 393 | self.exhaust(now); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 394 | } |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 395 | let chill = if self.floor == Floor::ChangingRoom { |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 396 | CHANGING_ROOM_CHILL |
782069860236 | atagen | 2026-10-10 12:44 UTC | 397 | } else { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 398 | 0 |
782069860236 | atagen | 2026-10-10 12:44 UTC | 399 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 400 | let wobble = self.rng.random_range(-EQ_WOBBLE..=EQ_WOBBLE); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 401 | self.eq = (self.eq + intensity * 2 - 6 - chill + wobble).clamp(0, 100); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 402 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 403 | let mut suspicion = intensity / 5 + i32::from(lube == Some(Lube::Vaseline)); |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 404 | if matches!(self.floor, Floor::ChangingRoom | Floor::Nans) { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 405 | suspicion *= 2; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 406 | } |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 407 | if self.floor == Floor::Nans && lube == Some(Lube::CoconutOil) { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 408 | suspicion += 2; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 409 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 410 | let was_below = self.suspicion < SUSPICION_LIMIT; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 411 | self.suspicion = |
782069860236 | atagen | 2026-10-10 12:44 UTC | 412 | u8::try_from((i32::from(self.suspicion) + suspicion).min(i32::from(SUSPICION_LIMIT))) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 413 | .unwrap_or(SUSPICION_LIMIT); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 414 | |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 415 | if intensity >= PULLED_MUSCLE_INTENSITY |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 416 | && !self.conditions.pulled_muscle |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 417 | && self.chance(PULLED_MUSCLE) |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 418 | { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 419 | self.conditions.pulled_muscle = true; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 420 | self.stamina = self.stamina.min(self.max_stamina()); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 421 | } |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 422 | self.settle(was_below); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 423 | } |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 424 | |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 425 | /// The part of a turn the house takes part in, whatever the action was. |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 426 | pub(super) fn settle(&mut self, was_below: bool) { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 427 | self.maybe_summon_mum(was_below); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 428 | if let Some(observer) = self.floor.observer() |
782069860236 | atagen | 2026-10-10 12:44 UTC | 429 | && self.chance(OBSERVED) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 430 | { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 431 | self.observed = Some(observer); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 432 | self.shame += 1; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 433 | if observer == Observer::Cat && self.chance(CAT_TAKES_TOWEL) { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 434 | self.here.towel_stolen = true; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 435 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 436 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 437 | if self.items.ring && self.eq > HOT_EQ && self.chance(RING_PRIAPISM) { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 438 | self.conditions.priapism_turns = PRIAPISM_TURNS; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 439 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 440 | if self.conditions.priapism_turns > 0 { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 441 | self.conditions.priapism_turns -= 1; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 442 | self.eq = self.eq.max(PRIAPISM_EQ); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 443 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 444 | if self.turn == BRANCH_TURN && self.story == Story::Unopened { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 445 | self.story = Story::Pending; |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 446 | self.notices |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 447 | .push("Somewhere, a forum thread from 2009 still has replies."); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 448 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 449 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 450 | |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 451 | /// HOLD. A pause between strokes, offered when the band has been left or the stamina is gone. |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 452 | pub fn can_hold(&self) -> bool { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 453 | self.eq > DANGER_EQ || self.stamina <= 2 |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 454 | } |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 455 | |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 456 | pub fn hold(&mut self, now: Instant) -> Result<Outcome, Problem> { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 457 | self.check_refractory(now)?; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 458 | if self.story == Story::Pending { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 459 | return Ok(self.branch_offer()); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 460 | } |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 461 | if self.items.cage { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 462 | return Err(Problem::new( |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 463 | StatusCode::LOCKED, |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 464 | "caged", |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 465 | "The cage is locked. The key is not in the box.", |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 466 | )); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 467 | } |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 468 | self.touch(); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 469 | self.turn += 1; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 470 | self.here.turns += 1; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 471 | self.realise(); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 472 | let was_below = self.suspicion < SUSPICION_LIMIT; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 473 | if self.chance(REFLECTION) { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 474 | self.eq = 0; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 475 | self.shame += 1; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 476 | self.notices |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 477 | .push("the count reached ten, and then the reflection started"); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 478 | } else { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 479 | self.eq = (self.eq - HOLD_EQ).clamp(0, 100); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 480 | } |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 481 | self.stamina = (self.stamina + 1).min(self.max_stamina()); |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 482 | self.shed(FRICTION_HOLD); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 483 | self.settle(was_below); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 484 | Ok(Outcome::empty(StatusCode::NO_CONTENT)) |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 485 | } |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 486 | |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 487 | /// The breathing technique from the forum's replies. It spends no stamina and the turn is |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 488 | /// not the floor's, but each floor allows it once. |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 489 | fn meditate(&mut self) -> Result<Outcome, Problem> { |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 490 | self.access(Technique::Utility(Utility::Meditate))?; |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 491 | if self.here.meditated { |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 492 | return Err(Problem::new( |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 493 | StatusCode::CONFLICT, |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 494 | "already-meditated", |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 495 | "This floor has had its meditation.", |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 496 | )); |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 497 | } |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 498 | self.here.meditated = true; |
14de3e1e8dc2 | atagen | 2026-10-11 06:19 UTC | 499 | self.reset_eq(self.eq - MEDITATION_EQ); |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 500 | self.shed(FRICTION_MEDITATE); |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 501 | self.touch(); |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 502 | Ok(Outcome::json( |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 503 | StatusCode::OK, |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 504 | json!({ |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 505 | "detail": "In through the nose, out through the mouth. EQ falls by ten.", |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 506 | }), |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 507 | )) |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 508 | } |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 509 | |
0d604ee39751 | atagen | 2026-10-10 14:15 UTC | 510 | pub(super) fn maybe_summon_mum(&mut self, was_below: bool) { |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 511 | if !self.floor.has_mum() || self.mum.is_some() { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 512 | return; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 513 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 514 | let summoned = was_below && self.suspicion == SUSPICION_LIMIT; |
7d3fb63208bf | atagen | 2026-10-11 04:38 UTC | 515 | let mut visits = u32::from(self.suspicion) + 1; |
7d3fb63208bf | atagen | 2026-10-11 04:38 UTC | 516 | if self.here.brother_told { |
7d3fb63208bf | atagen | 2026-10-11 04:38 UTC | 517 | visits *= 2; |
7d3fb63208bf | atagen | 2026-10-11 04:38 UTC | 518 | } |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 519 | if summoned || self.rng.random_ratio(visits, super::balance::MUM_VISIT) { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 520 | let errand = self.errand(summoned); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 521 | let nonce = self.fresh_nonce(); |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 522 | self.mum = Some(MumVisit { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 523 | errand, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 524 | nonce, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 525 | strikes: 0, |
0d604ee39751 | atagen | 2026-10-10 14:15 UTC | 526 | knocked: false, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 527 | }); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 528 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 529 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 530 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 531 | fn roll( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 532 | &mut self, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 533 | training: Training, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 534 | intensity: i32, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 535 | lube: Option<Lube>, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 536 | ) -> Result<Outcome, Problem> { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 537 | let profile = training.profile(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 538 | let natural: i32 = self.rng.random_range(1..=20); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 539 | let band = if EQ_BAND.contains(&self.eq) { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 540 | BAND_BONUS |
782069860236 | atagen | 2026-10-10 12:44 UTC | 541 | } else { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 542 | 0 |
782069860236 | atagen | 2026-10-10 12:44 UTC | 543 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 544 | let grip = match (self.grip, training) { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 545 | (Grip::Underhand, Training::Stretch) => 2, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 546 | (Grip::Underhand, Training::Wet) => -1, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 547 | _ => 0, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 548 | }; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 549 | let arrival = if self.here.warm_arrival { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 550 | self.here.warm_arrival = false; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 551 | ARRIVAL_BONUS |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 552 | } else { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 553 | 0 |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 554 | }; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 555 | let modifier = lube.map_or(0, Lube::modifier) + band + grip + arrival; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 556 | let dc = profile.dc + intensity / 3; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 557 | let total = natural + modifier; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 558 | let timing = format!("roll;desc=\"d20{modifier:+} vs {dc}\";dur={natural}"); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 559 | let timed = |p: Problem| p.header(SERVER_TIMING, &timing); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 560 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 561 | let (length, girth) = self.scaled_gains(&profile, intensity); |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 562 | let burn = if self.conditions.friction_burn { |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 563 | BURN_RUPTURE |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 564 | } else { |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 565 | 0 |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 566 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 567 | let rupture_line = if self.items.ring { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 568 | RING_RUPTURE_LINE |
782069860236 | atagen | 2026-10-10 12:44 UTC | 569 | } else { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 570 | RUPTURE_LINE |
782069860236 | atagen | 2026-10-10 12:44 UTC | 571 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 572 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 573 | if natural == 1 { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 574 | return Err(timed(self.critical_failure(training, &profile))); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 575 | } |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 576 | if natural == 2 && self.eq > DANGER_EQ - burn { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 577 | return Err(timed(self.rupture())); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 578 | } |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 579 | if self.eq > rupture_line - burn && total < dc { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 580 | return Err(timed(self.rupture())); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 581 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 582 | if natural == 20 { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 583 | self.gain(length * 2.0, girth * 2.0, profile.foreskin_growth); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 584 | return Ok(Outcome::json( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 585 | StatusCode::PERMANENT_REDIRECT, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 586 | json!({ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 587 | "detail": "Your length has moved permanently.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 588 | "length": round3(length * 2.0), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 589 | "girth": round3(girth * 2.0), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 590 | }), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 591 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 592 | .header(header::LOCATION, self.path("/length")) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 593 | .header(SERVER_TIMING, timing)); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 594 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 595 | if total < dc - 3 { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 596 | return Err(timed(not_extended())); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 597 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 598 | if total < dc { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 599 | return Ok(Outcome::empty(StatusCode::NO_CONTENT).header(SERVER_TIMING, timing)); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 600 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 601 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 602 | let outcome = if self.eq < *EQ_BAND.start() { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 603 | self.gain(length / 2.0, girth / 2.0, profile.foreskin_growth); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 604 | Outcome::json( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 605 | StatusCode::PARTIAL_CONTENT, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 606 | json!({ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 607 | "detail": "Partial gains were applied. EQ was below the band.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 608 | "length": round3(length / 2.0), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 609 | "girth": round3(girth / 2.0), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 610 | }), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 611 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 612 | } else if total >= dc + 5 { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 613 | self.gain(length, girth, profile.foreskin_growth); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 614 | Outcome::json( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 615 | StatusCode::OK, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 616 | json!({ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 617 | "detail": "Gains were applied.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 618 | "length": round3(length), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 619 | "girth": round3(girth), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 620 | }), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 621 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 622 | } else { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 623 | let eta = self.rng.random_range(1..=4); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 624 | self.pending.push(Pending { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 625 | due: self.turn + eta, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 626 | length, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 627 | girth, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 628 | }); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 629 | self.gain(0.0, 0.0, profile.foreskin_growth); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 630 | Outcome::json( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 631 | StatusCode::ACCEPTED, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 632 | json!({ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 633 | "detail": "Gains have been queued. They may arrive.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 634 | "eta_turns": eta, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 635 | }), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 636 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 637 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 638 | Ok(outcome.header(SERVER_TIMING, timing)) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 639 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 640 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 641 | fn scaled_gains(&self, profile: &Profile, intensity: i32) -> (f64, f64) { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 642 | let scale = f64::from(intensity); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 643 | let (mut length, mut girth) = (profile.length * scale, profile.girth * scale); |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 644 | let greed = if self.eq > HOT_EQ { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 645 | GREED_HOT |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 646 | } else if self.eq > DANGER_EQ { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 647 | GREED_WARM |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 648 | } else { |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 649 | 1.0 |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 650 | }; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 651 | length *= greed; |
4347977b8192 | atagen | 2026-10-11 04:56 UTC | 652 | girth *= greed; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 653 | if self.here.teapot { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 654 | length *= 0.5; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 655 | girth *= 1.5; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 656 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 657 | if self.items.ring { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 658 | girth *= 2.0; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 659 | } |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 660 | if self.conditions.friction_burn { |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 661 | length *= 0.5; |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 662 | girth *= 0.5; |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 663 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 664 | (length, girth) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 665 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 666 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 667 | fn critical_failure(&mut self, training: Training, profile: &Profile) -> Problem { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 668 | let uses_foreskin = profile.foreskin.is_some_and(|(min, _)| min > 0.0); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 669 | if uses_foreskin && self.foreskin.is_some() { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 670 | self.foreskin = None; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 671 | self.shame += 25; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 672 | return Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 673 | StatusCode::GONE, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 674 | "foreskin-lost", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 675 | "The technique has removed the foreskin. It will not be returning.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 676 | ) |
782069860236 | atagen | 2026-10-10 12:44 UTC | 677 | .header(header::CONTENT_LOCATION, self.path("/foreskin")); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 678 | } |
139164489032 | atagen | 2026-10-11 05:46 UTC | 679 | let burn = if self.conditions.friction_burn { |
139164489032 | atagen | 2026-10-11 05:46 UTC | 680 | BURN_RUPTURE |
139164489032 | atagen | 2026-10-11 05:46 UTC | 681 | } else { |
139164489032 | atagen | 2026-10-11 05:46 UTC | 682 | 0 |
139164489032 | atagen | 2026-10-11 05:46 UTC | 683 | }; |
139164489032 | atagen | 2026-10-11 05:46 UTC | 684 | if self.eq > DANGER_EQ - burn { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 685 | return self.rupture(); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 686 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 687 | if training == Training::Stretch && !self.here.teapot { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 688 | self.here.teapot = true; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 689 | self.items.teapot_spout = true; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 690 | self.shame += 5; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 691 | return Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 692 | StatusCode::IM_A_TEAPOT, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 693 | "teapot", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 694 | "The subject is now short and stout. Length gains are halved for the rest of the floor.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 695 | ); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 696 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 697 | if training == Training::Uli && !self.conditions.peyronie { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 698 | self.conditions.peyronie = true; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 699 | self.shame += 5; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 700 | return Problem::new( |
782069860236 | atagen | 2026-10-10 12:44 UTC | 701 | StatusCode::MISDIRECTED_REQUEST, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 702 | "curvature", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 703 | "A curvature has developed. Techniques will land slightly to the left until a professional is consulted.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 704 | ); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 705 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 706 | not_extended() |
782069860236 | atagen | 2026-10-10 12:44 UTC | 707 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 708 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 709 | fn gossip(&mut self, mut outcome: Outcome) -> Outcome { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 710 | let reportable = matches!(outcome.status.as_u16(), 200 | 202 | 206); |
7d3fb63208bf | atagen | 2026-10-11 04:38 UTC | 711 | if !self.here.brother_told || !reportable { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 712 | return outcome; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 713 | } |
7d3fb63208bf | atagen | 2026-10-11 04:38 UTC | 714 | self.here.brother_told = false; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 715 | outcome.status = StatusCode::ALREADY_REPORTED; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 716 | if let Payload::Json(body) = &mut outcome.payload { |
7d3fb63208bf | atagen | 2026-10-11 04:38 UTC | 717 | body["detail"] = json!("Your brother has already told Mum."); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 718 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 719 | outcome |
782069860236 | atagen | 2026-10-10 12:44 UTC | 720 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 721 | } |