Class: BCDice::GameSystem::NightmareHunterDeep
- Defined in:
- lib/bcdice/game_system/NightmareHunterDeep.rb
Constant Summary collapse
- ID =
ゲームシステムの識別子
'NightmareHunterDeep'- NAME =
ゲームシステム名
'ナイトメアハンター=ディープ'- SORT_KEY =
ゲームシステム名の読みがな
'ないとめあはんたあていいふ'- HELP_MESSAGE =
ダイスボットの使い方
"\u5224\u5B9A\uFF08xD6+y>=a, xD6+y, xD6)\n \u51FA\u76EE6\u306E\u500B\u6570\u3092\u30AB\u30A6\u30F3\u30C8\u3057\u3066\u3001\u305D\u306E4\u500D\u3092\u5408\u8A08\u5024\u306B\u52A0\u7B97\u3057\u307E\u3059\u3002\n \u307E\u305F\u3001\u5BBF\u547D\u3092\u7372\u5F97\u3057\u305F\u304B\u8868\u793A\u3057\u307E\u3059\u3002\n\n Lv\u76EE\u6A19\u5024 (xD6+y>=LVn, xD6+y>=NLn)\n \u30EC\u30D9\u30EB\u3067\u76EE\u6A19\u5024\u3092\u6307\u5B9A\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\n LVn -> n*5+1, NLn -> n*5+5 \u306B\u5909\u63DB\u3055\u308C\u307E\u3059\u3002\n \u76EE\u6A19\u5024'?' (xD6+y>=?)\n \u76EE\u6A19\u5024\u3092 '?' \u306B\u3059\u308B\u3068\u4F55Lv\u6210\u529F\u304B\u3001\u4F55NL\u6210\u529F\u304B\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n\n\u203B\u5224\u5B9A\u30B3\u30DE\u30F3\u30C9\u306F xD6 \u304B\u3089\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u307E\u305F xD6 \u304C\u8907\u6570\u3042\u308B\u3068\u53CD\u5FDC\u3057\u307E\u305B\u3093\u3002\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
- #dice_revision(dice_list) ⇒ Object
- #eval_game_system_specific_command(command) ⇒ Object
- #expr_with_revision(total, suffix) ⇒ Object
-
#fate(dice_list) ⇒ Object
ナイトメアハンターディープ用宿命表示.
-
#initialize(command) ⇒ NightmareHunterDeep
constructor
A new instance of NightmareHunterDeep.
- #interim_expr(cmd, dice_total, dice_list) ⇒ Object
- #result_text(total, cmp_op, target) ⇒ Object
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) ⇒ NightmareHunterDeep
Returns a new instance of NightmareHunterDeep.
34 35 36 37 38 |
# File 'lib/bcdice/game_system/NightmareHunterDeep.rb', line 34 def initialize(command) super(command) @sort_add_dice = true end |
Instance Method Details
#dice_revision(dice_list) ⇒ Object
106 107 108 109 110 111 112 113 |
# File 'lib/bcdice/game_system/NightmareHunterDeep.rb', line 106 def dice_revision(dice_list) count6 = dice_list.count(6) if count6 > 0 return "+#{count6}*4", count6 * 4 else return nil, 0 end end |
#eval_game_system_specific_command(command) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/bcdice/game_system/NightmareHunterDeep.rb', line 40 def eval_game_system_specific_command(command) command = command .sub(/Lv(\d+)/i) { (Regexp.last_match(1).to_i * 5 - 1).to_s } .sub(/NL(\d+)/i) { (Regexp.last_match(1).to_i * 5 + 5).to_s } parser = Command::Parser.new(/\d+D6/, round_type: round_type) .restrict_cmp_op_to(nil, :>=) .enable_question_target() cmd = parser.parse(command) unless cmd return nil end times = cmd.command.to_i dice_list = @randomizer.(times, 6).sort dice_total = dice_list.sum() total = dice_total + cmd.modify_number suffix, revision = dice_revision(dice_list) total += revision target = cmd.question_target? ? "?" : cmd.target_number result = result_text(total, cmd.cmp_op, target) sequence = [ "(#{cmd})", interim_expr(cmd, dice_total, dice_list), expr_with_revision(dice_total + cmd.modify_number, suffix), total, result, fate(dice_list), ].compact return sequence.join(" > ") end |
#expr_with_revision(total, suffix) ⇒ Object
102 103 104 |
# File 'lib/bcdice/game_system/NightmareHunterDeep.rb', line 102 def expr_with_revision(total, suffix) suffix ? "#{total}#{suffix}" : nil end |
#fate(dice_list) ⇒ Object
ナイトメアハンターディープ用宿命表示
91 92 93 |
# File 'lib/bcdice/game_system/NightmareHunterDeep.rb', line 91 def fate(dice_list) dice_list.count(1) > 0 ? "宿命獲得" : nil end |
#interim_expr(cmd, dice_total, dice_list) ⇒ Object
95 96 97 98 99 100 |
# File 'lib/bcdice/game_system/NightmareHunterDeep.rb', line 95 def interim_expr(cmd, dice_total, dice_list) if dice_list.size > 1 || cmd.modify_number != 0 modifier = Format.modifier(cmd.modify_number) "#{dice_total}[#{dice_list.join(',')}]#{modifier}" end end |
#result_text(total, cmp_op, target) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/bcdice/game_system/NightmareHunterDeep.rb', line 77 def result_text(total, cmp_op, target) return nil unless cmp_op == :>= if target != "?" return total >= target ? "成功" : "失敗" end success_lv = (total + 1) / 5 success_nl = (total - 5) / 5 return success_lv > 0 ? "Lv#{success_lv}/NL#{success_nl}成功" : "失敗" end |