class BCDice::GameSystem::FilledWith::EventTable

Public Class Methods

new(area_name, area_id, rows) click to toggle source
# File lib/bcdice/game_system/filled_with/event_tables.rb, line 7
def initialize(area_name, area_id, rows)
  @area_name = area_name
  @area_id = area_id
  @rows = rows
end

Public Instance Methods

roll(randomizer, difficality, type: nil) click to toggle source
# File lib/bcdice/game_system/filled_with/event_tables.rb, line 13
def roll(randomizer, difficality, type: nil)
  tens = type || randomizer.roll_once(6)
  ones = randomizer.roll_once(6)
  value = tens * 10 + ones

  chosen = @rows[value]
  "ランダムイベント表(#{@area_id}#{value}):#{@area_name}<#{difficality.name}>:#{chosen.format(difficality)}"
end