Class: BCDice::GameSystem::CodeLayerd
- Defined in:
- lib/bcdice/game_system/CodeLayerd.rb
Constant Summary collapse
- ID =
ゲームシステムの識別子
'CodeLayerd'
- NAME =
ゲームシステム名
'コード:レイヤード'
- SORT_KEY =
ゲームシステム名の読みがな
'こおとれいやあと'
- HELP_MESSAGE =
ダイスボットの使い方
"\u30FB\u884C\u70BA\u5224\u5B9A\uFF08nCL@m[c]+x \u307E\u305F\u306F nCL+x@m[c]\uFF09 \u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u30FB\u30D5\u30A1\u30F3\u30D6\u30EB\u5224\u5B9A\u3042\u308A\n (\u30C0\u30A4\u30B9\u6570)CL+(\u4FEE\u6B63\u5024)@(\u5224\u5B9A\u5024)[(\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u5024)]+(\u4FEE\u6B63\u50242)\n\n @m,[c],+x\u306F\u7701\u7565\u53EF\u80FD\u3002(@6[1]\u3068\u3057\u3066\u51E6\u7406)\n n\u500B\u306ED10\u3067m\u3092\u5224\u5B9A\u5024\u3001c\u3092\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u5024\u3068\u3057\u305F\u884C\u70BA\u5224\u5B9A\u3092\u884C\u3046\u3002\n n\u304C0\u4EE5\u4E0B\u306E\u3068\u304D\u306F\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u3057\u306A\u30441CL\u5224\u5B9A\u3092\u884C\u3046\u3002(1CL[0]\u3068\u540C\u4E00)\n \u4F8B\uFF09\n 7CL>=5 \uFF1A\u30B5\u30A4\u30B3\u30ED7\u500B\u3067\u5224\u5B9A\u50246\u306E\u30ED\u30FC\u30EB\u3092\u884C\u3044\u3001\u76EE\u6A19\u50245\u306B\u5BFE\u3057\u3066\u5224\u5B9A\n 4CL@7 \uFF1A\u30B5\u30A4\u30B3\u30ED4\u500B\u3067\u5224\u5B9A\u50247\u306E\u30ED\u30FC\u30EB\u3092\u884C\u3044\u9054\u6210\u5024\u3092\u51FA\u3059\n 4CL+2@7 \u307E\u305F\u306F 4CL@7+2 \uFF1A\u30B5\u30A4\u30B3\u30ED4\u500B\u3067\u5224\u5B9A\u50247\u306E\u30ED\u30FC\u30EB\u3092\u884C\u3044\u9054\u6210\u5024\u3092\u51FA\u3057\u3001\u4FEE\u6B63\u50242\u3092\u8DB3\u3059\u3002\n 4CL[2] \uFF1A\u30B5\u30A4\u30B3\u30ED4\u500B\u3067\u30AF\u30EA\u30C6\u30A3\u30AB\u30EB\u50242\u306E\u30ED\u30FC\u30EB\u3092\u884C\u3046\u3002\n 0CL : 1CL[0]\u3068\u540C\u3058\u5224\u5B9A\n\n \u30C7\u30D5\u30A9\u30EB\u30C8\u30C0\u30A4\u30B9\uFF1A10\u9762\n"
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
- #check_roll(base, target, critical_target, diff, modifier) ⇒ Object
- #eval_game_system_specific_command(command) ⇒ Object
-
#initialize(command) ⇒ CodeLayerd
constructor
A new instance of CodeLayerd.
Methods inherited from Base
#change_text, #check_result, command_pattern, #enable_debug, #enabled_d9?, #eval, eval, #grich_text, prefixes_pattern, register_prefix, register_prefix_from_super_class, #sort_add_dice?, #sort_barabara_dice?
Methods included from Translate
Constructor Details
#initialize(command) ⇒ CodeLayerd
35 36 37 38 39 |
# File 'lib/bcdice/game_system/CodeLayerd.rb', line 35 def initialize(command) super(command) @sides_implicit_d = 10 end |
Instance Method Details
#check_roll(base, target, critical_target, diff, modifier) ⇒ 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 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/bcdice/game_system/CodeLayerd.rb', line 63 def check_roll(base, target, critical_target, diff, modifier) if base <= 0 # クリティカルしない1D critical_target = 0 base = 1 end target = 10 if target > 10 dice_list = @randomizer.(base, 10).sort success_count = dice_list.count { |x| x <= target } critical_count = dice_list.count { |x| x <= critical_target } success_total = success_count + critical_count + modifier mod_text = Format.modifier(modifier) # (10d10+5) result = "(#{base}d10#{mod_text}) > [#{dice_list.join(',')}]#{mod_text} > " result += "判定値[#{target}] " unless target == 6 result += "クリティカル値[#{critical_target}] " unless critical_target == 1 result += "達成値[#{success_count}]" return "#{result} > ファンブル!" if success_count <= 0 result += "+クリティカル[#{critical_count}]" if critical_count > 0 result += mod_text result += "=[#{success_total}]" if critical_count > 0 || modifier != 0 success_text = if diff == 0 success_total.to_s elsif success_total >= diff "成功" else "失敗" end return "#{result} > #{success_text}" end |
#eval_game_system_specific_command(command) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/bcdice/game_system/CodeLayerd.rb', line 41 def eval_game_system_specific_command(command) debug('eval_game_system_specific_command command', command) result = '' case command when /([+-]?\d+)?CL([+-]\d+)?(@(\d))?(\[(\d+)\])?([+-]\d+)?(>=(\d+))?/i m = Regexp.last_match base = (m[1] || 1).to_i modifier1 = m[2].to_i target = (m[4] || 6).to_i critical_target = (m[6] || 1).to_i modifier2 = m[7].to_i diff = m[9].to_i result = check_roll(base, target, critical_target, diff, modifier1 + modifier2) end return nil if result.empty? return "#{command} > #{result}" end |