Class: BCDice::GameSystem::DeadlineHeroes::HeroNameBaseChart
- Inherits:
-
Object
- Object
- BCDice::GameSystem::DeadlineHeroes::HeroNameBaseChart
- Defined in:
- lib/bcdice/game_system/DeadlineHeroes.rb
Instance Method Summary collapse
-
#initialize(name, items) ⇒ HeroNameBaseChart
constructor
A new instance of HeroNameBaseChart.
- #roll(randomizer) ⇒ Array<(String, String)>
Constructor Details
#initialize(name, items) ⇒ HeroNameBaseChart
325 326 327 328 |
# File 'lib/bcdice/game_system/DeadlineHeroes.rb', line 325 def initialize(name, items) @name = name @items = items end |
Instance Method Details
#roll(randomizer) ⇒ Array<(String, String)>
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/bcdice/game_system/DeadlineHeroes.rb', line 332 def roll(randomizer) dice = randomizer.roll_once(10) chosen = @items[dice - 1] result = "#{@name}(#{dice}) > #{chosen}" if (m = chosen.match(/^[(.+)]$/)) element_type = m[1] element_chart = HERO_NAME_ELEMENT_CHARTS[element_type] element_result, chosen = element_chart.roll(randomizer) result = [result, element_result].join(" > ") end return result, chosen end |