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
Returns a new instance of HeroNameBaseChart.
326 327 328 329 |
# File 'lib/bcdice/game_system/DeadlineHeroes.rb', line 326 def initialize(name, items) @name = name @items = items end |
Instance Method Details
#roll(randomizer) ⇒ Array<(String, String)>
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/bcdice/game_system/DeadlineHeroes.rb', line 333 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 |