Class: BCDice::GameSystem::KemonoNoMori

Inherits:
Base
  • Object
show all
Defined in:
lib/bcdice/game_system/KemonoNoMori.rb

Direct Known Subclasses

KemonoNoMori_Korean

Constant Summary collapse

ID =

ゲームシステムの識別子

'KemonoNoMori'
NAME =

ゲームシステム名

'獸ノ森'
SORT_KEY =

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

'けもののもり'
HELP_MESSAGE =

ダイスボットの使い方

"\u30FB\u884C\u70BA\u5224\u5B9A(\u6210\u529F\u5EA6\u81EA\u52D5\u7B97\u51FA)(P119): KAx[\u00B1y]\n\u30FB\u7D99\u7D9A\u5224\u5B9A(\u6210\u529F\u5EA6+1\u56FA\u5B9A): KCx[\u00B1y]\n   x=\u76EE\u6A19\u5024\n   y=\u76EE\u6A19\u5024\u3078\u306E\u4FEE\u6B63(\u4EFB\u610F) x+y-z \u306E\u3088\u3046\u306B\u8907\u6570\u6307\u5B9A\u53EF\u80FD\n     \u4F8B1\uFF09KA7+3 \u2192 \u76EE\u6A19\u50247\u306B\u30D7\u30E9\u30B93\u306E\u4FEE\u6B63\u3092\u52A0\u3048\u305F\u884C\u70BA\u5224\u5B9A\n     \u4F8B2\uFF09KC6 \u2192 \u76EE\u6A19\u50246\u306E\u7D99\u7D9A\u5224\u5B9A\n\u30FB\u7F60\u52D5\u4F5C\u30C1\u30A7\u30C3\u30AF+\u7372\u7269\u8868(P163): CTR\n   \u7F60\u3054\u3068\u306B1D12\u3092\u632F\u308A\u300112\u304C\u51FA\u305F\u5834\u5408\u306B\u306F\u751F\u304D\u7269\u304C\u7F60\u3092\u52D5\u4F5C\u3055\u305B\u3001\u305D\u306E\u5F71\u97FF\u3092\u53D7\u3051\u3066\u3044\u308B\u3002\n\u30FB\u5404\u7A2E\u8868\uFF08\u57FA\u672C\u30EB\u30FC\u30EB\u30D6\u30C3\u30AF\uFF09\n  \u30FB\u5927\u5931\u6557\u8868(P120): FT\n  \u30FB\u80FD\u529B\u5024\u30E9\u30F3\u30C0\u30E0\u6C7A\u5B9A\u8868(P121): RST\n  \u30FB\u30E9\u30F3\u30C0\u30E0\u6240\u8981\u6642\u9593\u8868(P122): RTT\n  \u30FB\u30E9\u30F3\u30C0\u30E0\u6D88\u8017\u8868(P122): RET\n  \u30FB\u30E9\u30F3\u30C0\u30E0\u5929\u6C17\u8868(P128): RWT\n  \u30FB\u30E9\u30F3\u30C0\u30E0\u5929\u6C17\u6301\u7D9A\u8868(P128): RWDT\n  \u30FB\u30E9\u30F3\u30C0\u30E0\u906E\u853D\u7269\u8868\uFF08\u5C4B\u5916\uFF09(P140): ROMT\n  \u30FB\u30E9\u30F3\u30C0\u30E0\u906E\u853D\u7269\u8868\uFF08\u5C4B\u5185\uFF09(P140): RIMT\n  \u30FB\u9003\u8D70\u4F53\u9A13\u8868(P144): EET\n  \u30FB\u98DF\u6750\u63A1\u96C6\u8868(P157): GFT\n  \u30FB\u6C34\u63A1\u96C6\u8868(P157): GWT\n  \u30FB\u767D\u306E\u9B54\u77F3\u52B9\u679C\u8868(P186): WST\n\u30FB\u90E8\u4F4D\u30C0\u30E1\u30FC\u30B8\u95A2\u9023\u306E\u8868\uFF08\u53C2\u7167\u5148\u30DA\u30FC\u30B8\u306F\u30EA\u30D7\u30EC\u30A4&\u30C7\u30FC\u30BF\u30D6\u30C3\u30AF\u300C\u5699\u795E\u30CE\u5BB4\u300D\u306E\u3082\u306E\uFF09\n  \u30FB\u4EBA\u9593\u90E8\u4F4D\u8868(P216): HPT\n  \u30FB\u90E8\u4F4D\u30C0\u30E1\u30FC\u30B8\u6BB5\u968E\u8868(P217): PDT\n  \u30FB\u56DB\u8DB3\u52D5\u7269\u90E8\u4F4D\u8868(P225): QPT\n  \u30FB\u7121\u8DB3\u52D5\u7269\u90E8\u4F4D\u8868(P225): APT\n  \u30FB\u4E8C\u8DB3\u52D5\u7269\u90E8\u4F4D\u8868(P226): TPT\n  \u30FB\u9CE5\u90E8\u4F4D\u8868(P226): BPT\n  \u30FB\u982D\u8DB3\u52D5\u7269\u90E8\u4F4D\u8868(P227): CPT\n  \u30FB\u6606\u866B\u90E8\u4F4D\u8868(P227): IPT\n  \u30FB\u8718\u86DB\u90E8\u4F4D\u8868(P228): SPT\n"
TABLES =
translate_tables(:ja_jp).freeze

Instance Attribute Summary

Attributes inherited from Base

#d66_sort_type, #default_cmp_op, #default_target_number, #randomizer, #reroll_dice_reroll_threshold, #round_type, #sides_implicit_d, #upper_dice_reroll_threshold

Instance Method Summary collapse

Methods inherited from Base

#change_text, #check_result, command_pattern, #enable_debug, #enabled_d9?, #eval, eval, #grich_text, #initialize, prefixes_pattern, register_prefix, register_prefix_from_super_class, #sort_add_dice?, #sort_barabara_dice?

Methods included from Translate

#translate

Constructor Details

This class inherits a constructor from BCDice::Base

Instance Method Details

#check_1D12(command, is_action_judge) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/bcdice/game_system/KemonoNoMori.rb', line 63

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} > #{translate('KemonoNoMori.fumble')}")
  elsif dice_total == 11
    Result.critical("(1D12<=#{target_total}) > #{dice_total} > #{translate('KemonoNoMori.critical', success_degree: success_degree)}")
  elsif dice_total <= target_total
    Result.success("(1D12<=#{target_total}) > #{dice_total} > #{translate('KemonoNoMori.success', success_degree: success_degree)}")
  else
    Result.failure("(1D12<=#{target_total}) > #{dice_total} > #{translate('failure')}")
  end
end

#eval_game_system_specific_command(command) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/bcdice/game_system/KemonoNoMori.rb', line 53

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, self.class::TABLES)
  end
end

#get_escape_experience_table_result(command) ⇒ Object



105
106
107
108
109
# File 'lib/bcdice/game_system/KemonoNoMori.rb', line 105

def get_escape_experience_table_result(command)
  escape_experience = roll_tables(command, self.class::TABLES)
  escape_duration = @randomizer.roll_once(12)
  Result.new("#{escape_experience} (#{translate('KemonoNoMori.reappear', hours: escape_duration)})")
end

#get_trap_resultObject



90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/bcdice/game_system/KemonoNoMori.rb', line 90

def get_trap_result()
  tra_check_num = @randomizer.roll_once(12)
  unless tra_check_num == 12
    return Result.new(translate('KemonoNoMori.trap_not_activated', check_num: tra_check_num))
  end

  chase_num = @randomizer.roll_once(12)
  chase_key = case chase_num
              when 1..4  then 'KemonoNoMori.trap_activated_small'
              when 5..8  then 'KemonoNoMori.trap_activated_large'
              when 9..12 then 'KemonoNoMori.trap_activated_human'
              end
  Result.new(translate(chase_key, check_num: tra_check_num, chase_num: chase_num))
end