Class: BCDice::GameSystem::GoblinSlayer
- Defined in:
- lib/bcdice/game_system/GoblinSlayer.rb
Constant Summary collapse
- ID =
ゲームシステムの識別子
'GoblinSlayer'
- NAME =
ゲームシステム名
'ゴブリンスレイヤーTRPG'
- SORT_KEY =
ゲームシステム名の読みがな
'こふりんすれいやあTRPG'
- HELP_MESSAGE =
ダイスボットの使い方
<<~MESSAGETEXT ・判定 GS(x)>=y 2d6の判定を行い、達成値を出力します。 xは基準値、yは目標値です。いずれも省略可能です。 yが設定されている場合、大成功/成功/失敗/大失敗を自動判定します。 例)GS>=12 GS>10 GS(10)>14 GS+10>=15 GS10>=15 GS(10) GS+10 GS10 GS ・祈念 MCPI(n)$m 祈念を行います。 nは【幸運】などによるボーナスです。この値は省略可能です。 mは因果点の現在値です。 因果点の現在値を使用して祈念を行い、成功/失敗を自動判定します。 例)MCPI$3 MCPI(1)$4 MCPI+2$5 MCPI2$6 ・命中判定の効力値によるボーナス DB(n) ダメージ効力表による威力へのボーナスを自動で求めます。 nは命中判定の効力値です。 例)DB(15) DB12 ※上記コマンドの計算内で割り算を行った場合、小数点以下は切り上げされます。 ただしダイス出目を割り算した場合、小数点以下は切り捨てされます。 例)入力:GS(8+3/2) 実行結果:(GS10) > 10 + 3[1,2] > 13 入力:2d6/2 実行結果:(2D6/2) > 3[1,2]/2 > 1 ※MCPIでは、シークレットダイスを使用できません。 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
- #damageBonus(command) ⇒ Object
- #eval_game_system_specific_command(command) ⇒ Object
- #getCheckResult(command) ⇒ Object
-
#initialize(command) ⇒ GoblinSlayer
constructor
A new instance of GoblinSlayer.
- #murmurChantPrayInvoke(command) ⇒ Object
-
#resultStr(achievement, target, cmp_op, fumble, critical) ⇒ String
判定結果の文字列を返す.
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) ⇒ GoblinSlayer
Returns a new instance of GoblinSlayer.
46 47 48 49 |
# File 'lib/bcdice/game_system/GoblinSlayer.rb', line 46 def initialize(command) super(command) @round_type = RoundType::CEIL end |
Instance Method Details
#damageBonus(command) ⇒ Object
117 118 119 120 121 122 123 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 |
# File 'lib/bcdice/game_system/GoblinSlayer.rb', line 117 def damageBonus(command) m = /^DB(\d+)$/i.match(command) unless m return nil end num = m[1].to_i fmt = "命中判定の効力値によるボーナス > " if num < 15 return fmt + "なし" end times = if num >= 40 5 elsif num >= 30 4 elsif num >= 25 3 elsif num >= 20 2 else 1 end dice_list = @randomizer.(times, 6) total = dice_list.sum() diceText = dice_list.join(",") return fmt + "#{total}[#{diceText}] > #{total}" end |
#eval_game_system_specific_command(command) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/bcdice/game_system/GoblinSlayer.rb', line 51 def eval_game_system_specific_command(command) case command when /^GS/i return getCheckResult(command) when /^MCPI/i return murmurChantPrayInvoke(command) when /^DB/i return damageBonus(command) else return nil end end |
#getCheckResult(command) ⇒ Object
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 |
# File 'lib/bcdice/game_system/GoblinSlayer.rb', line 64 def getCheckResult(command) m = /^GS([-+]?\d+)?((>=?)(\d+))?$/i.match(command) unless m return nil end basis = m[1].to_i # 基準値 target = m[4].to_i without_compare = m[2].nil? || target <= 0 cmp_op = m[3] dice_list = @randomizer.(2, 6) total = dice_list.sum() diceText = dice_list.join(",") achievement = basis + total # 達成値 fumble = diceText == "1,1" critical = diceText == "6,6" result = " > #{resultStr(achievement, target, cmp_op, fumble, critical)}" if without_compare && !fumble && !critical result = "" end basis_str = basis == 0 ? "" : "#{basis} + " return "(#{command}) > #{basis_str}#{total}[#{diceText}] > #{achievement}#{result}" end |
#murmurChantPrayInvoke(command) ⇒ Object
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/GoblinSlayer.rb', line 93 def murmurChantPrayInvoke(command) m = /^MCPI(\+?\d+)?\$(\d+)$/i.match(command) unless m return nil end luck = m[1].to_i # 幸運 volition = m[2].to_i # 因果点 if volition >= 12 return "因果点が12点以上の場合、因果点は使用できません。" end dice_list = @randomizer.(2, 6) total = dice_list.sum() diceText = dice_list.join(",") achievement = total + luck result = " > #{resultStr(achievement, volition, '>=', false, false)}" luck_str = luck == 0 ? "" : "+#{luck}" return "祈念(2d6#{luck_str}) > #{total}[#{diceText}]#{luck_str} > #{achievement}#{result}, 因果点:#{volition}点 → #{volition + 1}点" end |
#resultStr(achievement, target, cmp_op, fumble, critical) ⇒ String
判定結果の文字列を返す
157 158 159 160 161 162 163 164 165 |
# File 'lib/bcdice/game_system/GoblinSlayer.rb', line 157 def resultStr(achievement, target, cmp_op, fumble, critical) return '大失敗' if fumble return '大成功' if critical if cmp_op == ">=" return achievement >= target ? "成功" : "失敗" else return achievement > target ? "成功" : "失敗" end end |