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
- #add_damage ⇒ Integer
- #critical ⇒ Integer
- #first_modify ⇒ Integer
- #first_modify_ssp ⇒ Integer
- #first_to ⇒ Integer
- #greatest_fortune ⇒ Boolean
- #kept_modify ⇒ Integer
- #modifier ⇒ Integer
- #modifier_after_double ⇒ Integer?
- #modifier_after_half ⇒ Integer?
- #modifier_after_one_and_a_half ⇒ Integer?
- #rate ⇒ Integer
- #rateup ⇒ Integer
- #semi_fixed_val ⇒ Integer
- #set_zero_val ⇒ Integer
- #tmp_fixed_val ⇒ Integer
Instance Method Summary collapse
- #double ⇒ Boolean
- #half ⇒ Boolean
- #infinite_roll? ⇒ Boolean
-
#initialize(rate, modifier) ⇒ RatingParsed
constructor
A new instance of RatingParsed.
- #min_critical ⇒ Integer
- #one_and_a_half ⇒ Boolean
- #to_s ⇒ String
Constructor Details
#initialize(rate, modifier) ⇒ RatingParsed
Returns a new instance of RatingParsed.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 55 def initialize(rate, modifier) @rate = rate @modifier = modifier @critical = 13 @kept_modify = 0 @first_to = 0 @first_modify = 0 @first_modify_ssp = 0 @greatest_fortune = false @rateup = 0 @add_damage = 0 @semi_fixed_val = 0 @tmp_fixed_val = 0 @set_zero_val = 0 @modifier_after_half = nil @modifier_after_one_and_a_half = nil @modifier_after_double = nil end |
Instance Attribute Details
#add_damage ⇒ Integer
29 30 31 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 29 def add_damage @add_damage end |
#critical ⇒ Integer
11 12 13 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 11 def critical @critical end |
#first_modify ⇒ Integer
20 21 22 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 20 def first_modify @first_modify end |
#first_modify_ssp ⇒ Integer
23 24 25 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 23 def first_modify_ssp @first_modify_ssp end |
#first_to ⇒ Integer
17 18 19 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 17 def first_to @first_to end |
#greatest_fortune ⇒ Boolean
32 33 34 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 32 def greatest_fortune @greatest_fortune end |
#kept_modify ⇒ Integer
14 15 16 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 14 def kept_modify @kept_modify end |
#modifier ⇒ Integer
44 45 46 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 44 def modifier @modifier end |
#modifier_after_double ⇒ Integer?
53 54 55 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 53 def modifier_after_double @modifier_after_double end |
#modifier_after_half ⇒ Integer?
47 48 49 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 47 def modifier_after_half @modifier_after_half end |
#modifier_after_one_and_a_half ⇒ Integer?
50 51 52 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 50 def modifier_after_one_and_a_half @modifier_after_one_and_a_half end |
#rate ⇒ Integer
8 9 10 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 8 def rate @rate end |
#rateup ⇒ Integer
26 27 28 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 26 def rateup @rateup end |
#semi_fixed_val ⇒ Integer
35 36 37 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 35 def semi_fixed_val @semi_fixed_val end |
#set_zero_val ⇒ Integer
41 42 43 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 41 def set_zero_val @set_zero_val end |
#tmp_fixed_val ⇒ Integer
38 39 40 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 38 def tmp_fixed_val @tmp_fixed_val end |
Instance Method Details
#double ⇒ Boolean
85 86 87 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 85 def double return !@modifier_after_double.nil? end |
#half ⇒ Boolean
75 76 77 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 75 def half return !@modifier_after_half.nil? end |
#infinite_roll? ⇒ Boolean
99 100 101 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 99 def infinite_roll? return critical < min_critical end |
#min_critical ⇒ Integer
90 91 92 93 94 95 96 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 90 def min_critical if @semi_fixed_val <= 1 return 3 else return (@semi_fixed_val + @kept_modify + 2).clamp(3, 13) end end |
#one_and_a_half ⇒ Boolean
80 81 82 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 80 def one_and_a_half return !@modifier_after_one_and_a_half.nil? end |
#to_s ⇒ String
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/bcdice/game_system/sword_world/rating_parsed.rb', line 104 def to_s() output = "KeyNo.#{@rate}" output += "c[#{critical}]" if critical < 13 output += "m[#{Format.modifier(first_modify)}]" if first_modify != 0 output += "m[~#{Format.modifier(first_modify_ssp)}]" if first_modify_ssp != 0 output += "m[#{first_to}]" if first_to != 0 output += "r[#{rateup}]" if rateup != 0 output += "ad[#{add_damage}]" if add_damage != 0 output += "gf" if @greatest_fortune output += "sf[#{semi_fixed_val}]" if semi_fixed_val != 0 output += "tf[#{tmp_fixed_val}]" if tmp_fixed_val != 0 output += "sz[#{set_zero_val}]" if set_zero_val != 0 output += "a[#{Format.modifier(kept_modify)}]" if kept_modify != 0 if @modifier != 0 output += Format.modifier(@modifier) end return output end |