class BCDice::GameSystem::DesperateRun

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

ゲームシステム名の読みがな

TABLES

Public Class Methods

new(command) click to toggle source
Calls superclass method BCDice::Base::new
# File lib/bcdice/game_system/DesperateRun.rb, line 105
def initialize(command)
  super(command)
  @sort_add_dice = true
  @d66_sort_type = D66SortType::ASC
end

Private Instance Methods

check_roll(string) click to toggle source
# File lib/bcdice/game_system/DesperateRun.rb, line 117
def check_roll(string)
  parser = Command::Parser.new(/RC\d+/, round_type: round_type)
                          .restrict_cmp_op_to(nil)
  cmd = parser.parse(string)
  return nil unless cmd

  d1, d2 = @randomizer.roll_barabara(2, 6)
  dice_total = d1 + d2
  total = d1 + d2 + cmd.modify_number
  target = cmd.command[2..-1].to_i

  modifier_str = " 修正値:#{cmd.modify_number}" if cmd.modify_number != 0

  result =
    if d1 == d2
      Result.critical("ゾロ目!【Critical】")
    elsif dice_total == 7
      Result.fumble("ダイスの出目が表裏!【Fumble】")
    elsif total >= target
      Result.success("#{total}、難易度以上!【Success】")
    else
      Result.failure("#{total}、難易度未満!【Miss】")
    end

  sequence = [
    "判定 難易度:#{target}#{modifier_str}",
    "出目:#{d1}、#{d2}",
    result.text,
  ]

  result.text = sequence.join(" > ")
  result
end
ddc_table(command) click to toggle source
# File lib/bcdice/game_system/DesperateRun.rb, line 151
def ddc_table(command)
  return nil if command != "DDC"

  d1, d2 = @randomizer.roll_barabara(2, 6)

  smaller, larger = [d1, d2].sort
  difference = larger - smaller

  "難易度決定 > 出目:#{d1}、#{d2} > #{larger}-#{smaller}=#{difference} > 難易度#{5 + difference}"
end
eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/DesperateRun.rb, line 113
def eval_game_system_specific_command(command)
  check_roll(command) || ddc_table(command) || roll_tables(command, self.class::TABLES)
end