class Tablescript::RollContext

Attributes

roll[R]

Public Class Methods

new(roll, table, entry) click to toggle source
# File lib/tablescript/roll_context.rb, line 25
def initialize(roll, table, entry)
  @roll = roll
  @table = table
  @entry = entry
end

Public Instance Methods

dice_rolled() click to toggle source
# File lib/tablescript/roll_context.rb, line 35
def dice_rolled
  @table.dice_to_roll
end
reroll() click to toggle source
# File lib/tablescript/roll_context.rb, line 39
def reroll
  RollStrategy.new(@table).value
end
reroll_and_ignore(*args) click to toggle source
# File lib/tablescript/roll_context.rb, line 43
def reroll_and_ignore(*args)
  RollAndIgnoreStrategy.new(@table, RpgLib::RollSet.new(*args)).value
end
reroll_and_ignore_duplicates(times) click to toggle source
# File lib/tablescript/roll_context.rb, line 47
def reroll_and_ignore_duplicates(times)
  RollAndIgnoreDuplicatesStrategy.new(@table, times, RpgLib::RollSet.new(@entry.roll)).values
end
table_name() click to toggle source
# File lib/tablescript/roll_context.rb, line 31
def table_name
  @table.name
end