Class: BCDice::GameSystem::BeginningIdol::ChainD66Table
- Inherits:
-
Object
- Object
- BCDice::GameSystem::BeginningIdol::ChainD66Table
- Defined in:
- lib/bcdice/game_system/beginning_idol/chain_d66_table.rb
Instance Method Summary collapse
-
#initialize(name, items) ⇒ ChainD66Table
constructor
A new instance of ChainD66Table.
-
#roll(randomizer) ⇒ String
表を振る.
Constructor Details
#initialize(name, items) ⇒ ChainD66Table
Returns a new instance of ChainD66Table.
9 10 11 12 |
# File 'lib/bcdice/game_system/beginning_idol/chain_d66_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/game_system/beginning_idol/chain_d66_table.rb', line 17 def roll(randomizer) dice = randomizer.(2, 6).sort value = dice[0] * 10 + dice[1] chosen = @items[value] body = chosen.map { |item| item.respond_to?(:roll) ? item.roll(randomizer) : item }.join("\n") return "#{@name}(#{value}) > #{body}" end |