Class: Lich::Gemstone::DefenseAttributes
- Inherits:
-
Object
- Object
- Lich::Gemstone::DefenseAttributes
- Defined in:
- documented/gemstone/creature.rb
Overview
Defense configuration for a creature template.
Tracks all defensive mechanics: armor/shield/guard/magic defense values, TD (Target Defense) for each caster class, spell immunities, and passive defensive spells/abilities.
Instance Attribute Summary collapse
-
#asg ⇒ Object
Returns the value of attribute asg.
-
#bar_td ⇒ Object
Returns the value of attribute bar_td.
-
#bolt ⇒ Object
Returns the value of attribute bolt.
-
#cle_td ⇒ Object
Returns the value of attribute cle_td.
-
#defensive_abilities ⇒ Object
Returns the value of attribute defensive_abilities.
-
#defensive_spells ⇒ Object
Returns the value of attribute defensive_spells.
-
#emp_td ⇒ Object
Returns the value of attribute emp_td.
-
#immunities ⇒ Object
Returns the value of attribute immunities.
-
#melee ⇒ Object
Returns the value of attribute melee.
-
#mje_td ⇒ Object
Returns the value of attribute mje_td.
-
#mjs_td ⇒ Object
Returns the value of attribute mjs_td.
-
#mne_td ⇒ Object
Returns the value of attribute mne_td.
-
#mnm_td ⇒ Object
Returns the value of attribute mnm_td.
-
#mns_td ⇒ Object
Returns the value of attribute mns_td.
-
#pal_td ⇒ Object
Returns the value of attribute pal_td.
-
#ran_td ⇒ Object
Returns the value of attribute ran_td.
-
#ranged ⇒ Object
Returns the value of attribute ranged.
-
#sor_td ⇒ Object
Returns the value of attribute sor_td.
-
#special_defenses ⇒ Object
Returns the value of attribute special_defenses.
-
#udf ⇒ Object
Returns the value of attribute udf.
-
#wiz_td ⇒ Object
Returns the value of attribute wiz_td.
Instance Method Summary collapse
-
#initialize(data) ⇒ void
constructor
Initializes defense attributes from template data.
Constructor Details
#initialize(data) ⇒ void
Initializes defense attributes from template data.
Parses all defense values, including armor-type defenses (ASG, melee, ranged, bolt, UDF) and caster-specific TDs (BAR, CLR, EMP, PAL, RAN, SOR, WIZ, etc.). TD values are converted from string ranges ("10..15") to Range objects as needed.
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 |
# File 'documented/gemstone/creature.rb', line 797 def initialize(data) @asg = data[:asg] @melee = parse_td(data[:melee]) @ranged = parse_td(data[:ranged]) @bolt = parse_td(data[:bolt]) @udf = parse_td(data[:udf]) %i[bar_td cle_td emp_td pal_td ran_td sor_td wiz_td mje_td mne_td mjs_td mns_td mnm_td].each do |key| instance_variable_set("@#{key}", parse_td(data[key])) end @immunities = data[:immunities] || [] @defensive_spells = data[:defensive_spells] || [] @defensive_abilities = data[:defensive_abilities] || [] @special_defenses = data[:special_defenses] || [] end |
Instance Attribute Details
#asg ⇒ Object
Returns the value of attribute asg.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def asg @asg end |
#bar_td ⇒ Object
Returns the value of attribute bar_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def @bar_td end |
#bolt ⇒ Object
Returns the value of attribute bolt.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def bolt @bolt end |
#cle_td ⇒ Object
Returns the value of attribute cle_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def cle_td @cle_td end |
#defensive_abilities ⇒ Object
Returns the value of attribute defensive_abilities.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def defensive_abilities @defensive_abilities end |
#defensive_spells ⇒ Object
Returns the value of attribute defensive_spells.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def defensive_spells @defensive_spells end |
#emp_td ⇒ Object
Returns the value of attribute emp_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def emp_td @emp_td end |
#immunities ⇒ Object
Returns the value of attribute immunities.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def immunities @immunities end |
#melee ⇒ Object
Returns the value of attribute melee.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def melee @melee end |
#mje_td ⇒ Object
Returns the value of attribute mje_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def mje_td @mje_td end |
#mjs_td ⇒ Object
Returns the value of attribute mjs_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def mjs_td @mjs_td end |
#mne_td ⇒ Object
Returns the value of attribute mne_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def mne_td @mne_td end |
#mnm_td ⇒ Object
Returns the value of attribute mnm_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def mnm_td @mnm_td end |
#mns_td ⇒ Object
Returns the value of attribute mns_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def mns_td @mns_td end |
#pal_td ⇒ Object
Returns the value of attribute pal_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def pal_td @pal_td end |
#ran_td ⇒ Object
Returns the value of attribute ran_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def ran_td @ran_td end |
#ranged ⇒ Object
Returns the value of attribute ranged.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def ranged @ranged end |
#sor_td ⇒ Object
Returns the value of attribute sor_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def sor_td @sor_td end |
#special_defenses ⇒ Object
Returns the value of attribute special_defenses.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def special_defenses @special_defenses end |
#udf ⇒ Object
Returns the value of attribute udf.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def udf @udf end |
#wiz_td ⇒ Object
Returns the value of attribute wiz_td.
783 784 785 |
# File 'documented/gemstone/creature.rb', line 783 def wiz_td @wiz_td end |