class BCDice::GameSystem::SwordWorld::RatingParsed

Attributes

critical[W]

@return [Integer, nil]

first_modify[W]

@return [Integer, nil]

first_to[W]

@return [Integer, nil]

greatest_fortune[RW]

@return [Boolean]

kept_modify[W]

@return [Integer, nil]

modifier[RW]

@return [Integer]

modifier_after_half[W]

@return [Integer, nil]

rate[RW]

@return [Integer]

rateup[W]

@return [Integer, nil]

Public Class Methods

new() click to toggle source
# File lib/bcdice/game_system/sword_world/rating_parsed.rb, line 34
def initialize
  @critical = nil
  @kept_modify = nil
  @first_to = nil
  @first_modify = nil
  @greatest_fortune = false
  @rateup = nil
end

Public Instance Methods

critical() click to toggle source

@return [Integer]

# File lib/bcdice/game_system/sword_world/rating_parsed.rb, line 49
def critical
  crit = @critical || (half ? 13 : 10)
  crit = 3 if crit < 3
  return crit
end
first_modify() click to toggle source

@return [Integer]

# File lib/bcdice/game_system/sword_world/rating_parsed.rb, line 56
def first_modify
  return @first_modify || 0
end
first_to() click to toggle source

@return [Integer]

# File lib/bcdice/game_system/sword_world/rating_parsed.rb, line 61
def first_to
  return @first_to || 0
end
half() click to toggle source

@return [Boolean]

# File lib/bcdice/game_system/sword_world/rating_parsed.rb, line 44
def half
  return !@modifier_after_half.nil?
end
kept_modify() click to toggle source

@return [Integer]

# File lib/bcdice/game_system/sword_world/rating_parsed.rb, line 71
def kept_modify
  return @kept_modify || 0
end
modifier_after_half() click to toggle source

@return [Integer]

# File lib/bcdice/game_system/sword_world/rating_parsed.rb, line 76
def modifier_after_half
  return @modifier_after_half || 0
end
rateup() click to toggle source

@return [Integer]

# File lib/bcdice/game_system/sword_world/rating_parsed.rb, line 66
def rateup
  return @rateup || 0
end
to_s() click to toggle source

@return [String]

# File lib/bcdice/game_system/sword_world/rating_parsed.rb, line 81
def to_s()
  output = "KeyNo.#{@rate}"

  output += "c[#{critical}]" if critical < 13
  output += "m[#{Format.modifier(first_modify)}]" if first_modify != 0
  output += "m[#{first_to}]" if first_to != 0
  output += "r[#{rateup}]" if rateup != 0
  output += "gf" if @greatest_fortune
  output += "a[#{Format.modifier(kept_modify)}]" if kept_modify != 0

  if @modifier != 0
    output += Format.modifier(@modifier)
  end
  return output
end