Class: PfrpgReaders::Filters::WeaponFinesseMod
- Inherits:
-
Object
- Object
- PfrpgReaders::Filters::WeaponFinesseMod
- Defined in:
- lib/pfrpg_readers/filters/weapon_finesse_mod.rb
Instance Attribute Summary collapse
-
#character ⇒ Object
readonly
Returns the value of attribute character.
Instance Method Summary collapse
- #filter(attack) ⇒ Object
-
#initialize(character) ⇒ WeaponFinesseMod
constructor
A new instance of WeaponFinesseMod.
- #modify_attack_for_weapon_finesse(attack, dex, str) ⇒ Object
Constructor Details
#initialize(character) ⇒ WeaponFinesseMod
Returns a new instance of WeaponFinesseMod.
5 6 7 |
# File 'lib/pfrpg_readers/filters/weapon_finesse_mod.rb', line 5 def initialize(character) @character = character end |
Instance Attribute Details
#character ⇒ Object (readonly)
Returns the value of attribute character.
4 5 6 |
# File 'lib/pfrpg_readers/filters/weapon_finesse_mod.rb', line 4 def character @character end |
Instance Method Details
#filter(attack) ⇒ Object
9 10 11 12 13 |
# File 'lib/pfrpg_readers/filters/weapon_finesse_mod.rb', line 9 def filter(attack) if character.feats.find { |x| x.name == 'Weapon Finesse' } modify_attack_for_weapon_finesse(attack, character.dex_mod, character.str_mod) end end |
#modify_attack_for_weapon_finesse(attack, dex, str) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/pfrpg_readers/filters/weapon_finesse_mod.rb', line 15 def modify_attack_for_weapon_finesse(attack, dex, str) if attack.weight_class == 'light' || attack.weight_class == 'natural' attack.filter_str << "Weapon Finesse: -#{dex}, +#{str}" attack.other_bonus += dex attack.other_bonus -= str end end |