class Tablescript::RollStrategy
Public Class Methods
new(table, roller = nil)
click to toggle source
# File lib/tablescript/roll_strategy.rb, line 23 def initialize(table, roller = nil) @table = table @roller = roller || RpgLib::DiceRoller.instance @roll = nil @value = nil end
Public Instance Methods
roll()
click to toggle source
# File lib/tablescript/roll_strategy.rb, line 30 def roll evaluate @roll end
value()
click to toggle source
# File lib/tablescript/roll_strategy.rb, line 35 def value evaluate @value end
Private Instance Methods
evaluate()
click to toggle source
# File lib/tablescript/roll_strategy.rb, line 42 def evaluate return unless @roll.nil? @roll = @roller.roll_die(@table.entries.size) @value = @table.lookup(@roll) end