class BCDice::GameSystem::Chill3

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

Public Instance Methods

result_1d100(total, dice_total, cmp_op, target) click to toggle source
# File lib/bcdice/game_system/Chill3.rb, line 22
def result_1d100(total, dice_total, cmp_op, target)
  return nil if target == '?'
  return nil unless cmp_op == :<=

  # ゾロ目ならC-ResultかBotch
  tens = (dice_total / 10) % 10
  ones = dice_total % 10

  if tens == ones
    if (total > target) || (dice_total == 100) # 00は必ず失敗
      if target > 100 # 目標値が100を超えている場合は、00を振ってもBotchにならない
        return Result.failure("失敗")
      else
        return Result.fumble("Botch")
      end
    else
      return Result.critical("C成功")
    end
  elsif (total <= target) || (dice_total == 1) # 01は必ず成功
    if total <= (target / 2)
      return Result.success("H成功")
    else
      return Result.success("L成功")
    end
  else
    return Result.failure("失敗")
  end
end