Class: BCDice::DiceTable::D66RangeTable
- Inherits:
-
Object
- Object
- BCDice::DiceTable::D66RangeTable
- Defined in:
- lib/bcdice/dice_table/d66_range_table.rb
Overview
項目をRangeを用いて参照するD66表
Direct Known Subclasses
GameSystem::MonotoneMuseum::MMTable, GameSystem::SteamPunkers::SPTable, GameSystem::TwilightGunsmoke::TGTable
Instance Method Summary collapse
-
#initialize(name, items) ⇒ D66RangeTable
constructor
A new instance of D66RangeTable.
-
#roll(randomizer) ⇒ String
表を振る.
Constructor Details
#initialize(name, items) ⇒ D66RangeTable
Returns a new instance of D66RangeTable.
9 10 11 12 |
# File 'lib/bcdice/dice_table/d66_range_table.rb', line 9 def initialize(name, items) @name = name @items = items.freeze end |
Instance Method Details
#roll(randomizer) ⇒ String
表を振る
17 18 19 20 21 22 23 24 25 |
# File 'lib/bcdice/dice_table/d66_range_table.rb', line 17 def roll(randomizer) dice1 = randomizer.roll_once(6) dice2 = randomizer.roll_once(6) key = dice1 * 10 + dice2 chosen = @items.find { |row| row[0].include?(key) } return RollResult.new(@name, key, chosen[1]) end |