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