lib/ludy/dices.rb in ludy-0.1.9 vs lib/ludy/dices.rb in ludy-0.1.10
- old
+ new
@@ -1,10 +1,11 @@
module Ludy
# dices, e.g., 4d6, 2d20, etc.
class Dices
+ # dices amounts of this dices; faces of this kind of dice
attr_reader :amounts, :faces
# the default dice is 1d20
def initialize amounts = 1, faces = 20
@amounts = amounts
@faces = faces
@@ -19,9 +20,10 @@
def max; @amounts*@faces; end
end
# a dice set could contain 4d6 + 2d20 and more dices.
class DiceSet
+ # the min and max possible value of this dice set.
attr_reader :min, :max
def initialize *args
@diceset = args
@min = @max = 0
@diceset.each{ |i|