an http based roguelike rpg about jelqing
| 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 | } |
| 21 | |
| 22 | pub const SHOP: [Item; 11] = [ |
| 23 | Item::Pump, |
| 24 | Item::PumpPro, |
| 25 | Item::Extender, |
| 26 | Item::Ring, |
| 27 | Item::Supplement, |
| 28 | Item::DoorLock, |
| 29 | Item::DndSign, |
| 30 | Item::Blinds, |
| 31 | Item::Ruler, |
| 32 | Item::IcePack, |
| 33 | Item::CageKey, |
| 34 | ]; |
| 35 | |
| 36 | impl Item { |
| 37 | const ALL: [Self; 15] = [ |
| 38 | Self::WarmTowel, |
| 39 | Self::IcePack, |
| 40 | Self::Ruler, |
| 41 | Self::DoorLock, |
| 42 | Self::DndSign, |
| 43 | Self::Blinds, |
| 44 | Self::Pump, |
| 45 | Self::PumpPro, |
| 46 | Self::Extender, |
| 47 | Self::Ring, |
| 48 | Self::Supplement, |
| 49 | Self::Cage, |
| 50 | Self::CageKey, |
| 51 | Self::Spreadsheet, |
| 52 | Self::TeapotSpout, |
| 53 | ]; |
| 54 | |
| 55 | pub fn slug(self) -> &'static str { |
| 56 | match self { |
| 57 | Self::WarmTowel => "warm-towel", |
| 58 | Self::IcePack => "ice-pack", |
| 59 | Self::Ruler => "ruler", |
| 60 | Self::DoorLock => "door-lock", |
| 61 | Self::DndSign => "do-not-disturb-sign", |
| 62 | Self::Blinds => "window-blinds", |
| 63 | Self::Pump => "pump", |
| 64 | Self::PumpPro => "pump-pro", |
| 65 | Self::Extender => "extender", |
| 66 | Self::Ring => "cock-ring", |
| 67 | Self::Supplement => "supplement", |
| 68 | Self::Cage => "chastity-cage", |
| 69 | Self::CageKey => "cage-key", |
| 70 | Self::Spreadsheet => "spreadsheet", |
| 71 | Self::TeapotSpout => "teapot-spout", |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | pub fn parse(slug: &str) -> Option<Self> { |
| 76 | Self::ALL.into_iter().find(|item| item.slug() == slug) |
| 77 | } |
| 78 | |
| 79 | pub fn description(self) -> &'static str { |
| 80 | match self { |
| 81 | Self::WarmTowel => { |
| 82 | "Reusable. Satisfies the warm-up precondition. Use technique=warmup." |
| 83 | } |
| 84 | Self::IcePack => "Lowers EQ by 40. Use technique=ice.", |
| 85 | Self::Ruler => "Measures honestly. The length resource now carries a Content-Length.", |
| 86 | Self::DoorLock => "Keeps the flatmate out once.", |
| 87 | Self::DndSign => "Works on housekeeping. Mum does not read signs.", |
| 88 | Self::Blinds => "The neighbour has a good camera. The blinds are better.", |
| 89 | Self::Pump => "A pump.", |
| 90 | Self::PumpPro => "Use technique=pump. Gains are temporary.", |
| 91 | Self::Extender => "Passive gains each turn. Takes up room. Can be removed with DELETE.", |
| 92 | Self::Ring => { |
| 93 | "Girth gains doubled. Rupture risk raised. Responses are compressed if you accept gzip. Can be removed with DELETE." |
| 94 | } |
| 95 | Self::Supplement => "Use technique=supplement.", |
| 96 | Self::Cage => "Locked.", |
| 97 | Self::CageKey => "Pump-Bro does not ask.", |
| 98 | Self::Spreadsheet => "Charts your progress. Every line is flat.", |
| 99 | Self::TeapotSpout => "Does nothing. Cannot be dropped.", |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | pub fn pitch(self) -> &'static str { |
| 104 | match self { |
| 105 | Self::PumpPro => "A pump, but professional.", |
| 106 | Self::Extender => "Passive gains every turn. Takes up room.", |
| 107 | Self::Ring => "Doubles girth gains. Pump-Bro does not discuss the risks.", |
| 108 | Self::Supplement => "Clinically formulated. Ships from overseas.", |
| 109 | Self::DndSign => "Housekeeping respects it.", |
| 110 | Self::Blinds => "The neighbour has a good camera.", |
| 111 | Self::Ruler => "Pump-Bro does not recommend it.", |
| 112 | Self::IcePack => "Cold.", |
| 113 | _ => self.description(), |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | pub fn price(self) -> Option<u32> { |
| 118 | match self { |
| 119 | Self::Pump => Some(10), |
| 120 | Self::PumpPro | Self::Extender | Self::CageKey => Some(15), |
| 121 | Self::Ring => Some(8), |
| 122 | Self::Supplement | Self::DoorLock | Self::DndSign | Self::Blinds | Self::Ruler => { |
| 123 | Some(5) |
| 124 | } |
| 125 | Self::IcePack => Some(3), |
| 126 | Self::WarmTowel | Self::Cage | Self::Spreadsheet | Self::TeapotSpout => None, |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | pub struct Items { |
| 132 | pub ruler: bool, |
| 133 | pub ice_packs: u32, |
| 134 | pub door_locks: u32, |
| 135 | pub dnd_sign: bool, |
| 136 | pub blinds: bool, |
| 137 | pub pump_pro: bool, |
| 138 | pub extender: bool, |
| 139 | pub ring: bool, |
| 140 | pub supplements: u32, |
| 141 | pub cage: bool, |
| 142 | pub spreadsheet: bool, |
| 143 | pub teapot_spout: bool, |
| 144 | } |
| 145 | |
| 146 | impl Default for Items { |
| 147 | fn default() -> Self { |
| 148 | Self { |
| 149 | ruler: false, |
| 150 | ice_packs: STARTING_ICE_PACKS, |
| 151 | door_locks: 0, |
| 152 | dnd_sign: false, |
| 153 | blinds: false, |
| 154 | pump_pro: false, |
| 155 | extender: false, |
| 156 | ring: false, |
| 157 | supplements: 0, |
| 158 | cage: false, |
| 159 | spreadsheet: false, |
| 160 | teapot_spout: false, |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | impl Items { |
| 166 | pub fn has(&self, item: Item) -> bool { |
| 167 | match item { |
| 168 | Item::WarmTowel => true, |
| 169 | Item::IcePack => self.ice_packs > 0, |
| 170 | Item::Ruler => self.ruler, |
| 171 | Item::DoorLock => self.door_locks > 0, |
| 172 | Item::DndSign => self.dnd_sign, |
| 173 | Item::Blinds => self.blinds, |
| 174 | Item::PumpPro => self.pump_pro, |
| 175 | Item::Extender => self.extender, |
| 176 | Item::Ring => self.ring, |
| 177 | Item::Supplement => self.supplements > 0, |
| 178 | Item::Cage => self.cage, |
| 179 | Item::Spreadsheet => self.spreadsheet, |
| 180 | Item::TeapotSpout => self.teapot_spout, |
| 181 | Item::Pump | Item::CageKey => false, |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | pub fn owned(&self) -> Vec<Item> { |
| 186 | Item::ALL |
| 187 | .into_iter() |
| 188 | .filter(|&item| self.has(item)) |
| 189 | .collect() |
| 190 | } |
| 191 | |
| 192 | pub fn grant(&mut self, item: Item) { |
| 193 | match item { |
| 194 | Item::IcePack => self.ice_packs += 1, |
| 195 | Item::Ruler => self.ruler = true, |
| 196 | Item::DoorLock => self.door_locks += 1, |
| 197 | Item::DndSign => self.dnd_sign = true, |
| 198 | Item::Blinds => self.blinds = true, |
| 199 | Item::PumpPro => self.pump_pro = true, |
| 200 | Item::Extender => self.extender = true, |
| 201 | Item::Ring => self.ring = true, |
| 202 | Item::Supplement => self.supplements += 1, |
| 203 | Item::Cage => self.cage = true, |
| 204 | Item::CageKey => self.cage = false, |
| 205 | Item::Spreadsheet => self.spreadsheet = true, |
| 206 | Item::TeapotSpout => self.teapot_spout = true, |
| 207 | Item::WarmTowel | Item::Pump => {} |
| 208 | } |
| 209 | } |
| 210 | } |