class BCDice::GameSystem::GoblinSlayer
Constants
- HELP_MESSAGE
ダイスボットの使い方
- ID
ゲームシステムの識別子
- NAME
ゲームシステム名
- SORT_KEY
ゲームシステム名の読みがな
Public Class Methods
new(command)
click to toggle source
Calls superclass method
BCDice::Base::new
# File lib/bcdice/game_system/GoblinSlayer.rb, line 46 def initialize(command) super(command) @round_type = RoundType::CEIL end
Public Instance Methods
damageBonus(command)
click to toggle source
# 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.roll_barabara(times, 6) total = dice_list.sum() diceText = dice_list.join(",") return fmt + "#{total}[#{diceText}] > #{total}" end
eval_game_system_specific_command(command)
click to toggle source
# 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)
click to toggle source
# 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.roll_barabara(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)
click to toggle source
# 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.roll_barabara(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)
click to toggle source
判定結果の文字列を返す @param [Integer] achievement 達成値 @param [Integer] target 目標値 @param [String] cmp_op 達成値と目標値を比較する比較演算子 @param [Boolean] fumble ファンブルかどうか @param [Boolean] critical クリティカルかどうか @return [String]
# 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