an http based roguelike rpg about jelqing
Blame: src/game/techniques.rs
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 1 | use serde_json::{Value, json}; |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 2 | |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 3 | use super::lube::LubeRule; |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 4 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 5 | /// Techniques that roll for gains. |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 6 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] |
782069860236 | atagen | 2026-10-10 12:44 UTC | 7 | pub enum Training { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 8 | Wet, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 9 | Dry, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 10 | Stretch, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 11 | Uli, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 12 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 13 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 14 | /// Techniques that change EQ or spend an item without rolling. |
782069860236 | atagen | 2026-10-10 12:44 UTC | 15 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] |
782069860236 | atagen | 2026-10-10 12:44 UTC | 16 | pub enum Utility { |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 17 | Warmup, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 18 | Ice, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 19 | Edge, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 20 | Pump, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 21 | Supplement, |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 22 | Meditate, |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 23 | Energy, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 24 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 25 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 26 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] |
782069860236 | atagen | 2026-10-10 12:44 UTC | 27 | pub enum Technique { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 28 | Training(Training), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 29 | Utility(Utility), |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 30 | } |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 31 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 32 | pub struct Profile { |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 33 | pub(crate) dc: i32, |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 34 | pub(crate) length: f64, |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 35 | pub(crate) girth: f64, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 36 | /// Minimum and maximum foreskin the technique tolerates. A minimum above zero means it is used. |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 37 | pub(crate) foreskin: Option<(f64, f64)>, |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 38 | pub(crate) foreskin_growth: f64, |
8b8e83329a1d | atagen | 2026-10-12 12:01 UTC | 39 | pub(crate) lube: LubeRule, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 40 | } |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 41 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 42 | impl Training { |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 43 | pub fn name(self) -> &'static str { |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 44 | match self { |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 45 | Self::Wet => "wet", |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 46 | Self::Dry => "dry", |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 47 | Self::Stretch => "stretch", |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 48 | Self::Uli => "uli", |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 49 | } |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 50 | } |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 51 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 52 | pub fn profile(self) -> Profile { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 53 | match self { |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 54 | Self::Wet => Profile { |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 55 | dc: 10, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 56 | length: 0.010, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 57 | girth: 0.005, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 58 | foreskin: None, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 59 | foreskin_growth: 0.0, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 60 | lube: LubeRule::Required, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 61 | }, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 62 | Self::Dry => Profile { |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 63 | dc: 12, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 64 | length: 0.008, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 65 | girth: 0.003, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 66 | foreskin: Some((0.8, 2.0)), |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 67 | foreskin_growth: 0.01, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 68 | lube: LubeRule::Forbidden, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 69 | }, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 70 | Self::Stretch => Profile { |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 71 | dc: 11, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 72 | length: 0.015, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 73 | girth: 0.0, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 74 | foreskin: Some((0.0, 1.8)), |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 75 | foreskin_growth: 0.03, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 76 | lube: LubeRule::Optional, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 77 | }, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 78 | Self::Uli => Profile { |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 79 | dc: 15, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 80 | length: 0.002, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 81 | girth: 0.020, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 82 | foreskin: None, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 83 | foreskin_growth: 0.0, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 84 | lube: LubeRule::Optional, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 85 | }, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 86 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 87 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 88 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 89 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 90 | impl Utility { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 91 | pub fn name(self) -> &'static str { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 92 | match self { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 93 | Self::Warmup => "warmup", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 94 | Self::Ice => "ice", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 95 | Self::Edge => "edge", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 96 | Self::Pump => "pump", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 97 | Self::Supplement => "supplement", |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 98 | Self::Meditate => "meditate", |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 99 | Self::Energy => "energy", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 100 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 101 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 102 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 103 | fn effect(self) -> &'static str { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 104 | match self { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 105 | Self::Warmup => "EQ +25. Satisfies the warm-up precondition.", |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 106 | Self::Ice => "EQ -40. Treats a friction burn. Consumes an ice pack.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 107 | Self::Edge => "EQ +15 and a little girth. Three in a row is a loop.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 108 | Self::Pump => "Large gains, all temporary. Requires a pump.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 109 | Self::Supplement => "Consumes a supplement.", |
5dfebcc0ac43 | atagen | 2026-10-11 05:28 UTC | 110 | Self::Meditate => "EQ -10, sheds 2 friction. Taught by the forum. Once per floor.", |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 111 | Self::Energy => "+3 stamina. Consumes an energy drink. Tastes like a battery.", |
782069860236 | atagen | 2026-10-10 12:44 UTC | 112 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 113 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 114 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 115 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 116 | impl Technique { |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 117 | pub const ALL: [Self; 11] = [ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 118 | Self::Utility(Utility::Warmup), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 119 | Self::Utility(Utility::Ice), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 120 | Self::Utility(Utility::Edge), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 121 | Self::Utility(Utility::Pump), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 122 | Self::Utility(Utility::Supplement), |
0fdc47364c8c | atagen | 2026-10-11 04:45 UTC | 123 | Self::Utility(Utility::Meditate), |
0a0bfee8329e | atagen | 2026-10-11 05:11 UTC | 124 | Self::Utility(Utility::Energy), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 125 | Self::Training(Training::Wet), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 126 | Self::Training(Training::Dry), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 127 | Self::Training(Training::Stretch), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 128 | Self::Training(Training::Uli), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 129 | ]; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 130 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 131 | pub fn name(self) -> &'static str { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 132 | match self { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 133 | Self::Training(t) => t.name(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 134 | Self::Utility(u) => u.name(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 135 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 136 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 137 | |
782069860236 | atagen | 2026-10-10 12:44 UTC | 138 | pub fn parse(name: &str) -> Option<Self> { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 139 | Self::ALL.into_iter().find(|t| t.name() == name) |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 140 | } |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 141 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 142 | pub fn lubricant(self) -> Option<&'static str> { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 143 | match self { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 144 | Self::Training(training) => Some(training.profile().lube.name()), |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 145 | Self::Utility(_) => None, |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 146 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 147 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 148 | |
880b29a0c11e | atagen | 2026-10-13 09:27 UTC | 149 | pub fn describe(self, known: bool) -> Value { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 150 | let training = match self { |
782069860236 | atagen | 2026-10-10 12:44 UTC | 151 | Self::Utility(utility) => { |
880b29a0c11e | atagen | 2026-10-13 09:27 UTC | 152 | return json!({ |
880b29a0c11e | atagen | 2026-10-13 09:27 UTC | 153 | "name": utility.name(), |
880b29a0c11e | atagen | 2026-10-13 09:27 UTC | 154 | "effect": utility.effect(), |
880b29a0c11e | atagen | 2026-10-13 09:27 UTC | 155 | "locked": !known, |
880b29a0c11e | atagen | 2026-10-13 09:27 UTC | 156 | }); |
782069860236 | atagen | 2026-10-10 12:44 UTC | 157 | } |
782069860236 | atagen | 2026-10-10 12:44 UTC | 158 | Self::Training(training) => training, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 159 | }; |
782069860236 | atagen | 2026-10-10 12:44 UTC | 160 | let profile = training.profile(); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 161 | let lubricant = profile.lube.name(); |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 162 | json!({ |
782069860236 | atagen | 2026-10-10 12:44 UTC | 163 | "name": training.name(), |
782069860236 | atagen | 2026-10-10 12:44 UTC | 164 | "dc": profile.dc, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 165 | "lubricant": lubricant, |
782069860236 | atagen | 2026-10-10 12:44 UTC | 166 | "foreskin": profile.foreskin.map(|(min, max)| json!({ "min": min, "max": max })), |
880b29a0c11e | atagen | 2026-10-13 09:27 UTC | 167 | "locked": !known, |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 168 | }) |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 169 | } |
dfa38cf4cd4b | atagen | 2026-10-10 09:17 UTC | 170 | } |