Class: BCDice::GameSystem::BeginningIdol::D6TwiceTable
- Inherits:
-
Object
- Object
- BCDice::GameSystem::BeginningIdol::D6TwiceTable
- Defined in:
- lib/bcdice/game_system/beginning_idol/d6_twice_table.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, items1, items2) ⇒ D6TwiceTable
constructor
A new instance of D6TwiceTable.
- #roll(randomizer) ⇒ String
Constructor Details
#initialize(name, items1, items2) ⇒ D6TwiceTable
Returns a new instance of D6TwiceTable.
18 19 20 21 22 |
# File 'lib/bcdice/game_system/beginning_idol/d6_twice_table.rb', line 18 def initialize(name, items1, items2) @name = name @items1 = items1 @items2 = items2 end |
Class Method Details
.from_i18n(key, locale) ⇒ D6TwiceTable
10 11 12 13 |
# File 'lib/bcdice/game_system/beginning_idol/d6_twice_table.rb', line 10 def self.from_i18n(key, locale) table = I18n.t(key, locale: locale) new(table[:name], table[:items1], table[:items2]) end |
Instance Method Details
#roll(randomizer) ⇒ String
26 27 28 29 30 31 32 |
# File 'lib/bcdice/game_system/beginning_idol/d6_twice_table.rb', line 26 def roll(randomizer) value1, value2 = randomizer.(2, 6) chosen1 = @items1[value1 - 1] chosen2 = @items2[value2 - 1] "#{@name}[#{value1},#{value2}] > #{chosen1}#{chosen2}" end |