class BCDice::GameSystem::Fiasco::Side

片方の色のダイスロールを抽象化したクラス

Attributes

color[R]
total[R]

Public Class Methods

new(color, count) click to toggle source
# File lib/bcdice/game_system/Fiasco.rb, line 103
def initialize(color, count)
  @color = color
  @count = count
end

Public Instance Methods

diff(other) click to toggle source

もう一方の色との差分を求める @param other [Side] @return [String]

# File lib/bcdice/game_system/Fiasco.rb, line 126
def diff(other)
  if @total == other.total
    "0"
  elsif @total > other.total
    "#{@color}#{@total - other.total}"
  else
    "#{other.color}#{other.total - @total}"
  end
end
roll(randomizer) click to toggle source

@param randomizer [Randomizer] @return [String]

# File lib/bcdice/game_system/Fiasco.rb, line 110
def roll(randomizer)
  @dice_list =
    if @count == 0
      [0]
    else
      randomizer.roll_barabara(@count, 6)
    end

  @total = @dice_list.sum()

  "#{@color}#{@total}[#{@dice_list.join(',')}]"
end