Class: BCDice::GameSystem::DeadlineHeroes::DeathChart

Inherits:
Object
  • Object
show all
Defined in:
lib/bcdice/game_system/DeadlineHeroes.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, chart) ⇒ DeathChart

Returns a new instance of DeathChart.



117
118
119
120
121
122
123
124
# File 'lib/bcdice/game_system/DeadlineHeroes.rb', line 117

def initialize(name, chart)
  @name = name
  @chart = chart.freeze

  if @chart.size != 11
    raise ArgumentError, "unexpected chart size #{name.inspect} (given #{@chart.size}, expected 11)"
  end
end

Instance Method Details

#roll(randomizer, minus_score) ⇒ String

Parameters:

Returns:

  • (String)


129
130
131
132
133
134
135
136
# File 'lib/bcdice/game_system/DeadlineHeroes.rb', line 129

def roll(randomizer, minus_score)
  dice = randomizer.roll_once(10)
  key_number = dice + minus_score

  key_text, chosen = at(key_number)

  return "デスチャート(#{@name})[マイナス値:#{minus_score} + 1D10(->#{dice}) = #{key_number}] > #{key_text}#{chosen}"
end