diff options
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 { |