Class: BCDice::GameSystem::BlackJacket::DeathChart

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

Instance Method Summary collapse

Constructor Details

#initialize(name, chart) ⇒ DeathChart

Returns a new instance of DeathChart.



104
105
106
107
108
109
110
111
# File 'lib/bcdice/game_system/BlackJacket.rb', line 104

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)


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

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