class BCDice::GameSystem::MeikyuDays
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/MeikyuDays.rb, line 34 def initialize(command) super(command) @sort_add_dice = true @d66_sort_type = D66SortType::ASC end
Public Instance Methods
checkRoll(string)
click to toggle source
# File lib/bcdice/game_system/MeikyuDays.rb, line 63 def checkRoll(string) string = replace_text(string) debug("checkRoll string", string) unless (m = /(^|\s)S?((\d+)[rR]6([+\-\d]*)(([>=]+)(\d+))?)(\s|$)/i.match(string)) debug("not mutch") return nil end string = m[2] dice_c = m[3].to_i bonus = 0 signOfInequality = "" diff = 0 bonusText = m[4] bonus = ArithmeticEvaluator.eval(bonusText) unless bonusText.nil? signOfInequality = m[6] if m[6] diff = m[7].to_i if m[7] dice_num = @randomizer.roll_barabara(dice_c, 6).sort dice_str = dice_num.join(",") dice_now = dice_num[dice_c - 2] + dice_num[dice_c - 1] total_n = dice_now + bonus dice_str = "[#{dice_str}]" output = "#{dice_now}#{dice_str}" if bonus > 0 output += "+#{bonus}" elsif bonus < 0 output += bonus.to_s end if /[^\d\[\]]+/ =~ output output = "(#{string}) > #{output} > #{total_n}" else output = "(#{string}) > #{total_n}" end if signOfInequality != "" # 成功度判定処理 cmp_op = Normalize.comparison_operator(signOfInequality) result = result_2d6(total_n, dice_now, dice_num, cmp_op, diff) output += " > #{result.text}" if result end return output end
eval_game_system_specific_command(command)
click to toggle source
迷宮デイズ ########################
# File lib/bcdice/game_system/MeikyuDays.rb, line 116 def eval_game_system_specific_command(command) if (result = roll_tables(command, TABLES)) result else checkRoll(command) end end
replace_text(string)
click to toggle source
# File lib/bcdice/game_system/MeikyuDays.rb, line 41 def replace_text(string) string = string.gsub(/(\d+)MD6/i) { "#{Regexp.last_match(1)}R6" } string = string.gsub(/(\d+)MD/i) { "#{Regexp.last_match(1)}R6" } return string end
result_2d6(total, dice_total, _dice_list, cmp_op, target)
click to toggle source
# File lib/bcdice/game_system/MeikyuDays.rb, line 47 def result_2d6(total, dice_total, _dice_list, cmp_op, target) return nil unless cmp_op == :>= if dice_total <= 2 Result.fumble("絶対失敗") elsif dice_total >= 12 Result.critical("絶対成功") elsif target == "?" Result.nothing elsif total >= target Result.success("成功") else Result.failure("失敗") end end