class BCDice::GameSystem::Oukahoushin3rd

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

TABLES

Public Instance Methods

eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/Oukahoushin3rd.rb, line 27
def eval_game_system_specific_command(command)
  chosen = roll_tables(command, TABLES)
  return replace_dice_notation(chosen)
end

Private Instance Methods

replace_dice_notation(text) click to toggle source
# File lib/bcdice/game_system/Oukahoushin3rd.rb, line 34
def replace_dice_notation(text)
  text&.gsub(/(\d+)D(\d+)/) do |matched|
    times, sides = matched.split("D").map(&:to_i)
    value = @randomizer.roll_sum(times, sides)
    "#{matched}(=>#{value})"
  end
end