Class: Lich::Common::Char
- Inherits:
-
Object
- Object
- Lich::Common::Char
- Defined in:
- documented/attributes/char.rb
Overview
Represents a character in the Lich game. This class provides various methods to access character attributes.
Class Method Summary collapse
-
.che ⇒ String?
Returns the ‘che’ attribute of the character if applicable.
-
.citizenship ⇒ String?
Returns the citizenship of the character if applicable.
-
.citizenship=(_val) ⇒ void
deprecated
Deprecated.
Updating via Char.citizenship is no longer supported.
-
.dump_info ⇒ void
deprecated
Deprecated.
Char.dump_info is no longer used.
-
.encumbrance ⇒ String
Returns the encumbrance text of the character.
-
.health ⇒ Integer
Returns the current health of the character.
-
.info ⇒ void
deprecated
Deprecated.
Char.info is no longer supported.
-
.init(_blah) ⇒ void
deprecated
Deprecated.
Char.init is no longer used.
-
.load_info(_string) ⇒ void
deprecated
Deprecated.
Char.load_info is no longer used.
-
.mana ⇒ Integer
Returns the current mana of the character.
-
.max_health ⇒ Integer
Returns the maximum health of the character.
-
.max_mana ⇒ Integer
Returns the maximum mana of the character.
-
.max_spirit ⇒ Integer
Returns the maximum spirit of the character.
-
.max_stamina ⇒ Integer
Returns the maximum stamina of the character.
-
.maxhealth ⇒ Integer
deprecated
Deprecated.
Use Char.max_health instead.
-
.maxmana ⇒ Integer
deprecated
Deprecated.
Use Char.max_mana instead.
-
.maxspirit ⇒ Integer
deprecated
Deprecated.
Use Char.max_spirit instead.
-
.maxstamina ⇒ Integer
deprecated
Deprecated.
Use Char.max_stamina instead.
-
.method_missing(meth, *args) ⇒ Object
Handles missing methods for the character.
-
.name ⇒ String
Returns the name of the character.
-
.percent_encumbrance ⇒ Integer
Returns the percentage of the character’s encumbrance.
-
.percent_health ⇒ Integer
Returns the percentage of the character’s health.
-
.percent_mana ⇒ Integer
Returns the percentage of the character’s mana.
-
.percent_spirit ⇒ Integer
Returns the percentage of the character’s spirit.
-
.percent_stamina ⇒ Integer
Returns the percentage of the character’s stamina.
-
.percent_stance ⇒ Integer
Returns the percentage of the character’s stance.
-
.respond_to?(m, *args) ⇒ Boolean
Checks if the character responds to a method.
-
.skills ⇒ void
deprecated
Deprecated.
Char.skills is no longer supported.
-
.spirit ⇒ Integer
Returns the current spirit of the character.
-
.stamina ⇒ Integer
Returns the current stamina of the character.
-
.stance ⇒ String
Returns the current stance of the character.
Class Method Details
.che ⇒ String?
Returns the ‘che’ attribute of the character if applicable.
291 292 293 |
# File 'documented/attributes/char.rb', line 291 def Char.che Infomon.get('che') if XMLData.game =~ /^GS/ end |
.citizenship ⇒ String?
Returns the citizenship of the character if applicable.
273 274 275 |
# File 'documented/attributes/char.rb', line 273 def Char.citizenship Infomon.get('citizenship') if XMLData.game =~ /^GS/ end |
.citizenship=(_val) ⇒ void
Updating via Char.citizenship is no longer supported.
This method returns an undefined value.
Sets the citizenship of the character (deprecated).
283 284 285 |
# File 'documented/attributes/char.rb', line 283 def Char.citizenship=(_val) echo "Updating via Char.citizenship is no longer supported. Update or fix your script." end |
.dump_info ⇒ void
Char.dump_info is no longer used.
This method returns an undefined value.
Dumps character information (deprecated).
210 211 212 |
# File 'documented/attributes/char.rb', line 210 def Char.dump_info echo "Char.dump_info is no longer used. Update or fix your script." end |
.encumbrance ⇒ String
Returns the encumbrance text of the character.
48 49 50 |
# File 'documented/attributes/char.rb', line 48 def Char.encumbrance XMLData.encumbrance_text end |
.health ⇒ Integer
Returns the current health of the character.
64 65 66 |
# File 'documented/attributes/char.rb', line 64 def Char.health XMLData.health end |
.info ⇒ void
Char.info is no longer supported.
This method returns an undefined value.
Provides character information (deprecated).
256 257 258 |
# File 'documented/attributes/char.rb', line 256 def Char.info echo "Char.info is no longer supported. Update or fix your script." end |
.init(_blah) ⇒ void
Char.init is no longer used.
This method returns an undefined value.
Initializes the character (deprecated).
16 17 18 |
# File 'documented/attributes/char.rb', line 16 def Char.init(_blah) echo 'Char.init is no longer used. Update or fix your script.' end |
.load_info(_string) ⇒ void
Char.load_info is no longer used.
This method returns an undefined value.
Loads character information (deprecated).
220 221 222 |
# File 'documented/attributes/char.rb', line 220 def Char.load_info(_string) echo "Char.load_info is no longer used. Update or fix your script." end |
.mana ⇒ Integer
Returns the current mana of the character.
72 73 74 |
# File 'documented/attributes/char.rb', line 72 def Char.mana XMLData.mana end |
.max_health ⇒ Integer
Returns the maximum health of the character.
96 97 98 99 |
# File 'documented/attributes/char.rb', line 96 def Char.max_health # Object.module_eval { XMLData.max_health } XMLData.max_health end |
.max_mana ⇒ Integer
Returns the maximum mana of the character.
115 116 117 |
# File 'documented/attributes/char.rb', line 115 def Char.max_mana Object.module_eval { XMLData.max_mana } end |
.max_spirit ⇒ Integer
Returns the maximum spirit of the character.
133 134 135 |
# File 'documented/attributes/char.rb', line 133 def Char.max_spirit Object.module_eval { XMLData.max_spirit } end |
.max_stamina ⇒ Integer
Returns the maximum stamina of the character.
151 152 153 |
# File 'documented/attributes/char.rb', line 151 def Char.max_stamina Object.module_eval { XMLData.max_stamina } end |
.maxhealth ⇒ Integer
Use Char.max_health instead.
Returns the maximum health of the character (deprecated).
106 107 108 109 |
# File 'documented/attributes/char.rb', line 106 def Char.maxhealth Lich.deprecated("Char.maxhealth", "Char.max_health", caller[0], fe_log: true) Char.max_health end |
.maxmana ⇒ Integer
Use Char.max_mana instead.
Returns the maximum mana of the character (deprecated).
124 125 126 127 |
# File 'documented/attributes/char.rb', line 124 def Char.maxmana Lich.deprecated("Char.maxmana", "Char.max_mana", caller[0], fe_log: true) Char.max_mana end |
.maxspirit ⇒ Integer
Use Char.max_spirit instead.
Returns the maximum spirit of the character (deprecated).
142 143 144 145 |
# File 'documented/attributes/char.rb', line 142 def Char.maxspirit Lich.deprecated("Char.maxspirit", "Char.max_spirit", caller[0], fe_log: true) Char.max_spirit end |
.maxstamina ⇒ Integer
Use Char.max_stamina instead.
Returns the maximum stamina of the character (deprecated).
160 161 162 163 |
# File 'documented/attributes/char.rb', line 160 def Char.maxstamina Lich.deprecated("Char.maxstamina", "Char.max_stamina", caller[0], fe_log: true) Char.max_stamina end |
.method_missing(meth, *args) ⇒ Object
Handles missing methods for the character.
240 241 242 243 244 245 246 247 248 249 |
# File 'documented/attributes/char.rb', line 240 def Char.method_missing(meth, *args) polyfill = [Stats, Skills, Spellsong].find { |klass| klass.respond_to?(meth, *args) } if polyfill Lich.deprecated("Char.#{meth}", "#{polyfill}.#{meth}", caller[0]) return polyfill.send(meth, *args) end super(meth, *args) end |
.name ⇒ String
Returns the name of the character.
24 25 26 |
# File 'documented/attributes/char.rb', line 24 def Char.name XMLData.name end |
.percent_encumbrance ⇒ Integer
Returns the percentage of the character’s encumbrance.
56 57 58 |
# File 'documented/attributes/char.rb', line 56 def Char.percent_encumbrance XMLData.encumbrance_value end |
.percent_health ⇒ Integer
Returns the percentage of the character’s health.
169 170 171 |
# File 'documented/attributes/char.rb', line 169 def Char.percent_health ((XMLData.health.to_f / XMLData.max_health.to_f) * 100).to_i end |
.percent_mana ⇒ Integer
Returns the percentage of the character’s mana.
177 178 179 180 181 182 183 |
# File 'documented/attributes/char.rb', line 177 def Char.percent_mana if XMLData.max_mana == 0 100 else ((XMLData.mana.to_f / XMLData.max_mana.to_f) * 100).to_i end end |
.percent_spirit ⇒ Integer
Returns the percentage of the character’s spirit.
189 190 191 |
# File 'documented/attributes/char.rb', line 189 def Char.percent_spirit ((XMLData.spirit.to_f / XMLData.max_spirit.to_f) * 100).to_i end |
.percent_stamina ⇒ Integer
Returns the percentage of the character’s stamina.
197 198 199 200 201 202 203 |
# File 'documented/attributes/char.rb', line 197 def Char.percent_stamina if XMLData.max_stamina == 0 100 else ((XMLData.stamina.to_f / XMLData.max_stamina.to_f) * 100).to_i end end |
.percent_stance ⇒ Integer
Returns the percentage of the character’s stance.
40 41 42 |
# File 'documented/attributes/char.rb', line 40 def Char.percent_stance XMLData.stance_value end |
.respond_to?(m, *args) ⇒ Boolean
Checks if the character responds to a method.
230 231 232 |
# File 'documented/attributes/char.rb', line 230 def Char.respond_to?(m, *args) [Stats, Skills, Spellsong].any? { |k| k.respond_to?(m) } or super(m, *args) end |
.skills ⇒ void
Char.skills is no longer supported.
This method returns an undefined value.
Provides character skills information (deprecated).
265 266 267 |
# File 'documented/attributes/char.rb', line 265 def Char.skills echo "Char.skills is no longer supported. Update or fix your script." end |
.spirit ⇒ Integer
Returns the current spirit of the character.
80 81 82 |
# File 'documented/attributes/char.rb', line 80 def Char.spirit XMLData.spirit end |
.stamina ⇒ Integer
Returns the current stamina of the character.
88 89 90 |
# File 'documented/attributes/char.rb', line 88 def Char.stamina XMLData.stamina end |