class BCDice::GameSystem::BlindMythos
Constants
- HELP_MESSAGE
ダイスボットの使い方
- ID
ゲームシステムの識別子
- NAME
ゲームシステム名
- SORT_KEY
ゲームシステム名の読みがな
- TABLES
Public Instance Methods
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/BlindMythos.rb, line 40 def eval_game_system_specific_command(command) debug("eval_game_system_specific_command Begin") result = judgeRoll(command) return result unless result.nil? isStop = true text, = reRoll(command, isStop) return text unless text.nil? result = getRulingPlanetDiceCommandResult(command) return result unless result.nil? text = getDurtyTableCommandReuslt(command) return text unless text.nil? return roll_tables(command, TABLES) end
getDurtyTableCommandReuslt(command)
click to toggle source
# File lib/bcdice/game_system/BlindMythos.rb, line 294 def getDurtyTableCommandReuslt(command) return nil unless /^DT$/i =~ command table = <<~__TABLE_END__ 汚染チャートを2回振り、その効果を適用する(1・2-2,5・6-12 なら振り直す) PC全員の「トラウマ」「喪失」すべてに2ダメージ PC全員の「喪失」2つに4ダメージ PC全員の「トラウマ」すべてに2ダメージ。その後さらに汚染が2増える PC全員、1つの【記憶】の両方の値が0になる。このときアクロバットダイス獲得不可 PC全員の「喪失」1つに4ダメージ。このときアクロバットダイス獲得不可 PC全員の「トラウマ」すべてに1ダメージ。その後さらに汚染が3増える PC全員の「トラウマ」すべてに1ダメージ。その後アクロバットダイスをPC人数分失う PC全員の「喪失」すべてに2ダメージ。禁書ビットをすべて失う PC全員の「トラウマ」2つに3ダメージ。その後さらに汚染が1増える PC全員の「トラウマ」「喪失」すべてに1ダメージ PC全員の「喪失」1つに4ダメージ。禁書ビットをすべて失う PC全員の「トラウマ」すべてに2ダメージ PC全員の1つの【記憶】の「トラウマ」「喪失」それぞれに3ダメージ PC全員の「喪失」すべてに1ダメージ PC全員の「トラウマ」3つに2ダメージ PC全員の「トラウマ」と「喪失」それぞれ1つに3ダメージ PC全員の「喪失」3つに2ダメージ PC全員のすべての「トラウマ」に1 ダメージ PC全員のひとつの【記憶】の「トラウマ」「喪失」それぞれに3ダメージ PC全員の「喪失」すべてに2ダメージ PC全員の「トラウマ」ひとつに4ダメージ。禁書ビットをすべて失う PC全員の「トラウマ」「喪失」すべてに1ダメージ PC全員の「喪失」2つに3ダメージ。その後さらに汚染が1増える PC全員の「トラウマ」すべてに2ダメージ。禁書ビットをすべて失う PC全員の「喪失」すべてに1ダメージ。その後アクロバットダイスをPC人数分失う PC全員の「喪失」すべてに1ダメージ。その後さらに汚染が3増える PC全員の「トラウマ」1つに4ダメージ。このときアクロバットダイス獲得不可 PC全員、1つの【記憶】の両方の値が0になる。このときアクロバットダイス獲得不可 PC全員の「喪失」すべてに2ダメージ。その後さらに汚染が2増える PC全員の「トラウマ」2つに4ダメージ PC全員の「トラウマ」「喪失」すべてに2ダメージ 汚染チャートを2回振り、その効果を適用する(1・2-2,5・6-12 なら振り直す) __TABLE_END__ table = table.split("\n") dice1 = @randomizer.roll_once(6) dice2 = @randomizer.roll_sum(2, 6) index = (dice2 - 2) * 3 + (dice1 / 2.0).ceil - 1 return "汚染チャート(#{dice1},#{dice2}) > #{table[index]}" end
getRollResult(rerollCounts, judgeNumberText, judgeNumber, targetNumber, isReRoll, isStop)
click to toggle source
# File lib/bcdice/game_system/BlindMythos.rb, line 117 def getRollResult(rerollCounts, judgeNumberText, judgeNumber, targetNumber, isReRoll, isStop) bitList = [] successList = [] countOneList = [] rerollTargetList = [] message = "" rerollCounts.each_with_index do |diceCount, index| message += "\n" unless index == 0 commandName = "ReRoll#{diceCount}" unless isReRoll if isStop commandName = "BMS#{diceCount - 2}" else commandName = "BM#{diceCount - 2}" end end commandText = "#{commandName}#{judgeNumberText}>=#{targetNumber}" diceList = @randomizer.roll_barabara(diceCount, 6).sort diceText = diceList.join(",") message += " > " if isReRoll message += "(#{commandText}) > #{diceCount}D6[#{diceText}] > " success, countOne, resultText = getSuccessResultText(diceList, judgeNumber) bitList += diceList.find_all { |i| i >= 4 } unless isReRoll successList << success countOneList << countOne message += resultText sameDiceList = getSameDieList(diceList) next if sameDiceList.empty? rerollText = "" sameDiceList.each do |list| rerollText += "," unless rerollText.empty? rerollText += list.join('') end rerollTargetList << sameDiceList.map(&:count).join(",") message += "、リロール[#{rerollText}]" end rerollCommand = "" unless rerollTargetList.empty? rerollCommand = "ReRoll#{rerollTargetList.join(',')}#{judgeNumberText}>=#{targetNumber}" message += "\n > コマンド:#{rerollCommand}" if isStop end canReRoll = !rerollCommand.empty? # ゲームシステムの識別子 # ゲームシステム名 # ゲームシステム名の読みがな # ダイスボットの使い方 if canReRoll && !isStop text, successListTmp, countOneListTmp, = reRoll(rerollCommand, isStop) message += text successList += successListTmp countOneList += countOneListTmp end return message, bitList, successList, countOneList, canReRoll end
getRulingPlanetDice()
click to toggle source
# File lib/bcdice/game_system/BlindMythos.rb, line 281 def getRulingPlanetDice dice1, dice2 = @randomizer.roll_barabara(2, 10) while dice1 == dice2 dice2 = @randomizer.roll_once(10) end dice1 = 0 if dice1 == 10 dice2 = 0 if dice2 == 10 return dice1, dice2 end
getRulingPlanetDiceCommandResult(command)
click to toggle source
# File lib/bcdice/game_system/BlindMythos.rb, line 263 def getRulingPlanetDiceCommandResult(command) m = /^RP(\d+)$/i.match(command) return nil unless m targetNumbers = m[1].each_char.map(&:to_i) diceList = getRulingPlanetDice condition = diceList.any? { |dice| targetNumbers.include?(dice) } result = condition ? "発動" : "失敗" text = "守護星表チェック(#{targetNumbers.join(',')}) > #{diceList.count}D10[#{diceList.join(',')}] > #{result}" Result.new.tap do |r| r.text = text r.condition = condition end end
getSameDieList(diceList)
click to toggle source
# File lib/bcdice/game_system/BlindMythos.rb, line 231 def getSameDieList(diceList) sameDiceList = [] diceList.uniq.each do |i| next if i == 1 list = diceList.find_all { |dice| dice == i } next if list.length <= 1 sameDiceList << list end return sameDiceList end
getSuccessResultText(diceList, judgeNumber)
click to toggle source
# File lib/bcdice/game_system/BlindMythos.rb, line 246 def getSuccessResultText(diceList, judgeNumber) success = 0 countOne = 0 diceList.each do |i| countOne += 1 if i == 1 next unless i >= judgeNumber success += 1 end result = "成功数:#{success}" return success, countOne, result end
getTotalResult(bitList, successList, countOneList, targetNumber, isStop, canReRoll)
click to toggle source
# File lib/bcdice/game_system/BlindMythos.rb, line 185 def getTotalResult(bitList, successList, countOneList, targetNumber, isStop, canReRoll) success = successList.inject { |sum, i| sum + i } countOne = countOneList.inject { |sum, i| sum + i } result = "" if successList.size > 1 result += "\n > 最終成功数:#{success}" end if canReRoll && isStop result += "\n" if success >= targetNumber result += " > 現状で成功。コマンド実行で追加リロールも可能" return Result.success(result) else result += " > 現状のままでは失敗" if countOne >= 1 result += "。汚染ポイント+#{countOne}" return Result.fumble(result) else return Result.failure(result) end end end if success >= targetNumber result += " > 成功" if bitList.size >= 1 result += "、禁書ビット発生[#{bitList.join(',')}]" return Result.critical(result) else return Result.success(result) end else result += " > 失敗" if countOne >= 1 result += "。汚染ポイント+#{countOne}" return Result.fumble(result) else return Result.failure(result) end end end
judgeRoll(command)
click to toggle source
# File lib/bcdice/game_system/BlindMythos.rb, line 59 def judgeRoll(command) return nil unless /^BM(S)?(\d*)(@(\d+))?>=(\d+)$/i =~ command isStop = !Regexp.last_match(1).nil? skillRank = Regexp.last_match(2).to_i judgeNumberText = Regexp.last_match(3) judgeNumber = (Regexp.last_match(4) || 4).to_i targetNumber = (Regexp.last_match(5) || 1).to_i message = "" diceCount = skillRank + 2 isReRoll = false text, bitList, successList, countOneList, canReRoll = getRollResult([diceCount], judgeNumberText, judgeNumber, targetNumber, isReRoll, isStop) message += text result = getTotalResult(bitList, successList, countOneList, targetNumber, isStop, canReRoll) result.text = message + result.text return result end
reRoll(command, isStop)
click to toggle source
# File lib/bcdice/game_system/BlindMythos.rb, line 81 def reRoll(command, isStop) debug("ReRoll Begin", command) return nil unless /^ReRoll([\d,]+)(@(\d+))?>=(\d+)$/i =~ command debug("ReRoll pass") rerollCountsText = Regexp.last_match(1) judgeNumberText = Regexp.last_match(2) judgeNumber = (Regexp.last_match(3) || 4).to_i targetNumber = Regexp.last_match(4).to_i rerollCounts = rerollCountsText.split(/,/).map(&:to_i) commandText = "" rerollCounts.each do |diceCount| commandText += "," unless commandText.empty? commandText += "ReRoll#{diceCount}#{judgeNumberText}>=#{targetNumber}" end debug("commandText", commandText) message = "" if rerollCounts.size > 1 && isStop message += "(#{commandText})" end message += "\n" isReRoll = true text, _bitList, successList, countOneList, = getRollResult(rerollCounts, judgeNumberText, judgeNumber, targetNumber, isReRoll, isStop) message += text return message, successList, countOneList, targetNumber end