class BCDice::GameSystem::NeverCloud

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

「ゲームシステム名の読みがなの設定方法」(docs/dicebot_sort_key.md)を参考にして 設定してください

TABLES
TEXTS

Public Instance Methods

check_action(command) click to toggle source
# File lib/bcdice/game_system/NeverCloud.rb, line 45
def check_action(command)
  m = /^(\d+)(?:NC|D6?)((?:[-+]\d+)*)(>=(\d+))?$/i.match(command)
  dice_count = m[1].to_i
  modify_str = m[2]
  modify_number = ArithmeticEvaluator.eval(modify_str)
  cmp_str = m[3]
  target = m[4]&.to_i

  if modify_number == 0
    modify_str = ''
  end

  dice_list = @randomizer.roll_barabara(dice_count, 6)
  dice_value = dice_list.sum()
  dice_str = dice_list.join(",")

  total = dice_value + modify_number

  result =
    if dice_list.count(1) == dice_count
      total = 0
      "ファンブル"
    elsif dice_list.count(6) >= 2
      "クリティカル"
    elsif target
      total >= target ? "成功" : "失敗"
    end

  sequence = [
    "(#{dice_count}D6#{modify_str}#{cmp_str})",
    "#{dice_value}[#{dice_str}]#{modify_str}",
    total,
    result
  ].compact

  return sequence.join(" > ")
end
eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/NeverCloud.rb, line 33
def eval_game_system_specific_command(command)
  if /^(\d+)(?:NC|D6?)((?:[-+]\d+)*)(>=(\d+))?$/i.match?(command)
    return check_action(command)
  elsif TEXTS.key?(command)
    return TEXTS[command].chomp
  elsif TABLES.key?(command)
    return roll_tables(command, TABLES)
  else
    return nil
  end
end