class BCDice::GameSystem::GehennaAn
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/GehennaAn.rb, line 28 def initialize(command) super(command) @sort_add_dice = true @sort_barabara_dice = true end
Public Instance Methods
eval_game_system_specific_command(string)
click to toggle source
# File lib/bcdice/game_system/GehennaAn.rb, line 46 def eval_game_system_specific_command(string) string = replace_text(string) unless /(^|\s)S?((\d+)[rR]6([+\-\d]+)?([>=]+(\d+))(\[(\d)\]))(\s|$)/i =~ string return nil end string = Regexp.last_match(2) diceCount = Regexp.last_match(3).to_i modText = Regexp.last_match(4) diff = Regexp.last_match(6).to_i mode = Regexp.last_match(8).to_i mod = ArithmeticEvaluator.eval(modText) diceArray = @randomizer.roll_barabara(diceCount, 6).sort diceValue = diceArray.sum() diceText = diceArray.join(",") dice_1st = "" isLuck = true diceValue = 0 # 幸運の助けチェック diceArray.each do |i| if dice_1st != "" if (dice_1st != i) || (i < diff) isLuck = false end else dice_1st = i end diceValue += 1 if i >= diff end diceValue *= 2 if isLuck && (diceCount > 1) output = "#{diceValue}[#{diceText}]" success = diceValue + mod success = 0 if success < 0 failed = diceCount - diceValue failed = 0 if failed < 0 if mod > 0 output += "+#{mod}" elsif mod < 0 output += mod.to_s end if /[^\d\[\]]+/ =~ output output = "(#{string}) > #{output} > 成功#{success}、失敗#{failed}" else output = "(#{string}) > #{output}" end # 連撃増加値と闘技チット output += getAnastasisBonusText(mode, success) return output end
Private Instance Methods
getAnastasisBonusText(mode, success)
click to toggle source
# File lib/bcdice/game_system/GehennaAn.rb, line 111 def getAnastasisBonusText(mode, success) return '' if mode == 0 ma_bonus = ((success - 1) / 2).to_i ma_bonus = 7 if ma_bonus > 7 bonus_str = '' bonus_str += "連撃[+#{ma_bonus}]/" if ma_bonus > 0 bonus_str += "闘技[#{getTougiBonus(success)}]" return " > #{bonus_str}" end
getTougiBonus(success)
click to toggle source
# File lib/bcdice/game_system/GehennaAn.rb, line 123 def getTougiBonus(success) table = [ [6, '1'], [13, '2'], [18, '3'], [22, '4'], [99, '5'], ] return get_table_by_number(success, table) end
replace_text(string)
click to toggle source
# File lib/bcdice/game_system/GehennaAn.rb, line 36 def replace_text(string) string .gsub(/(\d+)GA(\d+)([+\-][+\-\d]+)/) { "#{Regexp.last_match(1)}R6#{Regexp.last_match(3)}>=#{Regexp.last_match(2)}[1]" } .gsub(/(\d+)GA(\d+)/) { "#{Regexp.last_match(1)}R6>=#{Regexp.last_match(2)}[1]" } .gsub(/(\d+)G(\d+)([+\-][+\-\d]+)/) { "#{Regexp.last_match(1)}R6#{Regexp.last_match(3)}>=#{Regexp.last_match(2)}[0]" } .gsub(/(\d+)G(\d+)/) { "#{Regexp.last_match(1)}R6>=#{Regexp.last_match(2)}[0]" } end