diff options
author | David Gay <eapoems@riseup.net> | 2023-10-14 20:01:53 -0400 |
---|---|---|
committer | David Gay <eapoems@riseup.net> | 2023-10-14 20:01:53 -0400 |
commit | b71ea4d941805a4d5a7cbefa4a97b67c044a4eea (patch) | |
tree | ecc8568f920700ce6ff90b9afb818c82f78be620 /src/dice.rs | |
parent | 6b54a012bb165dfcfdc3db8fe364ea81ee1a4814 (diff) |
First parts of generating henchman ability scores
Diffstat (limited to 'src/dice.rs')
-rw-r--r-- | src/dice.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/dice.rs b/src/dice.rs index 2c778f4..cd6cf29 100644 --- a/src/dice.rs +++ b/src/dice.rs @@ -29,6 +29,14 @@ impl RollResult { pub fn total(&self) -> u32 { self.rolls.iter().map(|die_roll| die_roll.face).sum() } + + pub fn increase_sides_below_max(&mut self, max_value: u32, increase_by: u32) { + for roll in &mut self.rolls { + if roll.face < max_value { + roll.face += increase_by; + } + } + } } impl fmt::Display for RollResult { |