class BCDice::GameSystem::Airgetlamh

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/Airgetlamh.rb, line 48
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/Airgetlamh.rb, line 75
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/Airgetlamh.rb, line 53
def eval_game_system_specific_command(command)
  # AA/ALコマンド:調査判定, 成功判定
  if command =~ /(\d+)?A(A|L)(\d+)?((x|\*)(\d+)(\+(\d+))?)?(C(\d+))?$/i
    diceCount = (Regexp.last_match(1) || 2).to_i
    target = (Regexp.last_match(3) || 6).to_i
    damage = (Regexp.last_match(6) || 0).to_i

    if Regexp.last_match(2) == 'L' # 旧Ver対応
      criticalTrigger = 0
      criticalNumber = 0
    else
      criticalTrigger = (Regexp.last_match(8) || 0).to_i
      criticalNumber = (Regexp.last_match(10) || 1).to_i
    end
    criticalNumber = 3 if criticalNumber > 4

    return checkRoll(diceCount, target, damage, criticalTrigger, criticalNumber)
  end

  return nil
end