atagen

jelq

public

an http based roguelike rpg about jelqing

Star0
Watch0
8b8e83329a1daec70177de3e129964094a711509
1
ssh://brewery@pls.lobotomise.me:33/atagen/jelq.git

Blame: src/game/techniques.rs

dfa38cf4cd4batagen2026-10-10 09:17 UTC1
use serde_json::{Value, json};
dfa38cf4cd4batagen2026-10-10 09:17 UTC2
8b8e83329a1datagen2026-10-12 12:01 UTC3
use super::lube::LubeRule;
dfa38cf4cd4batagen2026-10-10 09:17 UTC4
782069860236atagen2026-10-10 12:44 UTC5
/// Techniques that roll for gains.
dfa38cf4cd4batagen2026-10-10 09:17 UTC6
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
782069860236atagen2026-10-10 12:44 UTC7
pub enum Training {
782069860236atagen2026-10-10 12:44 UTC8
    Wet,
782069860236atagen2026-10-10 12:44 UTC9
    Dry,
782069860236atagen2026-10-10 12:44 UTC10
    Stretch,
782069860236atagen2026-10-10 12:44 UTC11
    Uli,
782069860236atagen2026-10-10 12:44 UTC12
}
782069860236atagen2026-10-10 12:44 UTC13
782069860236atagen2026-10-10 12:44 UTC14
/// Techniques that change EQ or spend an item without rolling.
782069860236atagen2026-10-10 12:44 UTC15
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
782069860236atagen2026-10-10 12:44 UTC16
pub enum Utility {
dfa38cf4cd4batagen2026-10-10 09:17 UTC17
    Warmup,
dfa38cf4cd4batagen2026-10-10 09:17 UTC18
    Ice,
dfa38cf4cd4batagen2026-10-10 09:17 UTC19
    Edge,
dfa38cf4cd4batagen2026-10-10 09:17 UTC20
    Pump,
dfa38cf4cd4batagen2026-10-10 09:17 UTC21
    Supplement,
0fdc47364c8catagen2026-10-11 04:45 UTC22
    Meditate,
0a0bfee8329eatagen2026-10-11 05:11 UTC23
    Energy,
782069860236atagen2026-10-10 12:44 UTC24
}
782069860236atagen2026-10-10 12:44 UTC25
782069860236atagen2026-10-10 12:44 UTC26
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
782069860236atagen2026-10-10 12:44 UTC27
pub enum Technique {
782069860236atagen2026-10-10 12:44 UTC28
    Training(Training),
782069860236atagen2026-10-10 12:44 UTC29
    Utility(Utility),
dfa38cf4cd4batagen2026-10-10 09:17 UTC30
}
dfa38cf4cd4batagen2026-10-10 09:17 UTC31
782069860236atagen2026-10-10 12:44 UTC32
pub struct Profile {
8b8e83329a1datagen2026-10-12 12:01 UTC33
    pub(crate) dc: i32,
8b8e83329a1datagen2026-10-12 12:01 UTC34
    pub(crate) length: f64,
8b8e83329a1datagen2026-10-12 12:01 UTC35
    pub(crate) girth: f64,
782069860236atagen2026-10-10 12:44 UTC36
    /// Minimum and maximum foreskin the technique tolerates. A minimum above zero means it is used.
8b8e83329a1datagen2026-10-12 12:01 UTC37
    pub(crate) foreskin: Option<(f64, f64)>,
8b8e83329a1datagen2026-10-12 12:01 UTC38
    pub(crate) foreskin_growth: f64,
8b8e83329a1datagen2026-10-12 12:01 UTC39
    pub(crate) lube: LubeRule,
dfa38cf4cd4batagen2026-10-10 09:17 UTC40
}
dfa38cf4cd4batagen2026-10-10 09:17 UTC41
782069860236atagen2026-10-10 12:44 UTC42
impl Training {
dfa38cf4cd4batagen2026-10-10 09:17 UTC43
    pub fn name(self) -> &'static str {
dfa38cf4cd4batagen2026-10-10 09:17 UTC44
        match self {
dfa38cf4cd4batagen2026-10-10 09:17 UTC45
            Self::Wet => "wet",
dfa38cf4cd4batagen2026-10-10 09:17 UTC46
            Self::Dry => "dry",
dfa38cf4cd4batagen2026-10-10 09:17 UTC47
            Self::Stretch => "stretch",
dfa38cf4cd4batagen2026-10-10 09:17 UTC48
            Self::Uli => "uli",
dfa38cf4cd4batagen2026-10-10 09:17 UTC49
        }
dfa38cf4cd4batagen2026-10-10 09:17 UTC50
    }
dfa38cf4cd4batagen2026-10-10 09:17 UTC51
782069860236atagen2026-10-10 12:44 UTC52
    pub fn profile(self) -> Profile {
782069860236atagen2026-10-10 12:44 UTC53
        match self {
dfa38cf4cd4batagen2026-10-10 09:17 UTC54
            Self::Wet => Profile {
dfa38cf4cd4batagen2026-10-10 09:17 UTC55
                dc: 10,
dfa38cf4cd4batagen2026-10-10 09:17 UTC56
                length: 0.010,
dfa38cf4cd4batagen2026-10-10 09:17 UTC57
                girth: 0.005,
dfa38cf4cd4batagen2026-10-10 09:17 UTC58
                foreskin: None,
dfa38cf4cd4batagen2026-10-10 09:17 UTC59
                foreskin_growth: 0.0,
dfa38cf4cd4batagen2026-10-10 09:17 UTC60
                lube: LubeRule::Required,
dfa38cf4cd4batagen2026-10-10 09:17 UTC61
            },
dfa38cf4cd4batagen2026-10-10 09:17 UTC62
            Self::Dry => Profile {
dfa38cf4cd4batagen2026-10-10 09:17 UTC63
                dc: 12,
dfa38cf4cd4batagen2026-10-10 09:17 UTC64
                length: 0.008,
dfa38cf4cd4batagen2026-10-10 09:17 UTC65
                girth: 0.003,
dfa38cf4cd4batagen2026-10-10 09:17 UTC66
                foreskin: Some((0.8, 2.0)),
dfa38cf4cd4batagen2026-10-10 09:17 UTC67
                foreskin_growth: 0.01,
dfa38cf4cd4batagen2026-10-10 09:17 UTC68
                lube: LubeRule::Forbidden,
dfa38cf4cd4batagen2026-10-10 09:17 UTC69
            },
dfa38cf4cd4batagen2026-10-10 09:17 UTC70
            Self::Stretch => Profile {
dfa38cf4cd4batagen2026-10-10 09:17 UTC71
                dc: 11,
dfa38cf4cd4batagen2026-10-10 09:17 UTC72
                length: 0.015,
dfa38cf4cd4batagen2026-10-10 09:17 UTC73
                girth: 0.0,
dfa38cf4cd4batagen2026-10-10 09:17 UTC74
                foreskin: Some((0.0, 1.8)),
dfa38cf4cd4batagen2026-10-10 09:17 UTC75
                foreskin_growth: 0.03,
dfa38cf4cd4batagen2026-10-10 09:17 UTC76
                lube: LubeRule::Optional,
dfa38cf4cd4batagen2026-10-10 09:17 UTC77
            },
dfa38cf4cd4batagen2026-10-10 09:17 UTC78
            Self::Uli => Profile {
dfa38cf4cd4batagen2026-10-10 09:17 UTC79
                dc: 15,
dfa38cf4cd4batagen2026-10-10 09:17 UTC80
                length: 0.002,
dfa38cf4cd4batagen2026-10-10 09:17 UTC81
                girth: 0.020,
dfa38cf4cd4batagen2026-10-10 09:17 UTC82
                foreskin: None,
dfa38cf4cd4batagen2026-10-10 09:17 UTC83
                foreskin_growth: 0.0,
dfa38cf4cd4batagen2026-10-10 09:17 UTC84
                lube: LubeRule::Optional,
dfa38cf4cd4batagen2026-10-10 09:17 UTC85
            },
782069860236atagen2026-10-10 12:44 UTC86
        }
782069860236atagen2026-10-10 12:44 UTC87
    }
782069860236atagen2026-10-10 12:44 UTC88
}
782069860236atagen2026-10-10 12:44 UTC89
782069860236atagen2026-10-10 12:44 UTC90
impl Utility {
782069860236atagen2026-10-10 12:44 UTC91
    pub fn name(self) -> &'static str {
782069860236atagen2026-10-10 12:44 UTC92
        match self {
782069860236atagen2026-10-10 12:44 UTC93
            Self::Warmup => "warmup",
782069860236atagen2026-10-10 12:44 UTC94
            Self::Ice => "ice",
782069860236atagen2026-10-10 12:44 UTC95
            Self::Edge => "edge",
782069860236atagen2026-10-10 12:44 UTC96
            Self::Pump => "pump",
782069860236atagen2026-10-10 12:44 UTC97
            Self::Supplement => "supplement",
0fdc47364c8catagen2026-10-11 04:45 UTC98
            Self::Meditate => "meditate",
0a0bfee8329eatagen2026-10-11 05:11 UTC99
            Self::Energy => "energy",
782069860236atagen2026-10-10 12:44 UTC100
        }
782069860236atagen2026-10-10 12:44 UTC101
    }
782069860236atagen2026-10-10 12:44 UTC102
782069860236atagen2026-10-10 12:44 UTC103
    fn effect(self) -> &'static str {
782069860236atagen2026-10-10 12:44 UTC104
        match self {
782069860236atagen2026-10-10 12:44 UTC105
            Self::Warmup => "EQ +25. Satisfies the warm-up precondition.",
5dfebcc0ac43atagen2026-10-11 05:28 UTC106
            Self::Ice => "EQ -40. Treats a friction burn. Consumes an ice pack.",
782069860236atagen2026-10-10 12:44 UTC107
            Self::Edge => "EQ +15 and a little girth. Three in a row is a loop.",
782069860236atagen2026-10-10 12:44 UTC108
            Self::Pump => "Large gains, all temporary. Requires a pump.",
782069860236atagen2026-10-10 12:44 UTC109
            Self::Supplement => "Consumes a supplement.",
5dfebcc0ac43atagen2026-10-11 05:28 UTC110
            Self::Meditate => "EQ -10, sheds 2 friction. Taught by the forum. Once per floor.",
0a0bfee8329eatagen2026-10-11 05:11 UTC111
            Self::Energy => "+3 stamina. Consumes an energy drink. Tastes like a battery.",
782069860236atagen2026-10-10 12:44 UTC112
        }
782069860236atagen2026-10-10 12:44 UTC113
    }
782069860236atagen2026-10-10 12:44 UTC114
}
782069860236atagen2026-10-10 12:44 UTC115
782069860236atagen2026-10-10 12:44 UTC116
impl Technique {
0a0bfee8329eatagen2026-10-11 05:11 UTC117
    pub const ALL: [Self; 11] = [
782069860236atagen2026-10-10 12:44 UTC118
        Self::Utility(Utility::Warmup),
782069860236atagen2026-10-10 12:44 UTC119
        Self::Utility(Utility::Ice),
782069860236atagen2026-10-10 12:44 UTC120
        Self::Utility(Utility::Edge),
782069860236atagen2026-10-10 12:44 UTC121
        Self::Utility(Utility::Pump),
782069860236atagen2026-10-10 12:44 UTC122
        Self::Utility(Utility::Supplement),
0fdc47364c8catagen2026-10-11 04:45 UTC123
        Self::Utility(Utility::Meditate),
0a0bfee8329eatagen2026-10-11 05:11 UTC124
        Self::Utility(Utility::Energy),
782069860236atagen2026-10-10 12:44 UTC125
        Self::Training(Training::Wet),
782069860236atagen2026-10-10 12:44 UTC126
        Self::Training(Training::Dry),
782069860236atagen2026-10-10 12:44 UTC127
        Self::Training(Training::Stretch),
782069860236atagen2026-10-10 12:44 UTC128
        Self::Training(Training::Uli),
782069860236atagen2026-10-10 12:44 UTC129
    ];
782069860236atagen2026-10-10 12:44 UTC130
782069860236atagen2026-10-10 12:44 UTC131
    pub fn name(self) -> &'static str {
782069860236atagen2026-10-10 12:44 UTC132
        match self {
782069860236atagen2026-10-10 12:44 UTC133
            Self::Training(t) => t.name(),
782069860236atagen2026-10-10 12:44 UTC134
            Self::Utility(u) => u.name(),
782069860236atagen2026-10-10 12:44 UTC135
        }
782069860236atagen2026-10-10 12:44 UTC136
    }
782069860236atagen2026-10-10 12:44 UTC137
782069860236atagen2026-10-10 12:44 UTC138
    pub fn parse(name: &str) -> Option<Self> {
782069860236atagen2026-10-10 12:44 UTC139
        Self::ALL.into_iter().find(|t| t.name() == name)
dfa38cf4cd4batagen2026-10-10 09:17 UTC140
    }
dfa38cf4cd4batagen2026-10-10 09:17 UTC141
58e1fb3943e6atagen2026-10-10 13:30 UTC142
    pub fn lubricant(self) -> Option<&'static str> {
58e1fb3943e6atagen2026-10-10 13:30 UTC143
        match self {
58e1fb3943e6atagen2026-10-10 13:30 UTC144
            Self::Training(training) => Some(training.profile().lube.name()),
58e1fb3943e6atagen2026-10-10 13:30 UTC145
            Self::Utility(_) => None,
58e1fb3943e6atagen2026-10-10 13:30 UTC146
        }
58e1fb3943e6atagen2026-10-10 13:30 UTC147
    }
58e1fb3943e6atagen2026-10-10 13:30 UTC148
b85a0d4536c3atagen2026-10-11 08:50 UTC149
    pub fn describe(self, uli_taught: bool) -> Value {
782069860236atagen2026-10-10 12:44 UTC150
        let training = match self {
782069860236atagen2026-10-10 12:44 UTC151
            Self::Utility(utility) => {
782069860236atagen2026-10-10 12:44 UTC152
                return json!({ "name": utility.name(), "effect": utility.effect() });
782069860236atagen2026-10-10 12:44 UTC153
            }
782069860236atagen2026-10-10 12:44 UTC154
            Self::Training(training) => training,
dfa38cf4cd4batagen2026-10-10 09:17 UTC155
        };
782069860236atagen2026-10-10 12:44 UTC156
        let profile = training.profile();
58e1fb3943e6atagen2026-10-10 13:30 UTC157
        let lubricant = profile.lube.name();
dfa38cf4cd4batagen2026-10-10 09:17 UTC158
        json!({
782069860236atagen2026-10-10 12:44 UTC159
            "name": training.name(),
782069860236atagen2026-10-10 12:44 UTC160
            "dc": profile.dc,
dfa38cf4cd4batagen2026-10-10 09:17 UTC161
            "lubricant": lubricant,
782069860236atagen2026-10-10 12:44 UTC162
            "foreskin": profile.foreskin.map(|(min, max)| json!({ "min": min, "max": max })),
b85a0d4536c3atagen2026-10-11 08:50 UTC163
            "locked": training == Training::Uli && !uli_taught,
dfa38cf4cd4batagen2026-10-10 09:17 UTC164
        })
dfa38cf4cd4batagen2026-10-10 09:17 UTC165
    }
dfa38cf4cd4batagen2026-10-10 09:17 UTC166
}