Class: Lich::Gemstone::DefenseAttributes

Inherits:
Object
  • Object
show all
Defined in:
documented/gemstone/creature.rb

Overview

Creature defensive statistics and special defenses.

Armor and spell TD values, immunities, defensive spell/ability lists. Ranges (e.g., TD spread) are parsed from strings into Range objects; numeric values are stored as-is.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ void

Initializes defense attributes from creature template data.

Parses range values ("10..15" strings into Range objects). All numeric TD values are converted using parse_td; lists are stored as-is or empty arrays.

Parameters:

  • data (Hash) —

    defense attributes including :asg, :melee, :ranged, :bolt, :udf, :bar_td, :cle_td, :emp_td, :pal_td, :ran_td, :sor_td, :wiz_td, :mje_td, :mne_td, :mjs_td, :mns_td, :mnm_td, :immunities, :defensive_spells, :defensive_abilities, :special_defenses



1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
# File 'documented/gemstone/creature.rb', line 1025

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.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def asg
  @asg
end

#bar_td ⇒ Object

Returns the value of attribute bar_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def bar_td
  @bar_td
end

#bolt ⇒ Object

Returns the value of attribute bolt.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def bolt
  @bolt
end

#cle_td ⇒ Object

Returns the value of attribute cle_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def cle_td
  @cle_td
end

#defensive_abilities ⇒ Object

Returns the value of attribute defensive_abilities.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def defensive_abilities
  @defensive_abilities
end

#defensive_spells ⇒ Object

Returns the value of attribute defensive_spells.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def defensive_spells
  @defensive_spells
end

#emp_td ⇒ Object

Returns the value of attribute emp_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def emp_td
  @emp_td
end

#immunities ⇒ Object

Returns the value of attribute immunities.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def immunities
  @immunities
end

#melee ⇒ Object

Returns the value of attribute melee.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def melee
  @melee
end

#mje_td ⇒ Object

Returns the value of attribute mje_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def mje_td
  @mje_td
end

#mjs_td ⇒ Object

Returns the value of attribute mjs_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def mjs_td
  @mjs_td
end

#mne_td ⇒ Object

Returns the value of attribute mne_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def mne_td
  @mne_td
end

#mnm_td ⇒ Object

Returns the value of attribute mnm_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def mnm_td
  @mnm_td
end

#mns_td ⇒ Object

Returns the value of attribute mns_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def mns_td
  @mns_td
end

#pal_td ⇒ Object

Returns the value of attribute pal_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def pal_td
  @pal_td
end

#ran_td ⇒ Object

Returns the value of attribute ran_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def ran_td
  @ran_td
end

#ranged ⇒ Object

Returns the value of attribute ranged.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def ranged
  @ranged
end

#sor_td ⇒ Object

Returns the value of attribute sor_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def sor_td
  @sor_td
end

#special_defenses ⇒ Object

Returns the value of attribute special_defenses.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def special_defenses
  @special_defenses
end

#udf ⇒ Object

Returns the value of attribute udf.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def udf
  @udf
end

#wiz_td ⇒ Object

Returns the value of attribute wiz_td.



1009
1010
1011
# File 'documented/gemstone/creature.rb', line 1009

def wiz_td
  @wiz_td
end