class BCDice::GameSystem::GranCrest

Constants

ALIASES
HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

TABLES

Public Class Methods

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

  @sort_add_dice = true
  @d66_sort_type = D66SortType::NO_SORT
  @round_type = RoundType::FLOOR
end

Public Instance Methods

eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/GranCrest.rb, line 66
def eval_game_system_specific_command(command)
  roll_tables(ALIASES[command] || command, TABLES)
end
result_nd6(total, _dice_total, dice_list, cmp_op, target) click to toggle source

ゲーム別成功度判定(nD6)

# File lib/bcdice/game_system/GranCrest.rb, line 36
def result_nd6(total, _dice_total, dice_list, cmp_op, target)
  return nil unless cmp_op == :>=

  result = Result.new
  sequence = []

  if dice_list.count(6) >= 2
    total += 10
    result.critical = true
    sequence.push("(クリティカル)", total.to_s)
  end

  if target != '?'
    if total >= target
      sequence.push("成功")
      result.success = true
    else
      sequence.push("失敗")
      result.failure = true
    end
  end

  if sequence.empty?
    return nil
  end

  result.text = sequence.join(" > ")
  return result
end