Class: BCDice::GameSystem::BeginningIdol::MySkillNameTable
- Inherits:
-
Object
- Object
- BCDice::GameSystem::BeginningIdol::MySkillNameTable
- Defined in:
- lib/bcdice/game_system/beginning_idol/my_skill_name_table.rb
Instance Method Summary collapse
Constructor Details
#initialize(locale) ⇒ MySkillNameTable
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bcdice/game_system/beginning_idol/my_skill_name_table.rb', line 9 def initialize(locale) @locale = locale article = DiceTable::Table.from_i18n("BeginningIdol.MS.subtables.article", locale) describe = DiceTable::D66Table.from_i18n("BeginningIdol.MS.subtables.describe", locale) scene = DiceTable::D66Table.from_i18n("BeginningIdol.MS.subtables.scene", locale) material = DiceTable::D66Table.from_i18n("BeginningIdol.MS.subtables.material", locale) action = DiceTable::D66Table.from_i18n("BeginningIdol.MS.subtables.action", locale) @chains = [ [describe, scene, material], [describe, scene, action], [describe, material, action], [scene, material, action], [describe, scene, article], [material, action, article], ].freeze end |
Instance Method Details
#roll(randomizer) ⇒ String
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bcdice/game_system/beginning_idol/my_skill_name_table.rb', line 29 def roll(randomizer) index = randomizer.roll_once(6) chosens = @chains[index - 1].map { |t| t.roll(randomizer) } dice = chosens.map { |chosen| chosen.table_name + chosen.value.to_s } name = I18n.t("BeginningIdol.MS.name", locale: @locale) skill_name_format = I18n.t("BeginningIdol.MS.formats", locale: @locale)[index - 1] skill_name = format(skill_name_format, *chosens.map(&:body)) "#{name} > [#{index},#{dice.join(',')}] > #{skill_name}" end |