class BCDice::GameSystem::TherapieSein

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

Public Instance Methods

checkRoll(hasCritical, modify, target) click to toggle source
# File lib/bcdice/game_system/TherapieSein.rb, line 55
def checkRoll(hasCritical, modify, target)
  dice_list = @randomizer.roll_barabara(2, 6)
  dice = dice_list.sum()
  diceText = dice_list.join(",")
  successValue = dice + modify

  modifyText = getValueText(modify)
  targetText = (target == 0 ? '' : ">=#{target}")

  result = "(2D6#{modifyText}#{targetText})"
  result += " > #{dice}(#{diceText})#{modifyText}"

  if hasCritical && (dice == 12)
    result += " > クリティカル!"
    return result
  end

  result += " > #{successValue}#{targetText}"

  return result if target == 0

  if  successValue >= target
    result += " > 【成功】"
  else
    result += " > 【失敗】"
  end

  return result
end
eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/TherapieSein.rb, line 35
def eval_game_system_specific_command(command)
  output =
    case command.upcase

    when /(TS|OP)(\d+)?(([+\-]\d+)*)(@(\d+))?$/i
      hasCritical = (Regexp.last_match(1) == "OP")
      target = (Regexp.last_match(6) || 0).to_i
      modify = (Regexp.last_match(2) || 0).to_i
      modifyAddString = Regexp.last_match(3)

      modify_list = modifyAddString.scan(/[+\-]\d+/) # 修正値を分割して配列へ
      modify_list.each { |i| modify += i.to_i }

      checkRoll(hasCritical, modify, target)

    end

  return output
end
getValueText(value) click to toggle source
# File lib/bcdice/game_system/TherapieSein.rb, line 85
def getValueText(value)
  return "" if value == 0
  return value.to_s if value < 0

  return "\+#{value}"
end