class BCDice::GameSystem::KemonoNoMori

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

TABLES

Public Instance Methods

check_1D12(command, is_action_judge) click to toggle source
# File lib/bcdice/game_system/KemonoNoMori.rb, line 53
def check_1D12(command, is_action_judge)
  debug('獸ノ森の1d12判定')
  m = /K[AC](\d[-+\d]*)/.match(command)
  return nil unless m

  # 修正込みの目標値を計算
  target_total = ArithmeticEvaluator.eval(m[1])
  debug('target_total', target_total)

  # 行為判定の成功度は [目標値の10の位の数+1]
  # 継続判定の成功度は固定で+1
  success_degree = is_action_judge ? target_total / 10 + 1 : 1

  dice_total = @randomizer.roll_once(12)
  debug('dice_total, target_total, success_degree = ', dice_total, target_total, success_degree)

  if dice_total == 12
    Result.fumble("(1D12<=#{target_total}) > #{dice_total} > 大失敗")
  elsif dice_total == 11
    Result.critical("(1D12<=#{target_total}) > #{dice_total} > 大成功(成功度+#{success_degree}, 次の継続判定の目標値を10に変更)")
  elsif dice_total <= target_total
    Result.success("(1D12<=#{target_total}) > #{dice_total} > 成功(成功度+#{success_degree})")
  else
    Result.failure("(1D12<=#{target_total}) > #{dice_total} > 失敗")
  end
end
eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/KemonoNoMori.rb, line 43
def eval_game_system_specific_command(command)
  case command
  when /KA\d[-+\d]*/ then check_1D12(command, true)
  when /KC\d[-+\d]*/ then check_1D12(command, false)
  when 'CTR' then get_trap_result()
  when 'EET' then get_escape_experience_table_result(command)
  else roll_tables(command, TABLES)
  end
end
get_escape_experience_table_result(command) click to toggle source
# File lib/bcdice/game_system/KemonoNoMori.rb, line 95
def get_escape_experience_table_result(command)
  escape_experience = roll_tables(command, TABLES)
  escape_duration = @randomizer.roll_once(12)
  Result.new("#{escape_experience} (再登場: #{escape_duration}時間後)")
end
get_trap_result() click to toggle source
# File lib/bcdice/game_system/KemonoNoMori.rb, line 80
def get_trap_result()
  tra_check_num = @randomizer.roll_once(12)
  unless tra_check_num == 12
    return Result.new("罠動作チェック(1D12) > #{tra_check_num} > 罠は動作していなかった")
  end

  chase_num = @randomizer.roll_once(12)
  chase = case chase_num
          when 1, 2, 3, 4 then '小型動物'
          when 5, 6, 7, 8 then '大型動物'
          when 9, 10, 11, 12 then '人間の放浪者'
          end
  Result.new("罠動作チェック(1D12) > #{tra_check_num} > 罠が動作していた! > 獲物表(#{chase_num}) > #{chase}が罠にかかっていた")
end