atagen

jelq

public

an http based roguelike rpg about jelqing

Star0
Watch0
5cc6ab966f30f5bc5611ddefd166242a46ff3954
1
ssh://brewery@pls.lobotomise.me:33/atagen/jelq.git
src/game/items.rsRust259 lines8.2 KB
1
use super::balance::STARTING_ICE_PACKS;
2
3
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
4
pub enum Item {
5
    WarmTowel,
6
    IcePack,
7
    Ruler,
8
    DoorLock,
9
    DndSign,
10
    Blinds,
11
    Pump,
12
    PumpPro,
13
    Extender,
14
    Ring,
15
    Supplement,
16
    Cage,
17
    CageKey,
18
    Spreadsheet,
19
    TeapotSpout,
20
    BabyOil,
21
    CoconutOil,
22
    Lotion,
23
    Vaseline,
24
    EnergyDrink,
25
}
26
27
pub const SHOP: [Item; 15] = [
28
    Item::Pump,
29
    Item::PumpPro,
30
    Item::Extender,
31
    Item::Ring,
32
    Item::Supplement,
33
    Item::DoorLock,
34
    Item::DndSign,
35
    Item::Blinds,
36
    Item::Ruler,
37
    Item::IcePack,
38
    Item::CageKey,
39
    Item::BabyOil,
40
    Item::CoconutOil,
41
    Item::Lotion,
42
    Item::Vaseline,
43
];
44
45
impl Item {
46
    const ALL: [Self; 20] = [
47
        Self::WarmTowel,
48
        Self::IcePack,
49
        Self::Ruler,
50
        Self::DoorLock,
51
        Self::DndSign,
52
        Self::Blinds,
53
        Self::Pump,
54
        Self::PumpPro,
55
        Self::Extender,
56
        Self::Ring,
57
        Self::Supplement,
58
        Self::Cage,
59
        Self::CageKey,
60
        Self::Spreadsheet,
61
        Self::TeapotSpout,
62
        Self::BabyOil,
63
        Self::CoconutOil,
64
        Self::Lotion,
65
        Self::Vaseline,
66
        Self::EnergyDrink,
67
    ];
68
69
    pub fn slug(self) -> &'static str {
70
        match self {
71
            Self::WarmTowel => "warm-towel",
72
            Self::IcePack => "ice-pack",
73
            Self::Ruler => "ruler",
74
            Self::DoorLock => "door-lock",
75
            Self::DndSign => "do-not-disturb-sign",
76
            Self::Blinds => "window-blinds",
77
            Self::Pump => "pump",
78
            Self::PumpPro => "pump-pro",
79
            Self::Extender => "extender",
80
            Self::Ring => "cock-ring",
81
            Self::Supplement => "supplement",
82
            Self::Cage => "chastity-cage",
83
            Self::CageKey => "cage-key",
84
            Self::Spreadsheet => "spreadsheet",
85
            Self::TeapotSpout => "teapot-spout",
86
            Self::BabyOil => "baby-oil",
87
            Self::CoconutOil => "coconut-oil",
88
            Self::Lotion => "lotion",
89
            Self::Vaseline => "vaseline",
90
            Self::EnergyDrink => "energy-drink",
91
        }
92
    }
93
94
    pub fn parse(slug: &str) -> Option<Self> {
95
        Self::ALL.into_iter().find(|item| item.slug() == slug)
96
    }
97
98
    pub fn description(self) -> &'static str {
99
        match self {
100
            Self::WarmTowel => {
101
                "Reusable. Satisfies the warm-up precondition. Use technique=warmup."
102
            }
103
            Self::IcePack => "Lowers EQ by 40. Use technique=ice.",
104
            Self::Ruler => "Measures honestly. The length resource now carries a Content-Length.",
105
            Self::DoorLock => "Keeps your brother out once.",
106
            Self::DndSign => "Works on housekeeping. Mum does not read signs.",
107
            Self::Blinds => "The neighbour has a good camera. The blinds are better.",
108
            Self::Pump => "A pump.",
109
            Self::PumpPro => "Use technique=pump. Gains are temporary.",
110
            Self::Extender => "Passive gains each turn. Takes up room. Can be removed with DELETE.",
111
            Self::Ring => {
112
                "Girth gains doubled. Rupture risk raised. Responses are compressed if you accept gzip. Can be removed with DELETE."
113
            }
114
            Self::Supplement => "Use technique=supplement.",
115
            Self::Cage => "Locked.",
116
            Self::CageKey => "Pump-Bro does not ask.",
117
            Self::Spreadsheet => "Charts your progress. Every line is flat.",
118
            Self::TeapotSpout => "Does nothing. Cannot be dropped.",
119
            Self::BabyOil => "Smooth. +1. One unit per jelq.",
120
            Self::CoconutOil => "+3. Solid until it matters. Suspicious at Nan's.",
121
            Self::Lotion => "Handy. +0, and it chafes, so each jelq costs an extra stamina.",
122
            Self::Vaseline => "+2. Raises suspicion everywhere.",
123
            Self::EnergyDrink => "technique=energy. +3 stamina. Tastes like a battery.",
124
        }
125
    }
126
127
    pub fn pitch(self) -> &'static str {
128
        match self {
129
            Self::PumpPro => "A pump, but professional.",
130
            Self::Extender => "Passive gains every turn. Takes up room.",
131
            Self::Ring => "Doubles girth gains. Pump-Bro does not discuss the risks.",
132
            Self::Supplement => "Clinically formulated. Ships from overseas.",
133
            Self::DndSign => "Housekeeping respects it.",
134
            Self::Blinds => "The neighbour has a good camera.",
135
            Self::Ruler => "Pump-Bro does not recommend it.",
136
            Self::IcePack => "Cold.",
137
            _ => self.description(),
138
        }
139
    }
140
141
    pub fn price(self) -> Option<u32> {
142
        match self {
143
            Self::Pump => Some(10),
144
            Self::PumpPro | Self::Extender | Self::CageKey => Some(15),
145
            Self::Ring => Some(8),
146
            Self::Supplement | Self::DoorLock | Self::DndSign | Self::Blinds | Self::Ruler => {
147
                Some(5)
148
            }
149
            Self::BabyOil | Self::CoconutOil | Self::Lotion | Self::Vaseline => Some(4),
150
            Self::IcePack => Some(3),
151
            Self::WarmTowel
152
            | Self::Cage
153
            | Self::Spreadsheet
154
            | Self::TeapotSpout
155
            | Self::EnergyDrink => None,
156
        }
157
    }
158
}
159
160
pub struct Items {
161
    pub ruler: bool,
162
    pub ice_packs: u32,
163
    pub door_locks: u32,
164
    pub dnd_sign: bool,
165
    pub blinds: bool,
166
    pub pump_pro: bool,
167
    pub extender: bool,
168
    pub ring: bool,
169
    pub supplements: u32,
170
    pub cage: bool,
171
    pub spreadsheet: bool,
172
    pub teapot_spout: bool,
173
    pub baby_oil: u32,
174
    pub coconut_oil: u32,
175
    pub lotion: u32,
176
    pub vaseline: u32,
177
    pub energy_drinks: u32,
178
}
179
180
impl Default for Items {
181
    fn default() -> Self {
182
        Self {
183
            ruler: false,
184
            ice_packs: STARTING_ICE_PACKS,
185
            door_locks: 0,
186
            dnd_sign: false,
187
            blinds: false,
188
            pump_pro: false,
189
            extender: false,
190
            ring: false,
191
            supplements: 0,
192
            cage: false,
193
            spreadsheet: false,
194
            teapot_spout: false,
195
            baby_oil: 1,
196
            coconut_oil: 0,
197
            lotion: 1,
198
            vaseline: 0,
199
            energy_drinks: 0,
200
        }
201
    }
202
}
203
204
impl Items {
205
    pub fn has(&self, item: Item) -> bool {
206
        match item {
207
            Item::WarmTowel => true,
208
            Item::IcePack => self.ice_packs > 0,
209
            Item::Ruler => self.ruler,
210
            Item::DoorLock => self.door_locks > 0,
211
            Item::DndSign => self.dnd_sign,
212
            Item::Blinds => self.blinds,
213
            Item::PumpPro => self.pump_pro,
214
            Item::Extender => self.extender,
215
            Item::Ring => self.ring,
216
            Item::Supplement => self.supplements > 0,
217
            Item::Cage => self.cage,
218
            Item::Spreadsheet => self.spreadsheet,
219
            Item::TeapotSpout => self.teapot_spout,
220
            Item::BabyOil => self.baby_oil > 0,
221
            Item::CoconutOil => self.coconut_oil > 0,
222
            Item::Lotion => self.lotion > 0,
223
            Item::Vaseline => self.vaseline > 0,
224
            Item::EnergyDrink => self.energy_drinks > 0,
225
            Item::Pump | Item::CageKey => false,
226
        }
227
    }
228
229
    pub fn owned(&self) -> Vec<Item> {
230
        Item::ALL
231
            .into_iter()
232
            .filter(|&item| self.has(item))
233
            .collect()
234
    }
235
236
    pub fn grant(&mut self, item: Item) {
237
        match item {
238
            Item::IcePack => self.ice_packs += 1,
239
            Item::Ruler => self.ruler = true,
240
            Item::DoorLock => self.door_locks += 1,
241
            Item::DndSign => self.dnd_sign = true,
242
            Item::Blinds => self.blinds = true,
243
            Item::PumpPro => self.pump_pro = true,
244
            Item::Extender => self.extender = true,
245
            Item::Ring => self.ring = true,
246
            Item::Supplement => self.supplements += 1,
247
            Item::Cage => self.cage = true,
248
            Item::CageKey => self.cage = false,
249
            Item::Spreadsheet => self.spreadsheet = true,
250
            Item::TeapotSpout => self.teapot_spout = true,
251
            Item::BabyOil => self.baby_oil += 1,
252
            Item::CoconutOil => self.coconut_oil += 1,
253
            Item::Lotion => self.lotion += 1,
254
            Item::Vaseline => self.vaseline += 1,
255
            Item::EnergyDrink => self.energy_drinks += 1,
256
            Item::WarmTowel | Item::Pump => {}
257
        }
258
    }
259
}