Class: PfrpgReaders::Filters::WeaponFinesseMod

Inherits:
Object
  • Object
show all
Defined in:
lib/pfrpg_readers/filters/weapon_finesse_mod.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#characterObject (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