class BCDice::GameSystem::CardRanker

Constants

COLOR_TABLE
HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

RTT
SORT_KEY

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

TABLES

Public Class Methods

new(command) click to toggle source
Calls superclass method BCDice::Base::new
# File lib/bcdice/game_system/CardRanker.rb, line 32
def initialize(command)
  super(command)

  @sort_add_dice = true
  @d66_sort_type = D66SortType::ASC
end

Public Instance Methods

eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/CardRanker.rb, line 56
def eval_game_system_specific_command(command)
  roll_tables(command, TABLES) || get_monster(command) || RTT.roll_command(randomizer, command)
end
get_monster(command) click to toggle source
# File lib/bcdice/game_system/CardRanker.rb, line 71
def get_monster(command)
  m = command.match(/^CM(\w)(\d+)$/i)
  return nil unless m

  cat = COLOR_TABLE.index(m[1])
  row_dice = m[2].to_i
  return nil unless cat
  return nil unless row_dice.between?(2, 12)

  skill = RTT.categories[cat].skills[row_dice - 2]
  return "モンスター選択 > #{skill}"
end
result_2d6(total, dice_total, _dice_list, cmp_op, target) click to toggle source

ゲーム別成功度判定(2D6)

# File lib/bcdice/game_system/CardRanker.rb, line 40
def result_2d6(total, dice_total, _dice_list, cmp_op, target)
  return nil unless cmp_op == :>=

  if dice_total <= 2
    Result.fumble("ファンブル")
  elsif dice_total >= 12
    Result.critical("スペシャル > " + RTT.roll_command(@randomizer, "RM"))
  elsif target == "?"
    Result.nothing
  elsif total >= target
    Result.success("成功")
  else
    Result.failure("失敗")
  end
end