Class: PfrpgReaders::CombatReader
- Inherits:
-
Object
- Object
- PfrpgReaders::CombatReader
- Includes:
- Attackable, Defensible
- Defined in:
- lib/pfrpg_readers/combat_reader.rb
Instance Attribute Summary collapse
-
#armor_ac ⇒ Object
readonly
Returns the value of attribute armor_ac.
-
#armor_check_penalty ⇒ Object
readonly
Returns the value of attribute armor_check_penalty.
-
#armor_modifier ⇒ Object
readonly
Returns the value of attribute armor_modifier.
-
#bab ⇒ Object
readonly
Returns the value of attribute bab.
-
#character ⇒ Object
readonly
Returns the value of attribute character.
-
#damage_reduction ⇒ Object
readonly
Returns the value of attribute damage_reduction.
-
#deflection_modifier ⇒ Object
readonly
Returns the value of attribute deflection_modifier.
-
#dex_bonus ⇒ Object
readonly
Returns the value of attribute dex_bonus.
-
#dodge_modifier ⇒ Object
readonly
Returns the value of attribute dodge_modifier.
-
#max_dex_bonus ⇒ Object
readonly
Returns the value of attribute max_dex_bonus.
-
#natural_armor ⇒ Object
readonly
Returns the value of attribute natural_armor.
-
#shield_ac ⇒ Object
readonly
Returns the value of attribute shield_ac.
-
#size_modifier ⇒ Object
readonly
Returns the value of attribute size_modifier.
-
#spell_resistance ⇒ Object
readonly
Returns the value of attribute spell_resistance.
-
#str_bonus ⇒ Object
readonly
Returns the value of attribute str_bonus.
-
#weapon_finesse ⇒ Object
readonly
Returns the value of attribute weapon_finesse.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(character) ⇒ CombatReader
constructor
A new instance of CombatReader.
Methods included from Attackable
#attack_filters, #attacks, #combat_maneuver_bonus
Methods included from Defensible
#armor_class, #combat_maneuver_defense, #flat_footed_ac, #touch_ac
Constructor Details
#initialize(character) ⇒ CombatReader
Returns a new instance of CombatReader.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 11 def initialize(character) @character = character @str_bonus = NullObject.maybe(character.str_mod) @dex_bonus = NullObject.maybe(character.dex_mod) @bab = NullObject.maybe(character.get_highest_attack_bonus) @weapon_finesse = false @dodge_modifier = NullObject.maybe(character.get_dodge_modifier) @deflection_modifier = NullObject.maybe(character.get_deflection_modifier) @armor_ac = NullObject.maybe(character.get_armor_ac) @shield_ac = NullObject.maybe(character.get_shield_ac) @natural_armor = NullObject.maybe(character.get_natural_armor) @size_modifier = NullObject.maybe(character.get_size_modifier) @armor_check_penalty = NullObject.maybe(character.get_ac_penalty) @max_dex_bonus = NullObject.maybe(character.get_max_dex_bonus) @spell_resistance = NullObject.maybe(character.get_spell_resistance) @damage_reduction = NullObject.maybe(character.get_damage_reduction) @armor_modifier = NullObject.maybe(character.get_armor_modifier) end |
Instance Attribute Details
#armor_ac ⇒ Object (readonly)
Returns the value of attribute armor_ac.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def armor_ac @armor_ac end |
#armor_check_penalty ⇒ Object (readonly)
Returns the value of attribute armor_check_penalty.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def armor_check_penalty @armor_check_penalty end |
#armor_modifier ⇒ Object (readonly)
Returns the value of attribute armor_modifier.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def armor_modifier @armor_modifier end |
#bab ⇒ Object (readonly)
Returns the value of attribute bab.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def bab @bab end |
#character ⇒ Object (readonly)
Returns the value of attribute character.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def character @character end |
#damage_reduction ⇒ Object (readonly)
Returns the value of attribute damage_reduction.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def damage_reduction @damage_reduction end |
#deflection_modifier ⇒ Object (readonly)
Returns the value of attribute deflection_modifier.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def deflection_modifier @deflection_modifier end |
#dex_bonus ⇒ Object (readonly)
Returns the value of attribute dex_bonus.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def dex_bonus @dex_bonus end |
#dodge_modifier ⇒ Object (readonly)
Returns the value of attribute dodge_modifier.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def dodge_modifier @dodge_modifier end |
#max_dex_bonus ⇒ Object (readonly)
Returns the value of attribute max_dex_bonus.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def max_dex_bonus @max_dex_bonus end |
#natural_armor ⇒ Object (readonly)
Returns the value of attribute natural_armor.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def natural_armor @natural_armor end |
#shield_ac ⇒ Object (readonly)
Returns the value of attribute shield_ac.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def shield_ac @shield_ac end |
#size_modifier ⇒ Object (readonly)
Returns the value of attribute size_modifier.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def size_modifier @size_modifier end |
#spell_resistance ⇒ Object (readonly)
Returns the value of attribute spell_resistance.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def spell_resistance @spell_resistance end |
#str_bonus ⇒ Object (readonly)
Returns the value of attribute str_bonus.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def str_bonus @str_bonus end |
#weapon_finesse ⇒ Object (readonly)
Returns the value of attribute weapon_finesse.
6 7 8 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 6 def weapon_finesse @weapon_finesse end |
Instance Method Details
#as_json(options = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/pfrpg_readers/combat_reader.rb', line 30 def as_json(={}) { :str_bonus => @str_bonus, :dex_bonus => @dex_bonus, :bab => @bab, :weapon_finesse => @weapon_finesse, :dodge_modifier => @dodge_modifier, :armor_modifier => @armor_modifier, :deflection_modifier => @deflection_modifier, :armor_ac => @armor_ac, :shield_ac => @shield_ac, :natural_armor => @natural_armor, :size_modifier => @size_modifier, :armor_class => armor_class, :flat_footed_ac => flat_footed_ac, :cmd => combat_maneuver_defense, :touch_ac => touch_ac, :spell_resistance => spell_resistance, :damage_reduction => damage_reduction, :attacks => attacks, :cmb => combat_maneuver_bonus } end |