Class: BCDice::GameSystem::MonotoneMuseum::MMTable

Inherits:
DiceTable::D66RangeTable show all
Defined in:
lib/bcdice/game_system/MonotoneMuseum.rb

Overview

モノトーンミュージアム用のテーブル D66を振って決定する 1項目あたり出目2つに対応する

Constant Summary collapse

RANGE =

1項目あたり2個

[11..12, 13..14, 15..16, 21..22, 23..24, 25..26, 31..32, 33..34, 35..36, 41..42, 43..44, 45..46, 51..52, 53..54, 55..56, 61..62, 63..64, 65..66].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DiceTable::D66RangeTable

#roll

Constructor Details

#initialize(name, items) ⇒ MMTable

Returns a new instance of MMTable.

Parameters:

  • name (String)
  • items (Array<String>)


124
125
126
127
128
129
130
131
132
# File 'lib/bcdice/game_system/MonotoneMuseum.rb', line 124

def initialize(name, items)
  if items.size != RANGE.size
    raise UnexpectedTableSize.new(name, items.size)
  end

  items_with_range = RANGE.zip(items)

  super(name, items_with_range)
end

Class Method Details

.from_i18n(key, locale) ⇒ MMTable

Parameters:

  • key (String)
  • locale (Symbol)

Returns:



117
118
119
120
# File 'lib/bcdice/game_system/MonotoneMuseum.rb', line 117

def self.from_i18n(key, locale)
  table = I18n.translate(key, locale: locale, raise: true)
  new(table[:name], table[:items])
end