Class: BCDice::GameSystem::FilledWith::EventTable
- Inherits:
-
Object
- Object
- BCDice::GameSystem::FilledWith::EventTable
- Defined in:
- lib/bcdice/game_system/filled_with/event_tables.rb
Instance Method Summary collapse
-
#initialize(area_name, area_id, rows) ⇒ EventTable
constructor
A new instance of EventTable.
- #roll(randomizer, difficality, type: nil) ⇒ Object
Constructor Details
#initialize(area_name, area_id, rows) ⇒ EventTable
Returns a new instance of EventTable.
7 8 9 10 11 |
# 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 |
Instance Method Details
#roll(randomizer, difficality, type: nil) ⇒ Object
13 14 15 16 17 18 19 20 |
# 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 |