Class: BCDice::GameSystem::HatsuneMiku
- Defined in:
- lib/bcdice/game_system/HatsuneMiku.rb
Direct Known Subclasses
Constant Summary collapse
- ID =
ゲームシステムの識別子
'HatsuneMiku'- NAME =
ゲームシステム名
'初音ミクTRPG ココロダンジョン'- SORT_KEY =
ゲームシステム名の読みがな
'はつねみくTRPGこころたんしよん'- HELP_MESSAGE =
ダイスボットの使い方
"\u30FB\u5224\u5B9A(Rx\u00B1y@z>=t)\n\u3000\u80FD\u529B\u5024\u306E\u30C0\u30A4\u30B9\u3054\u3068\u306B\u6210\u529F\u30FB\u5931\u6557\u306E\u5224\u5B9A\u3092\u884C\u3044\u307E\u3059\u3002\n\u3000x\uFF1A\u80FD\u529B\u30E9\u30F3\u30AF(S,A\uFF5ED)\u3002\u6570\u5B57\u6307\u5B9A\u3067\u76F4\u63A5\u305D\u306E\u500B\u6570\u306E\u30C0\u30A4\u30B9\u304C\u632F\u308C\u307E\u3059\n\u3000y\uFF1A\u4FEE\u6B63\u5024\u3002A+2 \u3042\u308B\u3044\u306F A++ \u306E\u3088\u3046\u306B\u8868\u8A18\u3002\u6DF7\u5728\u6642\u306F A++,+1 \u306E\u3088\u3046\u306B\u8A18\u8FF0\u3082\u53EF\u80FD\n\u3000z\uFF1A\u30B9\u30DA\u30B7\u30E3\u30EB\u6700\u4F4E\u5024\uFF08\u7701\u7565\uFF1A6\uFF09\u3000t\uFF1A\u76EE\u6A19\u5024\uFF08\u7701\u7565\uFF1A4\uFF09\n\u3000\u3000\u4F8B\uFF09 RA\u3000R2\u3000RB+1\u3000RC++\u3000RD+,+2\u3000RA>=5\u3000RS-1@5>=6\n\u3000\u7D50\u679C\u306F\u30CD\u30A4\u30ED\u3092\u53D6\u5F97\u3057\u305F\u6B8B\u308A\u3067\u6700\u5927\u5024\u3092\u8868\u793A\n\u4F8B\uFF09 RB\n\u3000HatsuneMiku : (RB>=4) \uFF1E [3,5] \uFF1E\n\u3000\u3000\u30CD\u30A4\u30ED\u306B3(\u9752)\u3092\u53D6\u5F97\u3057\u305F\u5834\u5408 5:\u6210\u529F\n\u3000\u3000\u30CD\u30A4\u30ED\u306B5(\u767D)\u3092\u53D6\u5F97\u3057\u305F\u5834\u5408 3:\u5931\u6557\n\u30FB\u5404\u7A2E\u8868\n\u3000\u30D5\u30A1\u30F3\u30D6\u30EB\u8868 FT\uFF0F\u81F4\u547D\u50B7\u8868 CWT\uFF0F\u4F11\u61A9\u8868 BT\uFF0F\u76EE\u6A19\u8868 TT\uFF0F\u95A2\u4FC2\u8868 RT\n\u3000\u969C\u5BB3\u8868 OT\uFF0F\u30EA\u30AF\u30A8\u30B9\u30C8\u8868 RQT\uFF0F\u30AF\u30ED\u30A6\u30EB\u8868 CLT\uFF0F\u5831\u916C\u8868 RWT\uFF0F\u60AA\u5922\u8868 NMT\uFF0F\u60C5\u666F\u8868 ST\n\u30FB\u30AD\u30FC\u30EF\u30FC\u30C9\u8868\n\u3000\u30C0\u30FC\u30AF DKT\uFF0F\u30DB\u30C3\u30C8 HKT\uFF0F\u30E9\u30D6 LKT\uFF0F\u30A8\u30AD\u30BB\u30F3\u30C8\u30EA\u30C3\u30AF EKT\uFF0F\u30E1\u30E9\u30F3\u30B3\u30EA\u30FC MKT\n\u30FB\u540D\u524D\u8868 NT\n\u3000\u30B3\u30A2\u5225\u3000\u30C0\u30FC\u30AF DNT\uFF0F\u30DB\u30C3\u30C8 HNT\uFF0F\u30E9\u30D6 LNT\uFF0F\u30A8\u30AD\u30BB\u30F3\u30C8\u30EA\u30C3\u30AF ENT\uFF0F\u30E1\u30E9\u30F3\u30B3\u30EA\u30FC MNT\n\u30FB\u30AA\u30C8\u30C0\u30DE\u5404\u7A2E\u8868\n\u3000\u6027\u683C\u8868A OPA\uFF0F\u6027\u683C\u8868B OPB\uFF0F\u8DA3\u5473\u8868 OHT\uFF0F\u5916\u898B\u8868 OLT\uFF0F\u4E00\u4EBA\u79F0\u8868 OIT\uFF0F\u547C\u3073\u540D\u8868 OYT\n\u3000\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u8868 ORT\uFF0F\u51FA\u4F1A\u3044\u8868 OMT\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
- #check_success(total_n, dice_n, signOfInequality, diff, special_n) ⇒ Object
- #eval_game_system_specific_command(command) ⇒ Object
- #getChangedModifyText(text) ⇒ Object
-
#initialize(command) ⇒ HatsuneMiku
constructor
A new instance of HatsuneMiku.
- #judgeRoll(command) ⇒ 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) ⇒ HatsuneMiku
40 41 42 43 44 |
# File 'lib/bcdice/game_system/HatsuneMiku.rb', line 40 def initialize(command) super(command) @d66_sort_type = D66SortType::ASC end |
Instance Method Details
#check_success(total_n, dice_n, signOfInequality, diff, special_n) ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/bcdice/game_system/HatsuneMiku.rb', line 135 def check_success(total_n, dice_n, signOfInequality, diff, special_n) return translate('fumble') if dice_n == 1 return translate('HatsuneMiku.special') if dice_n >= special_n cmp_op = Normalize.comparison_operator(signOfInequality) target_num = diff.to_i if total_n.send(cmp_op, target_num) translate('success') else translate('failure') end end |
#eval_game_system_specific_command(command) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/bcdice/game_system/HatsuneMiku.rb', line 46 def eval_game_system_specific_command(command) text = judgeRoll(command) return text unless text.nil? return roll_tables(command, self.class::TABLES) end |
#getChangedModifyText(text) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/bcdice/game_system/HatsuneMiku.rb', line 117 def getChangedModifyText(text) modifyText = "" values = text.split(/,/) values.each do |value| case value when "++" modifyText += "+2" when "+" modifyText += "+1" else modifyText += value end end return modifyText end |
#judgeRoll(command) ⇒ Object
53 54 55 56 57 58 59 60 61 62 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/bcdice/game_system/HatsuneMiku.rb', line 53 def judgeRoll(command) return nil unless /^(R([A-DS]|\d+)([+\-\d,]*))(@(\d))?((>(=)?)([+\-\d]*))?(@(\d))?$/i =~ command skillRank = Regexp.last_match(2) modifyText = Regexp.last_match(3) signOfInequality = (Regexp.last_match(7).nil? ? ">=" : Regexp.last_match(7)) targetText = (Regexp.last_match(9).nil? ? "4" : Regexp.last_match(9)) specialNum = Regexp.last_match(5) specialNum ||= Regexp.last_match(11) specialNum ||= 6 specialNum = specialNum.to_i specialText = (specialNum == 6 ? "" : "@#{specialNum}") modifyText = getChangedModifyText(modifyText) commandText = "R#{skillRank}#{modifyText}" rankDiceList = {"S" => 4, "A" => 3, "B" => 2, "C" => 1, "D" => 2} diceCount = rankDiceList[skillRank] diceCount = skillRank.to_i if skillRank =~ /^\d+$/ modify = ArithmeticEvaluator.eval(modifyText) target = ArithmeticEvaluator.eval(targetText) diceList = @randomizer.(diceCount, 6).sort diceText = diceList.join(",") diceList = [diceList.min] if skillRank == "D" = "(#{commandText}#{specialText}#{signOfInequality}#{targetText}) > [#{diceText}]#{modifyText} > " if diceList.length <= 1 dice = diceList.first total = dice + modify result = check_success(total, dice, signOfInequality, target, specialNum) += "#{total}:#{result}" else texts = [] diceList.each_with_index do |pickup_dice, index| rests = diceList.clone rests.delete_at(index) dice = rests.max total = dice + modify result = check_success(total, dice, signOfInequality, target, specialNum) colorList = [ translate('HatsuneMiku.color_black'), translate('HatsuneMiku.color_red'), translate('HatsuneMiku.color_blue'), translate('HatsuneMiku.color_green'), translate('HatsuneMiku.color_white'), translate('HatsuneMiku.color_any'), ] color = colorList[pickup_dice - 1] texts << translate('HatsuneMiku.neiro_acquire', pickup_dice: pickup_dice, color: color, total: total, result: result) end texts.uniq! += "\n" + texts.join("\n") end return end |