Class: BCDice::GameSystem::SwordWorld::RatingParsed

Inherits:
Object
  • Object
show all
Defined in:
lib/bcdice/game_system/sword_world/rating_parsed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRatingParsed

Returns a new instance of RatingParsed.



34
35
36
37
38
39
40
41
# 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

Instance Attribute Details

#criticalInteger

Returns:

  • (Integer)


49
50
51
52
53
# 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_modifyInteger

Returns:

  • (Integer)


56
57
58
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 56

def first_modify
  return @first_modify || 0
end

#first_toObject



61
62
63
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 61

def first_to
  return @first_to || 0
end

#greatest_fortuneBoolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 26

def greatest_fortune
  @greatest_fortune
end

#kept_modifyObject



71
72
73
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 71

def kept_modify
  return @kept_modify || 0
end

#modifierInteger

Returns:

  • (Integer)


29
30
31
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 29

def modifier
  @modifier
end

#modifier_after_halfObject



76
77
78
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 76

def modifier_after_half
  return @modifier_after_half || 0
end

#rateInteger

Returns:

  • (Integer)


8
9
10
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 8

def rate
  @rate
end

#rateupObject



66
67
68
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 66

def rateup
  return @rateup || 0
end

Instance Method Details

#halfBoolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 44

def half
  return !@modifier_after_half.nil?
end

#to_sString

Returns:

  • (String)


81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# 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