class BCDice::GameSystem::CthulhuTech

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

TEST_RE

判定コマンドの正規表現

Public Class Methods

new(command) click to toggle source

ダイスボットを初期化する

Calls superclass method BCDice::Base::new
# File lib/bcdice/game_system/CthulhuTech.rb, line 216
def initialize(command)
  super(command)

  # 加算ロールで出目をソートする
  @sort_add_dice = true
end

Public Instance Methods

eval_game_system_specific_command(command) click to toggle source

ダイスボット固有コマンドの処理を行う @param [String] command コマンド @return [String] ダイスボット固有コマンドの結果 @return [nil] 無効なコマンドだった場合

# File lib/bcdice/game_system/CthulhuTech.rb, line 227
def eval_game_system_specific_command(command)
  node = parse(command)
  return nil unless node

  return node.execute(@randomizer)
end

Private Instance Methods

parse(command) click to toggle source

構文解析する @param [String] command コマンド @return [Test, Contest] 判定のノード @return [nil] 無効なコマンドだった場合

# File lib/bcdice/game_system/CthulhuTech.rb, line 243
def parse(command)
  m = TEST_RE.match(command)
  return nil unless m

  num = m[1].to_i
  modifier = m[2] ? ArithmeticEvaluator.eval(m[2]) : 0
  node_class = m[3] == '>' ? Contest : Test
  difficulty = m[4].to_i

  return node_class.new(num, modifier, difficulty)
end