class BCDice::GameSystem::MetalHead
Constants
- HELP_MESSAGE
ダイスボットの使い方
- ID
ゲームシステムの識別子
- NAME
ゲームシステム名
- SORT_KEY
ゲームシステム名の読みがな
- TABLES
表の集合
- TABLE_ROLL_RESULT_FORMATTER
表を振った結果の整形処理
Public Instance Methods
change_text(string)
click to toggle source
# File lib/bcdice/game_system/MetalHead.rb, line 59 def change_text(string) string = string.gsub(/^(S)?AR/i) { "#{Regexp.last_match(1)}2D6" } string = string.gsub(/^(S)?SR/i) { "#{Regexp.last_match(1)}1D100" } return string end
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/MetalHead.rb, line 40 def eval_game_system_specific_command(command) result = roll_tables(command, TABLES) return result if result case command when /\ACRC(\w)(\d+)\z/ suv = Regexp.last_match(1) num = Regexp.last_match(2) return mh_crc_table(suv, num) when /\AHR<=(.+)/ target = ArithmeticEvaluator.eval( Regexp.last_match(1), round_type: @round_type ) return rollHit(target) end return nil end
getHitResult(total_n, _dice_n, diff)
click to toggle source
# File lib/bcdice/game_system/MetalHead.rb, line 94 def getHitResult(total_n, _dice_n, diff) diceValue = total_n % 100 dice1 = diceValue % 10 # 1の位を代入 debug("total_n", total_n) return ' > 失敗' if total_n > diff return ' > 成功(クリティカル)' if dice1 == 1 return ' > 失敗(アクシデント)' if dice1 == 0 return ' > 成功' end
mh_crc_table(suv, num)
click to toggle source
戦闘結果チャートを振る @param [String] suv 耐久レベル @param [String] num 数値 @return [String] 振った結果
# File lib/bcdice/game_system/MetalHead.rb, line 112 def mh_crc_table(suv, num) header_parts = ['戦闘結果チャート', num] separator = ' > ' suv = suv.to_s.upcase numbuf = num.to_i if numbuf < 1 return (header_parts + ['数値が不正です']).join(separator) end num_d1 = numbuf % 10 debug("num_d1[#{num_d1}]") if num_d1 == 1 numbuf += 1 end if num_d1 == 0 numbuf -= 1 end num_d1 = numbuf % 10 debug("num_d1[#{num_d1}]") table_point = [ nil, # 0 nil, # 1 "腕部", # 2 "腕部", # 3 "脚部", # 4 "脚部", # 5 "胴部", # 6 "胴部", # 7 "胴部", # 8 "頭部", # 9 ] table_damage = { 'S' => [{'N' => 2}, {'LW' => 16}, {'MD' => 46}, {'MW' => 56}, {'HD' => 76}, {'HW' => 96}, {'MO' => 106}, {'K' => 116}], 'A' => [{'LW' => 2}, {'MW' => 46}, {'HW' => 76}, {'MO' => 96}, {'K' => 116}], 'B' => [{'LW' => 2}, {'MW' => 36}, {'HW' => 66}, {'MO' => 96}, {'K' => 106}], 'C' => [{'LW' => 2}, {'MW' => 26}, {'HW' => 66}, {'MO' => 86}, {'K' => 106}], 'D' => [{'LW' => 2}, {'MW' => 26}, {'HW' => 46}, {'MO' => 76}, {'K' => 96}], 'E' => [{'LW' => 2}, {'MW' => 26}, {'HW' => 39}, {'MO' => 54}, {'K' => 76}], 'F' => [{'LW' => 2}, {'MW' => 16}, {'HW' => 39}, {'MO' => 54}, {'K' => 66}], 'G' => [{'LW' => 2}, {'MW' => 6}, {'HW' => 16}, {'MO' => 26}, {'K' => 39}], 'M' => [{'0' => 2}, {'1' => 22}, {'2' => 42}, {'3' => 62}, {'4' => 82}, {'5' => 92}, {'6' => 102}, {'8' => 112}], } if table_damage[suv].nil? return (header_parts + [ "耐久レベル(SUV)[#{suv}]", "耐久レベル(SUV)の値が不正です", ]).join(separator) end damage_level = '' table_damage[suv].each do |v| v.each do |d, n| debug("suv[#{suv}] #{v} #{d} #{n}") if n <= numbuf damage_level = d end end end result_parts = [] if numbuf != num.to_i result_parts.push(numbuf.to_s) end if suv == 'M' result_parts.push('耐物', "HP[#{damage_level}]") else result_parts.push( "耐久レベル(SUV)[#{suv}]", "部位[#{table_point[num_d1]}] : 損傷種別[#{damage_level}]" ) end return (header_parts + result_parts).join(separator) end
result_1d100(_total, dice_total, cmp_op, _target)
click to toggle source
# File lib/bcdice/game_system/MetalHead.rb, line 84 def result_1d100(_total, dice_total, cmp_op, _target) return nil unless cmp_op == :<= if dice_total <= 5 Result.critical("絶対成功") elsif dice_total >= 96 Result.fumble("絶対失敗") end end
result_2d6(_total, dice_total, _dice_list, cmp_op, _target)
click to toggle source
# File lib/bcdice/game_system/MetalHead.rb, line 65 def result_2d6(_total, dice_total, _dice_list, cmp_op, _target) return nil if cmp_op != :>= if dice_total >= 12 Result.critical("絶対成功") elsif dice_total <= 2 Result.fumble("絶対失敗") end end
rollHit(target)
click to toggle source
# File lib/bcdice/game_system/MetalHead.rb, line 75 def rollHit(target) total = @randomizer.roll_once(100) resultText = getHitResult(total, total, target) text = "(1D100<=#{target}) > #{total}#{resultText}" return text end