class BCDice::GameSystem::FutariSousa

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

SPECIAL_DICE

スペシャルとなる出目

SUCCESS_THRESHOLD

成功の目標値

TABLES

Public Class Methods

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

  @d66_sort_type = D66SortType::ASC
end

Private Class Methods

translate_tables(locale) click to toggle source
# File lib/bcdice/game_system/FutariSousa.rb, line 111
def translate_tables(locale)
  {
    "SHRD" => DiceTable::Table.from_i18n("FutariSousa.table.SHRD", locale),
    "SHFM" => DiceTable::Table.from_i18n("FutariSousa.table.SHFM", locale),
    "SHBT" => DiceTable::Table.from_i18n("FutariSousa.table.SHBT", locale),
    "SHPI" => DiceTable::Table.from_i18n("FutariSousa.table.SHPI", locale),
    "SHEG" => DiceTable::Table.from_i18n("FutariSousa.table.SHEG", locale),
    "SHWP" => DiceTable::Table.from_i18n("FutariSousa.table.SHWP", locale),
    "SHDS" => DiceTable::Table.from_i18n("FutariSousa.table.SHDS", locale),
    "SHFT" => DiceTable::Table.from_i18n("FutariSousa.table.SHFT", locale),
    "SHIN" => DiceTable::Table.from_i18n("FutariSousa.table.SHIN", locale),
    "SHEM" => DiceTable::Table.from_i18n("FutariSousa.table.SHEM", locale),
    "EVS" => DiceTable::Table.from_i18n("FutariSousa.table.EVS", locale),
    "EVW" => DiceTable::Table.from_i18n("FutariSousa.table.EVW", locale),
    "EVN" => DiceTable::Table.from_i18n("FutariSousa.table.EVN", locale),
    "EVC" => DiceTable::Table.from_i18n("FutariSousa.table.EVC", locale),
    "EVV" => DiceTable::Table.from_i18n("FutariSousa.table.EVV", locale),
    "OBT" => DiceTable::D66Table.from_i18n("FutariSousa.table.OBT", locale),
    "ACT" => DiceTable::Table.from_i18n("FutariSousa.table.ACT", locale),
    "EWT" => DiceTable::Table.from_i18n("FutariSousa.table.EWT", locale),
    "WMT" => DiceTable::Table.from_i18n("FutariSousa.table.WMT", locale),
    "BGDD" => DiceTable::Table.from_i18n("FutariSousa.table.BGDD", locale),
    "BGDG" => DiceTable::Table.from_i18n("FutariSousa.table.BGDG", locale),
    "BGDM" => DiceTable::Table.from_i18n("FutariSousa.table.BGDM", locale),
    "BGAJ" => DiceTable::Table.from_i18n("FutariSousa.table.BGAJ", locale),
    "BGAP" => DiceTable::Table.from_i18n("FutariSousa.table.BGAP", locale),
    "BGAI" => DiceTable::Table.from_i18n("FutariSousa.table.BGAI", locale),
    "HT" => DiceTable::Table.from_i18n("FutariSousa.table.HT", locale),
    "BT" => DiceTable::Table.from_i18n("FutariSousa.table.BT", locale),
    "GRT" => DiceTable::D66Table.from_i18n("FutariSousa.table.GRT", locale),
    "MIT" => DiceTable::D66Table.from_i18n("FutariSousa.table.MIT", locale),
    "JBT66" => DiceTable::D66Table.from_i18n("FutariSousa.table.JBT66", locale),
    "JBT10" => DiceTable::Table.from_i18n("FutariSousa.table.JBT10", locale),
    "FST66" => DiceTable::D66Table.from_i18n("FutariSousa.table.FST66", locale),
    "FST10" => DiceTable::Table.from_i18n("FutariSousa.table.FST10", locale),
    "LDT66" => DiceTable::D66Table.from_i18n("FutariSousa.table.LDT66", locale),
    "LDT10" => DiceTable::Table.from_i18n("FutariSousa.table.LDT10", locale),
    "FLT66" => DiceTable::D66Table.from_i18n("FutariSousa.table.FLT66", locale),
    "FLT10" => DiceTable::Table.from_i18n("FutariSousa.table.FLT10", locale),
    "NCT66" => DiceTable::D66Table.from_i18n("FutariSousa.table.NCT66", locale),
    "NCT10" => DiceTable::Table.from_i18n("FutariSousa.table.NCT10", locale),
  }
end

Public Instance Methods

eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/FutariSousa.rb, line 48
def eval_game_system_specific_command(command)
  if (m = /^(\d+)?DT$/i.match(command))
    count = m[1]&.to_i || 2
    return roll_dt(command, count)
  elsif (m = /^(\d+)?AS$/i.match(command))
    count = m[1]&.to_i || 2
    return roll_as(command, count)
  end

  return roll_tables(command, self.class::TABLES)
end

Private Instance Methods

roll_as(command, count) click to toggle source

助手用判定コマンド AS

# File lib/bcdice/game_system/FutariSousa.rb, line 89
def roll_as(command, count)
  dice_list = @randomizer.roll_barabara(count, 6)
  max = dice_list.max

  result =
    if max <= 1
      Result.fumble(translate("FutariSousa.AS.fumble"))
    elsif dice_list.include?(SPECIAL_DICE)
      Result.critical(translate("FutariSousa.AS.special"))
    elsif max >= SUCCESS_THRESHOLD
      Result.success(translate("FutariSousa.AS.success"))
    else
      Result.failure(translate("failure"))
    end

  result.text = "#{command}(#{dice_list.join(',')}) > #{result.text}"
  result
end
roll_dt(command, count) click to toggle source

探偵用判定コマンド DT

# File lib/bcdice/game_system/FutariSousa.rb, line 69
def roll_dt(command, count)
  dice_list = @randomizer.roll_barabara(count, 10)
  max = dice_list.max

  result =
    if max <= 1
      Result.fumble(translate("FutariSousa.DT.fumble"))
    elsif dice_list.include?(SPECIAL_DICE)
      Result.critical(translate("FutariSousa.DT.special"))
    elsif max >= SUCCESS_THRESHOLD
      Result.success(translate("success"))
    else
      Result.failure(translate("failure"))
    end

  result.text = "#{command}(#{dice_list.join(',')}) > #{result.text}"
  result
end