class BCDice::GameSystem::Insane

Constants

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/Insane.rb, line 40
def initialize(command)
  super(command)

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

Private Class Methods

translate_rtt(locale) click to toggle source
# File lib/bcdice/game_system/Insane.rb, line 177
def translate_rtt(locale)
  DiceTable::SaiFicSkillTable.from_i18n("Insane.RTT", locale, rttn: ["TVT", "TET", "TPT", "TST", "TKT", "TMT"])
end
translate_tables(locale) click to toggle source
# File lib/bcdice/game_system/Insane.rb, line 147
def translate_tables(locale)
  {
    "ST" => DiceTable::Table.from_i18n("Insane.table.ST", locale),
    "HJST" => DiceTable::Table.from_i18n("Insane.table.HJST", locale),
    "MTST" => DiceTable::Table.from_i18n("Insane.table.MTST", locale),
    "DVST" => DiceTable::Table.from_i18n("Insane.table.DVST", locale),
    "DT" => DiceTable::D66Table.from_i18n("Insane.table.DT", locale),
    "BT" => DiceTable::D66Table.from_i18n("Insane.table.BT", locale),
    "PT" => DiceTable::D66Table.from_i18n("Insane.table.PT", locale),
    "FT" => DiceTable::Table.from_i18n("Insane.table.FT", locale),
    "JT" => DiceTable::D66Table.from_i18n("Insane.table.JT", locale),
    "CHT" => DiceTable::Table.from_i18n("Insane.table.CHT", locale),
    "VHT" => DiceTable::Table.from_i18n("Insane.table.VHT", locale),
    "IHT" => DiceTable::Table.from_i18n("Insane.table.IHT", locale),
    "RHT" => DiceTable::Table.from_i18n("Insane.table.RHT", locale),
    "MHT" => DiceTable::Table.from_i18n("Insane.table.MHT", locale),
    "LHT" => DiceTable::Table.from_i18n("Insane.table.LHT", locale),
    "ECT" => DiceTable::Table.from_i18n("Insane.table.ECT", locale),
    "EMT" => DiceTable::Table.from_i18n("Insane.table.EMT", locale),
    "EAT" => DiceTable::Table.from_i18n("Insane.table.EAT", locale),
    "OHT" => DiceTable::Table.from_i18n("Insane.table.OHT", locale),
    "OPT" => DiceTable::Table.from_i18n("Insane.table.OPT", locale),
    "OWT" => DiceTable::Table.from_i18n("Insane.table.OWT", locale),
    "CNT1" => DiceTable::Table.from_i18n("Insane.table.CNT1", locale),
    "CNT2" => DiceTable::Table.from_i18n("Insane.table.CNT2", locale),
    "CNT3" => DiceTable::Table.from_i18n("Insane.table.CNT3", locale),
    "RET" => DiceTable::Table.from_i18n("Insane.table.RET", locale),
  }
end

Public Instance Methods

eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/Insane.rb, line 65
def eval_game_system_specific_command(command)
  case command
  when 'BET'
    type = translate("Insane.BET.name")
    output, total_n = get_badend_table
  when 'IRN'
    type = translate("Insane.IRN.name")
    output, total_n = get_interim_reference_number
  else
    return self.class::RTT.roll_command(@randomizer, command) || roll_tables(command, self.class::TABLES)
  end

  return "#{type}(#{total_n}) > #{output}"
end
result_2d6(total, dice_total, _dice_list, cmp_op, target) click to toggle source

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

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

  if dice_total <= 2
    Result.fumble(translate("Insane.fumble"))
  elsif dice_total >= 12
    Result.critical(translate("Insane.special"))
  elsif target == "?"
    Result.nothing
  elsif total >= target
    Result.success(translate("success"))
  else
    Result.failure(translate("failure"))
  end
end

Private Instance Methods

get_badend_table() click to toggle source

バッドエンド表

# File lib/bcdice/game_system/Insane.rb, line 83
def get_badend_table
  table = [
    translate("Insane.BET.items.2"),
    lambda { return translate("Insane.BET.items.3", skill: self.class::RTT.roll_skill(@randomizer)) },
    translate("Insane.BET.items.4"),
    translate("Insane.BET.items.5"),
    translate("Insane.BET.items.6"),
    translate("Insane.BET.items.7"),
    translate("Insane.BET.items.8"),
    translate("Insane.BET.items.9"),
    translate("Insane.BET.items.10"),
    lambda { return translate("Insane.BET.items.11", skill: self.class::RTT.roll_skill(@randomizer)) },
    translate("Insane.BET.items.12"),
  ]
  return get_table_by_2d6(table)
end
get_interim_reference_number() click to toggle source

暫定整理番号作成表

# File lib/bcdice/game_system/Insane.rb, line 101
def get_interim_reference_number
  table = [
    [11, '1'],
    [12, '2'],
    [13, '3'],
    [14, '4'],
    [15, '5'],
    [16, '6'],
    [22, 'G'],
    [23, 'I'],
    [24, 'J'],
    [25, 'K'],
    [26, 'O'],
    [33, 'P'],
    [34, 'Q'],
    [35, 'S'],
    [36, 'T'],
    [44, 'U'],
    [45, 'V'],
    [46, 'X'],
    [55, 'Y'],
    [56, 'Z'],
    [66, '-'],
  ]

  number = @randomizer.roll_once(6)
  total_n = number.to_s
  counts = 3
  if number <= 4
    counts = number + 5
  elsif number == 5
    counts = 4
  end

  output = ''
  counts.times do
    character, number = get_table_by_d66_swap(table)
    output += character
    total_n += ",#{number}"
  end
  return output, total_n
end