Class: Dicechucker::DiceExplode
Instance Attribute Summary
Attributes inherited from Dice
#modifier, #number_of_dice, #results, #sides, #total
Instance Method Summary collapse
Methods inherited from Dice
Constructor Details
This class inherits a constructor from Dicechucker::Dice
Instance Method Details
#roll ⇒ Object
80 81 82 83 84 85 86 87 88 |
# File 'lib/dicechucker/dice.rb', line 80 def roll roll_dice @results.each.with_index do |roll, index| if roll == @sides @results.insert(index + 1, (rand(@sides)+1)) end end @total = @results.inject(:+) + @modifier end |