rollr 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/rollr.rb +12 -0
  2. metadata +1 -1
data/lib/rollr.rb CHANGED
@@ -44,6 +44,18 @@ module Rollr
44
44
  @rolls.last.total
45
45
  end #roll
46
46
 
47
+ # Roll a new die. This creates a DiceRoll Object, and adds it to the array of rolls from this Die.
48
+ # Then, drop the lowest number of die rolls equal to the second argument
49
+ # Then, return the total of that Roll.
50
+ #
51
+ # @param [Integer] count
52
+ # @param [Integer] drop_die
53
+ # @return [Integer] The result of the rolls, by way of a DiceRoll object.
54
+ #
55
+ def roll_drop_lowest(count=1, drop_die = 0)
56
+ individual_rolls = (1..count).map { |d| rand(self.sides) + 1 }.sort.drop(drop_die)
57
+ @rolls << DiceRoll.new(individual_rolls, self.sides, count)
58
+ end #roll_drop_lowest
47
59
  end #Die
48
60
 
49
61
  #DiceRoll is a class that holds information regarding a single instance of a rolled die.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: