an http based roguelike rpg about jelqing
Commit d3c4718d061e
tarball3 files changed+29-13
@@ -7,6 +7,7 @@ pub const RAW_DEGLOVING: u32 = 20;
77
pub const FRICTION_GRIP: i32 = 1;88
pub const FRICTION_HOLD: i32 = 2;99
pub const FRICTION_MEDITATE: i32 = 2;10
+pub const FRICTION_ICE: i32 = 3;1011
pub const FRICTION_FLOOR: i32 = 1;1112
pub const FRICTION_BURN_AT: i32 = 6;1213
pub const FRICTION_BURN: u32 = 10;@@ -9,8 +9,9 @@ use serde_json::json;
99
use super::{1010
Floor, Outcome, Run,1111
balance::{12
- EDGE_EQ, EDGE_GIRTH, EDGE_LOOP, ENERGY_STAMINA, HOTEL_STRESS, ICE_EQ, PRIAPISM_EQ,13
- PRIAPISM_TURNS, PUMP_GAIN, SHOWER_EQ, SUPPLEMENT_WORKS, TOWELLESS_EQ, WARMUP_EQ,12
+ EDGE_EQ, EDGE_GIRTH, EDGE_LOOP, ENERGY_STAMINA, FRICTION_ICE, HOTEL_STRESS, ICE_EQ,13
+ PRIAPISM_EQ, PRIAPISM_TURNS, PUMP_GAIN, SHOWER_EQ, SUPPLEMENT_WORKS, TOWELLESS_EQ,14
+ WARMUP_EQ,1415
},1516
};1617
use crate::problem::Problem;@@ -77,20 +78,32 @@ impl Run {
7778
self.step_away();7879
self.items.stores.ice_packs -= 1;7980
let treated = std::mem::take(&mut self.body.conditions.friction_burn);80
- let detail = match (self.body.conditions.priapism_turns > 0, treated) {81
- (true, true) => {82
- "The friction burn is treated. EQ has not moved. The condition persists. The ice pack is gone."83
- }84
- (true, false) => "The ice has no effect. The condition persists. The ice pack is gone.",85
- (false, true) => {86
- "The friction burn is treated. EQ has been reduced. The ice pack is gone."81
+ let eased = self.body.friction > 0;82
+ self.shed(FRICTION_ICE);83
+ let priapism = self.body.conditions.priapism_turns > 0;84
+ let mut detail = Vec::new();85
+ if treated {86
+ detail.push("The friction burn is treated.");87
+ }88
+ if eased {89
+ detail.push("Friction has eased.");90
+ }91
+ if priapism {92
+ if detail.is_empty() {93
+ detail.push("The ice has no effect.");94
+ } else {95
+ detail.push("EQ has not moved.");8796
}88
- (false, false) => "EQ has been reduced. The ice pack is gone.",89
- };90
- if self.body.conditions.priapism_turns == 0 {97
+ detail.push("The condition persists.");98
+ } else {9199
self.body.eq = (self.body.eq - ICE_EQ).max(0);100
+ detail.push("EQ has been reduced.");92101
}93
- Ok(Outcome::json(StatusCode::OK, json!({ "detail": detail })))102
+ detail.push("The ice pack is gone.");103
+ Ok(Outcome::json(104
+ StatusCode::OK,105
+ json!({ "detail": detail.join(" ") }),106
+ ))94107
}95108
96109
pub(super) fn energy(&mut self) -> Result<Outcome, Problem> {@@ -349,10 +349,12 @@ async fn ice_treats_a_burn_even_through_priapism() {
349349
run.body.eq = 80;350350
run.body.conditions.priapism_turns = 3;351351
run.body.conditions.friction_burn = true;352
+ run.body.friction = 9;352353
run.items.stores.ice_packs = 1;353354
});354355
let iced = send(&app, "JELQ", "/runs/cafebabe?technique=ice", &[], "").await;355356
assert_eq!(header(&iced, "x-eq"), "80");357
+ assert_eq!(header(&iced, "x-friction"), "6/10");356358
assert!(warnings(&iced).iter().all(|w| !w.contains("friction burn")));357359
}