class BCDice::GameSystem::ZettaiReido
Constants
- HELP_MESSAGE
ダイスボットの使い方
- ID
ゲームシステムの識別子
- NAME
ゲームシステム名
- SORT_KEY
ゲームシステム名の読みがな
Public Instance Methods
changeDiceToDarkDice(dice)
click to toggle source
# File lib/bcdice/game_system/ZettaiReido.rb, line 80 def changeDiceToDarkDice(dice) darkPoint = 0 darkDice = dice if dice == 6 darkDice = 0 darkPoint = 1 end return darkDice, darkPoint end
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/ZettaiReido.rb, line 27 def eval_game_system_specific_command(command) return nil unless command =~ /^(\d+)-2DR([+\-\d]*)(>=(\d+))?$/i baseAvility = Regexp.last_match(1).to_i modText = Regexp.last_match(2) diffValue = Regexp.last_match(4) return roll2DR(baseAvility, modText, diffValue) end
getDiffInfo(diffValue)
click to toggle source
# File lib/bcdice/game_system/ZettaiReido.rb, line 104 def getDiffInfo(diffValue) diffText = "" unless diffValue.nil? diffValue = diffValue.to_i diffText = ">=#{diffValue.to_i}" end return diffValue, diffText end
getModInfo(modText)
click to toggle source
# File lib/bcdice/game_system/ZettaiReido.rb, line 91 def getModInfo(modText) value = ArithmeticEvaluator.eval(modText) text = "" if value < 0 text = value.to_s elsif value > 0 text = "+" + value.to_s end return value, text end
getResult(diceTotal, total, diff)
click to toggle source
# File lib/bcdice/game_system/ZettaiReido.rb, line 115 def getResult(diceTotal, total, diff) if diceTotal == 0 return Result.critical("クリティカル") end if diceTotal == 10 return Result.fumble("ファンブル") end if diff.nil? diff = 0 end successLevel = (total - diff) if successLevel >= 0 return Result.success("#{successLevel} 成功") end return Result.failure("失敗") end
roll2DR(baseAvility, modText, diffValue)
click to toggle source
# File lib/bcdice/game_system/ZettaiReido.rb, line 37 def roll2DR(baseAvility, modText, diffValue) diceTotal, diceText, darkPoint = roll2DarkDice() mod, modText = getModInfo(modText) diff, diffText = getDiffInfo(diffValue) baseCommandText = "(#{baseAvility}-2DR#{modText}#{diffText})" diceCommandText = "#{baseAvility}-#{diceTotal}[#{diceText}]#{modText}" total = baseAvility - diceTotal + mod result = getResult(diceTotal, total, diff) darkPointText = "#{darkPoint}DP" if darkPoint > 0 result.text = [ baseCommandText, diceCommandText, total.to_i, result.text, darkPointText, ].compact.join(" > ") return result end
roll2DarkDice()
click to toggle source
# File lib/bcdice/game_system/ZettaiReido.rb, line 62 def roll2DarkDice() dice1 = @randomizer.roll_once(6) dice2 = @randomizer.roll_once(6) darkDice1, darkPoint1 = changeDiceToDarkDice(dice1) darkDice2, darkPoint2 = changeDiceToDarkDice(dice2) darkPoint = darkPoint1 + darkPoint2 if darkPoint == 2 darkPoint = 4 end darkTotal = darkDice1 + darkDice2 darkDiceText = "#{darkDice1},#{darkDice2}" return darkTotal, darkDiceText, darkPoint end