class BCDice::GameSystem::DiceOfTheDead

Constants

HELP_MESSAGE

ダイスボットの使い方

ID

ゲームシステムの識別子

NAME

ゲームシステム名

SORT_KEY

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

Public Class Methods

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

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

Public Instance Methods

checkInfection(roll_times) click to toggle source
# File lib/bcdice/game_system/DiceOfTheDead.rb, line 52
def checkInfection(roll_times)
  result = "感染度表"

  roll_times.times do
    d1 = @randomizer.roll_once(6)
    d2 = @randomizer.roll_once(6)

    result += " > 出目:#{d1}、#{d2} "

    index1 = (d1 / 2.0).ceil - 1
    index2 = (d2 / 2.0).ceil - 1

    table =
      [["「右下(【足】+1)」", "「右中(【足】+1)」", "「右上(【足】+1)」"],
       ["「中下(【腕】+1)」", "「真中(【腕】+1)」", "「中上(【腕】+1)」"],
       ["「左下(【頭】+1)」", "「左中(【頭】+1)」", "「左上(【頭】+1)」"],]

    result += table[index1][index2]
  end

  return result
end
eval_game_system_specific_command(command) click to toggle source
# File lib/bcdice/game_system/DiceOfTheDead.rb, line 33
def eval_game_system_specific_command(command)
  case command
  when /^BIO(\d+)?$/
    roll_times = (Regexp.last_match(1) || 1).to_i

    Result.new.tap do |r|
      r.secret = true
      r.text = checkInfection(roll_times)
    end
  when /^ZMB(\+(\d+))?$/
    value = Regexp.last_match(2).to_i

    Result.new.tap do |r|
      r.secret = true
      r.text = rollZombie(value)
    end
  end
end
rollZombie(value) click to toggle source

各種表

# File lib/bcdice/game_system/DiceOfTheDead.rb, line 78
def rollZombie(value)
  d1 = @randomizer.roll_once(6)
  d2 = @randomizer.roll_once(6)

  diceTotal = d1 + d2 + value

  table = [
    [5, "5以下:影響なし"],
    [6, "6:任意の部位を1点回復"],
    [7, "7:〈アイテム〉武器を1つその場に落とす"],
    [8, "8:〈アイテム〉便利道具1つをその場に落とす"],
    [9, "9:〈アイテム〉消耗品1つをその場に落とす"],
    [10, "10:腕の傷が広がる。「部位:【腕】」1点ダメージ"],
    [11, "11:足の傷が広がる。「部位:【足】」1点ダメージ"],
    [12, "12:頭の傷が広がる。「部位:【頭】」1点ダメージ"],
    [13, "13:【ゾンビ化表】が新たに適用されるまで「【感染度】+1マス」の効果を受ける"],
    [14, "14:即座に自分以外の味方1人のスロット内の〈アイテム〉1つをランダムに捨てさせる"],
    [15, "15:味方1人に素手で攻撃を行う"],
    [16, "16:即座に感染度が1上昇する"],
    [17, "17:次のターンのみ、すべての【能力値】を2倍にする"],
    [18, "18以上:自分以外の味方1人にできる限り全力で攻撃を行う。〈アイテム〉も可能な限り使用する"]
  ]

  minDice = table.first.first
  maxDice = table.last.first
  index = diceTotal
  index = [minDice, index].max
  index = [index, maxDice].min

  _number, text = table.assoc(index)
  result = "ゾンビ化表 > 出目:#{d1}+#{d2} 感染度:#{value} 合計値:#{diceTotal} > #{text}"

  return result
end