class BCDice::GameSystem::OneWayHeroics

Constants

DUNGEON_TABLE
DUNGEON_TABLE_PLUS
HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

RANDOM_EVENT_TABLE
RANDOM_EVENT_TABLE_PLUS
SORT_KEY

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

TABLES

Public Class Methods

new(command) click to toggle source
Calls superclass method BCDice::Base::new
# File lib/bcdice/game_system/OneWayHeroics.rb, line 46
def initialize(command)
  super(command)
  @d66_sort_type = D66SortType::ASC
end

Public Instance Methods

eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/OneWayHeroics.rb, line 51
def eval_game_system_specific_command(command)
  case command
  when /^RET(\d+)$/
    day = Regexp.last_match(1).to_i
    RANDOM_EVENT_TABLE.roll_with_day(day, @randomizer)
  when /^RETP(\d+)$/
    day = Regexp.last_match(1).to_i
    RANDOM_EVENT_TABLE_PLUS.roll_with_day(day, @randomizer)
  when /^DNGN(\d+)$/
    day = Regexp.last_match(1).to_i
    DUNGEON_TABLE.roll_with_day(day, @randomizer)
  when /^DNGNP(\d+)$/
    day = Regexp.last_match(1).to_i
    DUNGEON_TABLE_PLUS.roll_with_day(day, @randomizer)
  when /^\d*JD/
    getRollDiceCommandResult(command)
  else
    roll_tables(command, TABLES)
  end
end
getJudgeReusltText(dice, total, target) click to toggle source
# File lib/bcdice/game_system/OneWayHeroics.rb, line 119
def getJudgeReusltText(dice, total, target)
  return "ファンブル" if dice == 2
  return "スペシャル" if dice == 12

  return "" if target.nil?

  return "成功" if total >= target

  return "失敗"
end
getRollDiceCommandResult(command) click to toggle source
# File lib/bcdice/game_system/OneWayHeroics.rb, line 72
def getRollDiceCommandResult(command)
  return nil unless command =~ /^(\d*)JD(\d*)(\+(\d*))?(,(\d+))?$/

  diceCount = Regexp.last_match(1)
  diceCount = 2 if diceCount.empty?
  diceCount = diceCount.to_i
  return nil if diceCount < 2

  ability = Regexp.last_match(2).to_i
  target = Regexp.last_match(6)
  target = target.to_i unless target.nil?

  modifyText = (Regexp.last_match(3) || "")
  modifyText = "+1" if modifyText == "+"
  modifyValue = modifyText.to_i

  dice, diceText = rollJudgeDice(diceCount)
  total = dice + ability + modifyValue

  text = command.to_s
  text += " > #{diceCount}D6[#{diceText}]+#{ability}#{modifyText}"
  text += " > #{total}"

  result = getJudgeReusltText(dice, total, target)
  text += " > #{result}" unless result.empty?

  return text
end
rollJudgeDice(diceCount) click to toggle source
# File lib/bcdice/game_system/OneWayHeroics.rb, line 101
def rollJudgeDice(diceCount)
  diceList = @randomizer.roll_barabara(diceCount, 6)
  dice = diceList.sum()
  diceText = diceList.join(",")

  if diceCount == 2
    return dice, diceText
  end

  diceList.sort!
  diceList.reverse!

  total = diceList[0] + diceList[1]
  text = "#{diceText}→#{diceList[0]},#{diceList[1]}"

  return total, text
end