Class: BCDice::GameSystem::BeginningIdol::CostumeTable
- Inherits:
-
Object
- Object
- BCDice::GameSystem::BeginningIdol::CostumeTable
- Defined in:
- lib/bcdice/game_system/beginning_idol/costume_table.rb
Class Method Summary collapse
Instance Method Summary collapse
- #brand_only ⇒ DiceTable::D66Table
-
#initialize(name, items) ⇒ CostumeTable
constructor
A new instance of CostumeTable.
- #roll(randomizer) ⇒ String
Constructor Details
#initialize(name, items) ⇒ CostumeTable
Returns a new instance of CostumeTable.
14 15 16 17 |
# File 'lib/bcdice/game_system/beginning_idol/costume_table.rb', line 14 def initialize(name, items) @name = name @items = items end |
Class Method Details
.from_i18n(key, locale) ⇒ Object
7 8 9 10 |
# File 'lib/bcdice/game_system/beginning_idol/costume_table.rb', line 7 def self.from_i18n(key, locale) table = I18n.t(key, locale: locale) new(table[:name], table[:items]) end |
Instance Method Details
#brand_only ⇒ DiceTable::D66Table
27 28 29 30 31 32 33 |
# File 'lib/bcdice/game_system/beginning_idol/costume_table.rb', line 27 def brand_only() DiceTable::D66Table.new( @name, D66SortType::ASC, @items.transform_values { |e| e.split("\n").first } ) end |
#roll(randomizer) ⇒ String
21 22 23 24 |
# File 'lib/bcdice/game_system/beginning_idol/costume_table.rb', line 21 def roll(randomizer) value = randomizer.roll_d66(D66SortType::ASC) "#{@name}(#{value}) > #{@items[value]}" end |