Class: BCDice::GameSystem::KamitsubakiCityUnderConstructionNarrative::KumiD6

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

Constant Summary collapse

TABLE =
["", "", "", "", "", "Q"].freeze

Instance Method Summary collapse

Constructor Details

#initialize(success_symbol) ⇒ KumiD6

Returns a new instance of KumiD6.



114
115
116
# File 'lib/bcdice/game_system/KamitsubakiCityUnderConstructionNarrative.rb', line 114

def initialize(success_symbol)
  @success_symbol = success_symbol
end

Instance Method Details

#roll(randomizer) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/bcdice/game_system/KamitsubakiCityUnderConstructionNarrative.rb', line 120

def roll(randomizer)
  dice = randomizer.roll_once(6)
  chosen = TABLE[dice - 1]

  Result.new.tap do |r|
    unless @success_symbol.nil?
      r.fumble = chosen == "Q"
      r.condition = chosen == @success_symbol
    end

    result_tail =
      if r.fumble?
        "ファンブル"
      elsif r.success?
        "成功"
      elsif r.failure?
        "失敗"
      end

    r.text = [
      "(D6)",
      dice,
      chosen,
      result_tail
    ].compact.join("")
  end
end