class BCDice::GameSystem::AnimaAnimus

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

ゲームシステム名の読みがな

「ゲームシステム名の読みがなの設定方法」(docs/dicebot_sort_key.md)を参考にして 設定してください

TABLES

Public Instance Methods

check_action(match_data) click to toggle source
# File lib/bcdice/game_system/AnimaAnimus.rb, line 45
def check_action(match_data)
  dice_cnt = Arithmetic.eval(match_data[1], RoundType::FLOOR)
  target = Arithmetic.eval(match_data[2], RoundType::FLOOR)
  debug("dice_cnt", dice_cnt)
  debug("target", target)

  dice_arr = @randomizer.roll_barabara(dice_cnt, 10)
  dice_str = dice_arr.join(",")
  suc_cnt = dice_arr.count { |x| x <= target }
  has_critical = dice_arr.include?(1)
  result = has_critical ? suc_cnt + 2 : suc_cnt

  Result.new.tap do |r|
    r.text = "(#{dice_cnt}B10<=#{target}) > #{dice_str} > #{result > 0 ? '成功' : '失敗'}(達成値:#{result})#{has_critical ? ' (クリティカル発生)' : ''}"
    r.critical = has_critical
    r.success = result > 0
    r.failure = !r.success?
  end
end
eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/AnimaAnimus.rb, line 34
def eval_game_system_specific_command(command)
  m = /(\d+)AN<=(\d+([+\-]\d+)*)/i.match(command)
  if TABLES.key?(command)
    return roll_tables(command, TABLES)
  elsif m
    return check_action(m)
  else
    return nil
  end
end