atagen

jelq

public

an http based roguelike rpg about jelqing

Star0
Watch0
ssh://brewery@pls.lobotomise.me:33/atagen/jelq.git
src/game/arousal.rsRust76 lines1.9 KB
1
use super::{
2
    Cause, Ending, Run,
3
    balance::{DANGER_EQ, EQ_BAND, HOT_EQ, PREMATURE_EQ, RING_RUPTURE_LINE, RUPTURE_LINE},
4
};
5
6
/// What `X-EQ` shows in place of the number, cut on the lines the rolls already use.
7
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8
pub enum Arousal {
9
    Flaccid,
10
    Cold,
11
    Warm,
12
    Ideal,
13
    Swollen,
14
    Throbbing,
15
    Straining,
16
    Imminent,
17
    Priapic,
18
    Ruptured,
19
}
20
21
impl Arousal {
22
    pub fn name(self) -> &'static str {
23
        match self {
24
            Self::Flaccid => "Flaccid",
25
            Self::Cold => "Cold",
26
            Self::Warm => "Warm",
27
            Self::Ideal => "Ideal",
28
            Self::Swollen => "Swollen",
29
            Self::Throbbing => "Throbbing",
30
            Self::Straining => "Straining",
31
            Self::Imminent => "Imminent",
32
            Self::Priapic => "Priapic",
33
            Self::Ruptured => "Ruptured",
34
        }
35
    }
36
}
37
38
impl Run {
39
    pub(super) fn rupture_line(&self) -> i32 {
40
        if self.items.kit.ring {
41
            RING_RUPTURE_LINE
42
        } else {
43
            RUPTURE_LINE
44
        }
45
    }
46
47
    pub fn arousal(&self) -> Arousal {
48
        if matches!(
49
            self.ended,
50
            Some(Ending {
51
                cause: Cause::Ruptured { .. },
52
                ..
53
            })
54
        ) {
55
            Arousal::Ruptured
56
        } else if self.body.conditions.priapism_turns > 0 {
57
            Arousal::Priapic
58
        } else if self.hotter_than(PREMATURE_EQ) {
59
            Arousal::Imminent
60
        } else if self.hotter_than(self.rupture_line()) {
61
            Arousal::Straining
62
        } else if self.hotter_than(HOT_EQ) {
63
            Arousal::Throbbing
64
        } else if self.hotter_than(DANGER_EQ) {
65
            Arousal::Swollen
66
        } else if EQ_BAND.contains(&self.body.eq) {
67
            Arousal::Ideal
68
        } else if self.body.eq == 0 {
69
            Arousal::Flaccid
70
        } else if self.cold() {
71
            Arousal::Cold
72
        } else {
73
            Arousal::Warm
74
        }
75
    }
76
}