class BCDice::GameSystem::FilledWith

Constants

AREA_LIST
COOK_TABLES

マジカルクッキング表

別の表に飛ぶ場合は、遅延評価のためにlambdaでジャンプ先の表を括る。

ENEMY_DATA
EVENT_TABLES
HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

LOT_NORMAL_TABLES

ナンバーワンノーマルくじ表(GURPS-FW版)

別の表に飛ぶ場合は、遅延評価のためにlambdaでジャンプ先の表を括る。

LOT_PREMIUM_TABLES

ナンバーワンプレミアムくじ表(GURPS-FW版)

別の表に飛ぶ場合は、遅延評価のためにlambdaでジャンプ先の表を括る。

NAME

ゲームシステム名

OPTION_TABLE
SORT_KEY

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

TABLES
TRAP_TABLE
TRESURE_TABLES

Public Class Methods

new(command) click to toggle source
Calls superclass method BCDice::Base::new
# File lib/bcdice/game_system/FilledWith.rb, line 49
def initialize(command)
  super(command)
  @d66_sort_type = D66SortType::NO_SORT; # d66の差し替え
end

Public Instance Methods

eval_game_system_specific_command(command) click to toggle source

@param command [String] コマンド @return [Result, nil] 固有コマンドの評価結果

# File lib/bcdice/game_system/FilledWith.rb, line 56
def eval_game_system_specific_command(command)
  # ダイスロールコマンド
  result = FW.roll(command, @randomizer)
  return result if result

  # 各種コマンド
  case command
  when "LOTN"
    roll_jump_table("ナンバーワンノーマルくじ", LOT_NORMAL_TABLES[1])
  when "LOTP"
    roll_jump_table("ナンバーワンプレミアムくじ", LOT_PREMIUM_TABLES[1])
  when /COOK([1-8])/
    lv = Regexp.last_match(1).to_i
    roll_jump_table("マジカルクッキング", COOK_TABLES[lv])
  when /TRAP[ENHLX]/
    roll_trap_table(command)
  when /TRS.*/i
    getTresureResult(command)
  when /RAND.*/
    roll_random_event_table(command)
  when /RENC.*/
    roll_random_event_table(command)
  when /RED.*/i
    fetch_enemy_data(command)
  when /ROP[ENHLX]/
    roll_random_option_table(command)
  else
    roll_tables(command, TABLES)
  end
end
fetch_enemy_data(command) click to toggle source

夢幻の迷宮エネミーデータ表

# File lib/bcdice/game_system/filled_with/enemy_data_tables.rb, line 7
def fetch_enemy_data(command)
  m = /^RED([ENHLX])(256|265|465|665|666|[1-6]4[1-6])$/.match(command)
  unless m
    return nil
  end

  difficulty = Difficulty.new(m[1])
  key = m[2]
  area_name = AREA_LIST[key[0].to_i - 1]

  chosen = ENEMY_DATA[key][difficulty.index]

  return "エネミーデータ表(#{key}):#{area_name}<#{difficulty.name}>:#{chosen}"
end
format_table_roll_result(table_name, number, result) click to toggle source

表を振った結果を独自の書式で整形する @param table_name [String] 表の名前 @param number [String] 出目の文字列 @param result [String] 結果の文章 @return [String]

# File lib/bcdice/game_system/FilledWith.rb, line 92
def format_table_roll_result(table_name, number, result)
  "#{table_name}(#{number}):#{result}"
end
getTresureResult(command) click to toggle source

夢幻の迷宮財宝表

# File lib/bcdice/game_system/filled_with/tresure_tables.rb, line 7
def getTresureResult(command)
  m = /^TRS(\d+)([+\-]\d)?$/.match(command)
  unless m
    return nil
  end

  rank = m[1].to_i + m[2].to_i
  rank = rank.clamp(0, 12)

  return TRESURE_TABLES[rank].roll(@randomizer)
end
roll_jump_table(table_name, table) click to toggle source

ジャンプする項目を含む表を振る @param table_name [String] 表の名前 @param table [DiceTable::RangeTable] 振る対象の表 @return [Result]

# File lib/bcdice/game_system/FilledWith.rb, line 100
def roll_jump_table(table_name, table)
  # 出目の配列
  values = []

  loop do
    roll_result = table.roll(@randomizer)
    values.concat(roll_result.values)

    content = roll_result.content
    case content
    when String
      return Result.new(format_table_roll_result(table_name, values.join, content))
    when Proc
      # 次の繰り返しで指定された表を参照する
      table = content.call
    else
      raise TypeError
    end
  end
end
roll_random_event_table(command) click to toggle source

夢幻の迷宮ランダムイベント表

# File lib/bcdice/game_system/FilledWith.rb, line 351
def roll_random_event_table(command)
  m = /^(RAND|RENC)([ENHLX])([1-6])?$/.match(command)
  unless m
    return nil
  end

  type = m[1] == "RAND" ? nil : 4
  difficulty = Difficulty.new(m[2])
  area = m[3]&.to_i || @randomizer.roll_once(6)

  table = EVENT_TABLES[area - 1]
  return table.roll(@randomizer, difficulty, type: type)
end
roll_random_option_table(command) click to toggle source

夢幻の迷宮追加オプション表

# File lib/bcdice/game_system/FilledWith.rb, line 340
def roll_random_option_table(command)
  m = /^ROP([ENHLX])$/.match(command)
  unless m
    return nil
  end

  difficality = Difficulty.new(m[1])
  return OPTION_TABLE.roll(@randomizer, difficality)
end
roll_trap_table(command) click to toggle source

夢幻の迷宮トラップ表

# File lib/bcdice/game_system/FilledWith.rb, line 270
def roll_trap_table(command)
  m = /^TRAP([ENHLX])$/.match(command)
  unless m
    return nil
  end

  difficality = Difficulty.new(m[1])
  number = @randomizer.roll_sum(3, 6)
  chosen = TRAP_TABLE[number - 3]

  return "トラップ表<#{difficality.name}>(#{number}):#{chosen.format(difficality)}"
end