class BCDice::GameSystem::Avandner
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/Avandner.rb, line 39 def initialize(command) super(command) @sort_add_dice = true # ダイスのソート有 end
Public Instance Methods
checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber)
click to toggle source
# File lib/bcdice/game_system/Avandner.rb, line 59 def checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber) totalSuccessCount = 0 totalCriticalCount = 0 text = "" rollCount = diceCount while rollCount > 0 diceArray = @randomizer.roll_barabara(rollCount, 10).sort diceText = diceArray.join(",") successCount = diceArray.count { |i| i <= target } criticalCount = diceArray.count { |i| i <= criticalNumber } totalSuccessCount += successCount totalCriticalCount += criticalCount text += "+" unless text.empty? text += "#{successCount}[#{diceText}]" rollCount = criticalCount end result = "" isDamage = (damage != 0) if isDamage totalDamage = totalSuccessCount * damage + totalCriticalCount * criticalTrigger result += "(#{diceCount}D10\<\=#{target}) > #{text} > Hits:#{totalSuccessCount}*#{damage}" result += " + Trigger:#{totalCriticalCount}*#{criticalTrigger}" if criticalTrigger > 0 result += " > #{totalDamage}ダメージ" else result += "(#{diceCount}D10\<\=#{target}) > #{text} > 成功数:#{totalSuccessCount}" end result += " / #{totalCriticalCount}クリティカル" if totalCriticalCount > 0 return result end
eval_game_system_specific_command(command)
click to toggle source
# File lib/bcdice/game_system/Avandner.rb, line 44 def eval_game_system_specific_command(command) # AVコマンド:調査判定, 成功判定 if command =~ /(\d+)AV(\d+)((x|\*)(\d+))?(\+(\d+))?(C(\d+))?$/i diceCount = Regexp.last_match(1).to_i target = Regexp.last_match(2).to_i damage = (Regexp.last_match(5) || 0).to_i criticalTrigger = (Regexp.last_match(7) || 0).to_i criticalNumber = (Regexp.last_match(9) || 1).to_i criticalNumber = 2 if criticalNumber > 3 return checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber) end return nil end