class BCDice::GameSystem::Ainecadette

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

SPECIAL_DICE

スペシャルとなる出目

SUCCESS_THRESHOLD

成功の目標値

Public Instance Methods

eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/Ainecadette.rb, line 24
def eval_game_system_specific_command(command)
  roll_action(command)
end

Private Instance Methods

roll_action(command) click to toggle source
# File lib/bcdice/game_system/Ainecadette.rb, line 36
def roll_action(command)
  m = /^(\d+)?(AI|CA)$/.match(command)
  return nil unless m

  is_senpai = m[2] == "AI"

  times = m[1]&.to_i || 2
  sides = is_senpai ? 10 : 6
  return nil if times <= 0

  dice_list = @randomizer.roll_barabara(times, sides)
  max = dice_list.max

  result =
    if max <= 1
      Result.fumble("ファンブル(もやもやカウンターを2個獲得)")
    elsif dice_list.include?(6)
      me = is_senpai ? "先輩" : "後輩"
      target = is_senpai ? "後輩" : "先輩"
      Result.critical("スペシャル(絆カウンターを1個獲得し、#{target}は#{me}への感情を1つ獲得)")
    elsif max >= SUCCESS_THRESHOLD
      Result.success("成功")
    else
      Result.failure("失敗")
    end

  result.text = "(#{command}) > [#{dice_list.join(',')}] > #{result.text}"

  return result
end