an http based roguelike rpg about jelqing
| 1 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] |
| 2 | #[repr(u8)] |
| 3 | pub enum Floor { |
| 4 | Bedroom = 1, |
| 5 | Bathroom = 2, |
| 6 | ChangingRoom = 3, |
| 7 | Nans = 4, |
| 8 | Hotel = 5, |
| 9 | Forum = 6, |
| 10 | Clinic = 7, |
| 11 | } |
| 12 | |
| 13 | impl Floor { |
| 14 | pub fn number(self) -> u8 { |
| 15 | self as u8 |
| 16 | } |
| 17 | |
| 18 | pub fn next(self) -> Option<Self> { |
| 19 | match self { |
| 20 | Self::Bedroom => Some(Self::Bathroom), |
| 21 | Self::Bathroom => Some(Self::ChangingRoom), |
| 22 | Self::ChangingRoom => Some(Self::Nans), |
| 23 | Self::Nans => Some(Self::Hotel), |
| 24 | Self::Hotel => Some(Self::Forum), |
| 25 | Self::Forum => Some(Self::Clinic), |
| 26 | Self::Clinic => None, |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | pub fn name(self) -> &'static str { |
| 31 | match self { |
| 32 | Self::Bedroom => "the bedroom", |
| 33 | Self::Bathroom => "the shared bathroom", |
| 34 | Self::ChangingRoom => "the gym changing room", |
| 35 | Self::Nans => "Nan's house at Christmas", |
| 36 | Self::Hotel => "a business trip hotel", |
| 37 | Self::Forum => "the forum", |
| 38 | Self::Clinic => "the urologist's office", |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | pub fn place(self) -> &'static str { |
| 43 | match self { |
| 44 | Self::Bedroom => "the bedroom", |
| 45 | Self::Bathroom => "the bathroom", |
| 46 | Self::ChangingRoom => "the changing room", |
| 47 | Self::Nans => "Nan's house", |
| 48 | Self::Hotel => "the hotel room", |
| 49 | Self::Forum => "the forum floor", |
| 50 | Self::Clinic => "the clinic", |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | pub fn note(self) -> &'static str { |
| 55 | match self { |
| 56 | Self::Bedroom => "The door does not lock. The cat is present.", |
| 57 | Self::Bathroom => "The water is hot. Your brother showers at eight.", |
| 58 | Self::ChangingRoom => { |
| 59 | "It is cold. Discretion is advised. Everyone here is lying. Pump-Bro is by the lockers." |
| 60 | } |
| 61 | Self::Nans => { |
| 62 | "The walls are thin. Mum is here, and she has been reading about Digest authentication." |
| 63 | } |
| 64 | Self::Hotel => { |
| 65 | "The wifi requires agreement. Housekeeping does not knock. Pump-Bro is in the lobby." |
| 66 | } |
| 67 | Self::Forum => "Nothing physical happens here. The Elder has a spreadsheet.", |
| 68 | Self::Clinic => "The urologist will see you now. He is bored.", |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | pub fn observer(self) -> Option<Observer> { |
| 73 | match self { |
| 74 | Self::Bedroom => Some(Observer::Cat), |
| 75 | Self::ChangingRoom => Some(Observer::Greg), |
| 76 | Self::Nans => Some(Observer::Nan), |
| 77 | _ => None, |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | pub fn has_mum(self) -> bool { |
| 82 | matches!(self, Self::Bedroom | Self::Nans) |
| 83 | } |
| 84 | |
| 85 | pub fn has_window(self) -> bool { |
| 86 | matches!(self, Self::Bedroom | Self::Nans | Self::Hotel) |
| 87 | } |
| 88 | |
| 89 | pub fn shop_open(self) -> bool { |
| 90 | matches!(self, Self::ChangingRoom | Self::Hotel) |
| 91 | } |
| 92 | |
| 93 | pub fn has_kitchen(self) -> bool { |
| 94 | matches!(self, Self::Bedroom | Self::Nans) |
| 95 | } |
| 96 | |
| 97 | pub fn timed(self) -> bool { |
| 98 | !matches!(self, Self::Forum | Self::Clinic) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] |
| 103 | pub enum Observer { |
| 104 | Cat, |
| 105 | Greg, |
| 106 | Nan, |
| 107 | } |
| 108 | |
| 109 | impl Observer { |
| 110 | pub fn name(self) -> &'static str { |
| 111 | match self { |
| 112 | Self::Cat => "cat", |
| 113 | Self::Greg => "greg", |
| 114 | Self::Nan => "nan", |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /// State that belongs to the current floor and resets when you leave it. |
| 120 | #[derive(Default)] |
| 121 | pub struct FloorState { |
| 122 | pub(crate) turns: u32, |
| 123 | pub(crate) warm_arrival: bool, |
| 124 | pub(crate) drawer: Drawer, |
| 125 | pub(crate) kitchen: KitchenVisit, |
| 126 | pub(crate) thread_rolls: u8, |
| 127 | pub(crate) edges: u8, |
| 128 | pub(crate) temp_length: f64, |
| 129 | pub(crate) teapot: bool, |
| 130 | pub(crate) towel_stolen: bool, |
| 131 | pub(crate) towel_warmed: bool, |
| 132 | pub(crate) meditated: bool, |
| 133 | pub(crate) brother_told: bool, |
| 134 | pub(crate) shopping: bool, |
| 135 | pub(crate) wifi_accepted: bool, |
| 136 | } |
| 137 | |
| 138 | #[derive(Default)] |
| 139 | pub struct Drawer { |
| 140 | pub(crate) searched: bool, |
| 141 | pub(crate) jammed: bool, |
| 142 | } |
| 143 | |
| 144 | #[derive(Default)] |
| 145 | pub struct KitchenVisit { |
| 146 | pub(crate) kettle_boiled: bool, |
| 147 | pub(crate) melon_offered: bool, |
| 148 | } |