Class: BCDice::GameSystem::HarnMaster
- Defined in:
- lib/bcdice/game_system/HarnMaster.rb
Constant Summary collapse
- ID =
ゲームシステムの識別子
'HarnMaster'
- NAME =
ゲームシステム名
'ハーンマスター'
- SORT_KEY =
ゲームシステム名の読みがな
'はあんますたあ'
- HELP_MESSAGE =
ダイスボットの使い方
<<~MESSAGETEXT ・判定 1D100<=XX の判定時に致命的失敗・決定的成功を判定 ・ショック判定(SHKx) 例)SHK13,3 ・人型用 中段命中部位表 (SLH)/上段命中部位 (SLHU)/上段命中部位 (SLHD) MESSAGETEXT
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_1D100(total, _dice_total, cmp_op, target) ⇒ Object
- #eval_game_system_specific_command(command) ⇒ Object
- #getCheckResult(total, diff) ⇒ Object
- #getCheckShockResult(damage, toughness) ⇒ Object
- #getFaceLocation(part) ⇒ Object
- #getFailResult(total) ⇒ Object
- #getLocationSide(part, number) ⇒ Object
- #getStrikeLocationHuman(type) ⇒ Object
- #getStrikeLocationHumanDownTable ⇒ Object
- #getStrikeLocationHumanNormalTable ⇒ Object
- #getStrikeLocationHumanUpperTable ⇒ Object
- #getSuccessResult(total) ⇒ Object
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
Constructor Details
This class inherits a constructor from BCDice::Base
Instance Method Details
#check_1D100(total, _dice_total, cmp_op, target) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 26 def check_1D100(total, _dice_total, cmp_op, target) return '' if target == '?' return '' unless cmp_op == :<= result = getCheckResult(total, target) return " > #{result}" end |
#eval_game_system_specific_command(command) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 52 def eval_game_system_specific_command(command) result = nil case command when /^SHK(\d*),(\d+)/i toughness = Regexp.last_match(1).to_i damage = Regexp.last_match(2).to_i result = getCheckShockResult(damage, toughness) when /SLH(U|D)?/i type = Regexp.last_match(1) result = getStrikeLocationHuman(type) else result = nil end return result rescue StandardError => e return e. end |
#getCheckResult(total, diff) ⇒ Object
34 35 36 37 38 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 34 def getCheckResult(total, diff) return getFailResult(total) if total > diff return getSuccessResult(total) end |
#getCheckShockResult(damage, toughness) ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 72 def getCheckShockResult(damage, toughness) dice_list = @randomizer.(damage, 6) dice = dice_list.sum() diceText = dice_list.join(",") result = (dice <= toughness ? '成功' : '失敗') text = "ショック判定(ダメージ:#{damage}, 耐久力:#{toughness}) > (#{dice}[#{diceText}]) > #{result}" return text end |
#getFaceLocation(part) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 124 def getFaceLocation(part) debug("getFaceLocation part", part) unless part =~ /\+$/ debug("is NOT Face") return part end debug("is Face") table = [ [15, "顎"], [30, "*目"], [64, "*頬"], [80, "鼻"], [90, "*耳"], [100, "口"], ] number = @randomizer.roll_once(100) faceLocation = get_table_by_number(number, table) debug("faceLocation", faceLocation) debug("number", number) faceLocation = getLocationSide(faceLocation, number) result = part.sub(/\+$/, " > (#{number})#{faceLocation}") return result end |
#getFailResult(total) ⇒ Object
40 41 42 43 44 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 40 def getFailResult(total) return "致命的失敗" if (total % 5) == 0 return "失敗" end |
#getLocationSide(part, number) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 111 def getLocationSide(part, number) unless part =~ /^\*/ debug("part has NO side", part) return part end debug("part has side", part) side = (number.odd? ? "左" : "右") part.sub(/\*/, side) end |
#getStrikeLocationHuman(type) ⇒ Object
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 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 83 def getStrikeLocationHuman(type) typeName = '' table = nil case type when 'U' typeName = "命中部位(人型 上段)" table = getStrikeLocationHumanUpperTable() when 'D' typeName = "命中部位(人型 下段)" table = getStrikeLocationHumanDownTable() when nil typeName = "命中部位(人型 中段)" table = getStrikeLocationHumanNormalTable() else raise "unknow atak type #{type}" end number = @randomizer.roll_once(100) part = get_table_by_number(number, table) part = getLocationSide(part, number) part = getFaceLocation(part) result = "#{typeName} > (#{number})#{part}" return result end |
#getStrikeLocationHumanDownTable ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 191 def getStrikeLocationHumanDownTable() table = [ [6, "*前腕"], [12, "*手"], [19, "胸部"], [29, "腹部"], [35, "股間"], [49, "*臀部"], [70, "*腿"], [78, "*膝"], [92, "*脛"], [100, "*足"], ] return table end |
#getStrikeLocationHumanNormalTable ⇒ Object
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 169 def getStrikeLocationHumanNormalTable() table = [ [5, "頭部"], [10, "顔+"], [15, "首"], [27, "*肩"], [33, "*上腕"], [35, "*肘"], [39, "*前腕"], [43, "*手"], [60, "胸部"], [70, "腹部"], [74, "股間"], [80, "*臀部"], [88, "*腿"], [90, "*膝"], [96, "*脛"], [100, "*足"], ] return table end |
#getStrikeLocationHumanUpperTable ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 153 def getStrikeLocationHumanUpperTable() table = [ [15, "頭部"], [30, "顔+"], [45, "首"], [57, "*肩"], [69, "*上腕"], [73, "*肘"], [81, "*前腕"], [85, "*手"], [95, "胸部"], [100, "腹部"], ] return table end |
#getSuccessResult(total) ⇒ Object
46 47 48 49 50 |
# File 'lib/bcdice/game_system/HarnMaster.rb', line 46 def getSuccessResult(total) return "決定的成功" if (total % 5) == 0 return "成功" end |