class BCDice::GameSystem::Dracurouge
Constants
- HELP_MESSAGE
ダイスボットの使い方
- ID
ゲームシステムの識別子
- NAME
ゲームシステム名
- SORT_KEY
ゲームシステム名の読みがな
- TABLES
Public Class Methods
new(command)
click to toggle source
Calls superclass method
BCDice::Base::new
# File lib/bcdice/game_system/Dracurouge.rb, line 45 def initialize(command) super(command) @d66_sort_type = D66SortType::NO_SORT end
Private Class Methods
translate_tables(locale)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 287 def translate_tables(locale) { "CO" => YearTable.from_i18n( "Dracurouge.table.CO", locale, [ "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "10+2D6", "7+1D6×1D6", "14+1D6×1D6", "7+1D6×1D6", "10+1D6×1D6", "7+1D6×1D6", "10+2D6", "7+1D6×1D6", "14+1D6×1D6", "10+2D6", "7+1D6×1D6", "14+1D6×1D6", "18+1D6×1D6", "10+2D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "30+1D6×1D6", "14+1D6×1D6", "7+1D6×1D6", "14+1D6×1D6", "10+2D6", "14+1D6×1D6", "14+1D6×1D6", "7+4D6", "14+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", ] ), "CA" => YearTable.from_i18n( "Dracurouge.table.CA", locale, [ "2D6×10", "1D6×1D6", "1D6×1D6", "2D6×5", "2D6×10", "1D6×1D6", "2D6×10", "1D6×5", "2D6×10", "2D6×3", "1D6×1D6", "1D6×1D6", "2D6×10", "2D6×10", "2D6×20", "2D6×10", "2D6×20", "1D6×1D6", "1D6×3", "1D6×1D6", "1D6×5", "2D6×10", "1D6×1D6", "2D6×10", "2D6", "1D6×1D6", "2D6", "1D6×1D6", "2D6×20", "2D6×10", "1D6×1D6", "2D6×50", "2D6×10", "1D6×1D6", "2D6×5", "1D6×1D6", ] ), "EP" => YearTable.from_i18n( "Dracurouge.table.EP", locale, [ "1D66+1300", "1D666", "1D666", "1D666", "1D66+1250", "1D666", "3D6×100", "2D6×100", "1D66+1210", "1D666", "2D6×100", "3D6×100", "1D66+1300", "2D6×100", "1D6+1250", "1D666", "1D666", "1D666", "1D66+1250", "2D6×100", "1D666", "3D6×100", "2D6×100", "2D6×100", "1D6×150", "2D6×100", "1D66+1250", "1D66+400", "1212", "2D6×100", "2D6×100", "1D66×10", "3D6×100", "3D6×100", "1D66+1300", "1D66+1833", ] ), "OS" => YearTable.from_i18n( "Dracurouge.table.OS", locale, [ "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "13+1D6×1D6", "7+1D6×1D6", "13+1D6×1D6", "7+1D6×1D6", "13+1D6×1D6", "13+1D6×1D6", "13+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "10+1D6×1D6", "7+1D6×1D6", "15+1D6×1D6", "6+2D6", "7+1D6×1D6", "7+1D6×1D6", "13+1D6×1D6", "35+1D6×1D6", "9+2D6", "13+1D6×1D6", "9+2D6", "6+2D6", "7+1D6×1D6", "7+2D6", "7+1D6×1D5", "7+1D6×1D6", "13+1D6×1D6", "7+1D6×1D6", ] ), "RS" => YearTable.from_i18n( "Dracurouge.table.RS", locale, [ "2D6×10", "1D6×1D6", "1D6×1D6", "1D6×1D6", "3D6×30", "3D6×30", "2D6×10", "2D6×10", "2D6×10", "2D6×10", "2D6×20", "1D6×1D6", "1D6×1D6", "1D6×1D6", "1", "2D6×10", "2D6×20", "1D6×1D6", "1D6×1D6", "3D6×30", "3D6×20", "1D6×1D6", "3D6×30", "3D6×20", "1D6×1D6", "1D6×1D6", "1D6×1D6", "1D6×1D6", "1D6×10", "2D6×10", "3D6×50", "1D6×1D6", "3D6×20", "2D6×10", "1D6×1D6", "3D6×50", ] ), "PP" => YearTable.from_i18n( "Dracurouge.table.PP", locale, [ "8+2D6", "6+2D6", "7+1D6×1D6", "15+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "6+2D6", "7+1D6×1D6", "9+2D6", "15+1D6×1D6", "9+3D6", "7+1D6×1D6", "10+1D6×1D6", "9+2D6", "9+2D6", "9+3D6", "6+2D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "6+2D6", "10+1D6×1D6", "7+1D6×1D6", "12+1D6×1D6", "15+1D6×1D6", "9+3D6", "7+1D6×1D6", "7+1D6×1D6", "7+1D6×1D6", "12+4D6", ] ), "ST" => DiceTable::D66Table.from_i18n("Dracurouge.table.ST", locale), "PN" => DiceTable::D66Table.from_i18n("Dracurouge.table.PN", locale), "CS" => DiceTable::Table.from_i18n("Dracurouge.table.CS", locale), "ECS" => DiceTable::D66Table.from_i18n("Dracurouge.table.ECS", locale), "BT" => DiceTable::Table.from_i18n("Dracurouge.table.BT", locale), } end
Public Instance Methods
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 50 def eval_game_system_specific_command(command) roll_conduct_dice(command) || roll_resist_dice(command) || getReactionDiceCommandResult(command) || getHeresyReactionDiceCommandResult(command) || getCorruptionDiceCommandResult(command) || roll_tables(command, self.class::TABLES) end
Private Instance Methods
apply_thirsty_point(dice_list, thirsty_point)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 95 def apply_thirsty_point(dice_list, thirsty_point) return nil if thirsty_point == 0 idx = dice_list.rindex { |i| i <= 6 } text_list = dice_list.map(&:to_s) text_list[idx] += "+#{thirsty_point}" dice_list[idx] += thirsty_point return "[ #{text_list.join(', ')} ]" end
checkTypeText(typeText, infos)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 177 def checkTypeText(typeText, infos) return true if typeText.nil? return infos.keys.include?(typeText.to_sym) end
count_glory_dice(dice_list)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 88 def count_glory_dice(dice_list) one_count = dice_list.count(1) six_count = dice_list.count(6) return (one_count / 2) + (six_count / 2) end
getCorruptionDiceCommandResult(command)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 200 def getCorruptionDiceCommandResult(command) return nil unless command =~ /^CT(\d+)$/ modify = Regexp.last_match(1).to_i name = translate("Dracurouge.CT.name") table = [ [0, translate("Dracurouge.CT.table.0")], [1, translate("Dracurouge.CT.table.1")], [3, translate("Dracurouge.CT.table.3")], [5, translate("Dracurouge.CT.table.5")], [6, translate("Dracurouge.CT.table.6")], [7, translate("Dracurouge.CT.table.7")], [8, translate("Dracurouge.CT.table.8")], [99, translate("Dracurouge.CT.table.99")], ] dice_list = @randomizer.roll_barabara(2, 6) number = dice_list.sum() number_text = dice_list.join(",") index = (number - modify) debug('index', index) text = get_table_by_number(index, table) return "2D6[#{number_text}]-#{modify} > #{name}(#{index}) > #{text}" end
getHeresyReactionDiceCommandResult(command)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 136 def getHeresyReactionDiceCommandResult(command) return nil unless command =~ /^HRT((\w\d*)(\w\d*))?/ typeText1 = Regexp.last_match(2) typeText2 = Regexp.last_match(3) name = translate("Dracurouge.HRT.name") blood = translate("Dracurouge.HRT.blood") style = translate("Dracurouge.HRT.style") return getReactionText(name, typeText1, typeText2, blood, style) end
getReactionDiceCommandResult(command)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 123 def getReactionDiceCommandResult(command) return nil unless command =~ /^RT((\w\d*)(\w\d*))?/ typeText1 = Regexp.last_match(2) typeText2 = Regexp.last_match(3) name = translate("Dracurouge.RT.name") blood = translate("Dracurouge.RT.blood") style = translate("Dracurouge.RT.style") return getReactionText(name, typeText1, typeText2, blood, style) end
getReactionTex(info, index)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 193 def getReactionTex(info, index) typeName = info[:name] text = info[:table][index] return "#{typeName}:#{text}" end
getReactionText(name, typeText1, typeText2, infos1, infos2)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 149 def getReactionText(name, typeText1, typeText2, infos1, infos2) return nil unless checkTypeText(typeText1, infos1) return nil unless checkTypeText(typeText2, infos2) ten_value = @randomizer.roll_once(6) one_value = @randomizer.roll_once(6) number = "#{ten_value}#{one_value}" isBefore = (ten_value < 4) infos = isBefore ? infos1 : infos2 typeText = (isBefore ? typeText1 : typeText2) index = (one_value - 1) + (isBefore ? (ten_value - 1) : (ten_value - 4)) * 6 debug("index", index) if typeText.nil? resultText = getReactionTextFull(infos, index) else info = infos[typeText.to_sym] return nil if info.nil? resultText = getReactionTex(info, index) end return "#{name}(#{number}) > #{resultText}" end
getReactionTextFull(infos, index)
click to toggle source
# File lib/bcdice/game_system/Dracurouge.rb, line 183 def getReactionTextFull(infos, index) resultTexts = [] infos.each_value do |info| resultTexts << getReactionTex(info, index) end return resultTexts.join('/') end
roll_conduct_dice(command)
click to toggle source
行い判定 (DRx+y)
# File lib/bcdice/game_system/Dracurouge.rb, line 62 def roll_conduct_dice(command) m = /^DR(\d*[1-9])?(\+\d+)?$/.match(command) unless m return nil end dice_count = m[1]&.to_i || 4 thirsty_point = m[2].to_i dice_list = @randomizer.roll_barabara(dice_count, 6).sort glory_dice = count_glory_dice(dice_list) dice_list += Array.new(glory_dice, 10) calculation_process = apply_thirsty_point(dice_list, thirsty_point) sequence = [ "(#{command})", "#{dice_count}D6#{Format.modifier(thirsty_point)}", calculation_process, "[ #{dice_list.join(', ')} ]", ].compact return sequence.join(" > ") end
roll_resist_dice(command)
click to toggle source
抗い判定 (DRRx)
# File lib/bcdice/game_system/Dracurouge.rb, line 108 def roll_resist_dice(command) m = /^DRR(\d+)$/.match(command) unless m return nil end dice_count = m[1].to_i dice_count = 4 if dice_count == 0 dice_list = @randomizer.roll_barabara(dice_count, 6).sort total = dice_list.sum() return "(#{command}) > #{dice_count}D6 > [ #{dice_list.join(', ')} ] > #{total}" end