class BCDice::GameSystem::StrangerOfSwordCity
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/StrangerOfSwordCity.rb, line 26 def initialize(command) super(command) @sort_add_dice = true @d66_sort_type = D66SortType::NO_SORT @round_type = RoundType::FLOOR end
Public Instance Methods
checkRoll(command)
click to toggle source
# File lib/bcdice/game_system/StrangerOfSwordCity.rb, line 45 def checkRoll(command) debug("checkRoll begin command", command) result = '' return result unless command =~ /^(\d+)SR([+\-]?\d+)?(>=(\d+))?$/i diceCount = Regexp.last_match(1).to_i modify = Regexp.last_match(2).to_i difficulty = Regexp.last_match(4).to_i if Regexp.last_match(4) diceList = @randomizer.roll_barabara(diceCount, 6).sort dice = diceList.sum() totalValue = (dice + modify) modifyText = getModifyText(modify) result += "(#{command}) > #{dice}[#{diceList.join(',')}]#{modifyText} > #{totalValue}" criticalResult = getCriticalResult(diceList) unless criticalResult.nil? result += " > クリティカル(+#{criticalResult}D6)" return result end if isFumble(diceList, diceCount) result += ' > ファンブル' return result end unless difficulty.nil? result += totalValue >= difficulty ? ' > 成功' : ' > 失敗' end return result end
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/StrangerOfSwordCity.rb, line 34 def eval_game_system_specific_command(command) debug('eval_game_system_specific_command command', command) command = command.upcase result = checkRoll(command) return result unless result.empty? return result end
getCriticalResult(diceList)
click to toggle source
# File lib/bcdice/game_system/StrangerOfSwordCity.rb, line 87 def getCriticalResult(diceList) dice6Count = diceList.select { |i| i == 6 }.size if dice6Count >= 2 return dice6Count.to_s end return nil end
getModifyText(modify)
click to toggle source
# File lib/bcdice/game_system/StrangerOfSwordCity.rb, line 80 def getModifyText(modify) return "" if modify == 0 return modify.to_s if modify < 0 return "+#{modify}" end
isFumble(diceList, diceCount)
click to toggle source
# File lib/bcdice/game_system/StrangerOfSwordCity.rb, line 97 def isFumble(diceList, diceCount) (diceList.select { |i| i == 1 }.size >= diceCount) end