Class: BCDice::GameSystem::SwordWorld::RatingParsed
- Inherits:
-
Object
- Object
- BCDice::GameSystem::SwordWorld::RatingParsed
- Defined in:
- lib/bcdice/game_system/sword_world/rating_parsed.rb
Instance Attribute Summary collapse
- #critical ⇒ Integer
- #first_modify ⇒ Integer
- #first_to ⇒ Object
- #greatest_fortune ⇒ Boolean
- #kept_modify ⇒ Object
- #modifier ⇒ Integer
- #modifier_after_half ⇒ Object
- #rate ⇒ Integer
- #rateup ⇒ Object
Instance Method Summary collapse
- #half ⇒ Boolean
-
#initialize ⇒ RatingParsed
constructor
A new instance of RatingParsed.
- #to_s ⇒ String
Constructor Details
#initialize ⇒ RatingParsed
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
#critical ⇒ 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_modify ⇒ 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_to ⇒ Object
61 62 63 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 61 def first_to return @first_to || 0 end |
#greatest_fortune ⇒ Boolean
26 27 28 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 26 def greatest_fortune @greatest_fortune end |
#kept_modify ⇒ Object
71 72 73 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 71 def kept_modify return @kept_modify || 0 end |
#modifier ⇒ Integer
29 30 31 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 29 def modifier @modifier end |
#modifier_after_half ⇒ Object
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 |
#rate ⇒ Integer
8 9 10 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 8 def rate @rate end |
#rateup ⇒ Object
66 67 68 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 66 def rateup return @rateup || 0 end |
Instance Method Details
#half ⇒ 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_s ⇒ 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 |