class BCDice::GameSystem::Illusio

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/Illusio.rb, line 30
def initialize(command)
  super(command)
  @sort_add_dice = true # ダイスのソート有
end

Public Instance Methods

check_roll(dice_count, block_no, is_parry) click to toggle source
# File lib/bcdice/game_system/Illusio.rb, line 50
def check_roll(dice_count, block_no, is_parry)
  dice_array = @randomizer.roll_barabara(dice_count, 6).sort
  dice_text = dice_array.join(',')

  result_array = []
  success = 0
  dice_array.each do |i|
    if block_no.count(i) > 0
      result_array.push("×")
    else
      result_array.push(i)
      success += 1
    end
  end

  block_text = block_no.join(',')
  block_text2 = is_parry ? "Parry" : "Block"
  result_text = result_array.join(',')

  result = "#{dice_count}D6(#{block_text2}:#{block_text}) > #{dice_text} > #{result_text} > "
  return "#{result}成功数:#{success}" unless is_parry

  if success < dice_count
    "#{result}パリィ成立! 次の非ダメージ2倍。"
  else
    "#{result}成功数:#{success} パリィ失敗"
  end
end
eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/Illusio.rb, line 39
def eval_game_system_specific_command(command)
  m = command.match(/(\d+)?IL([1-6]{0,6})(P)?$/i)
  return nil unless m

  dice_count = (m[1] || 1).to_i
  block_no = (m[2] || "").each_char.map(&:to_i).uniq.sort
  is_parry = !m[3].nil?

  return check_roll(dice_count, block_no, is_parry)
end