Module: PfrpgCore::Derived::CombatBonuses

Included in:
Character
Defined in:
lib/pfrpg_core/derived/combat_bonuses.rb

Instance Method Summary collapse

Instance Method Details

#armor_speed_penaltyObject



57
58
59
60
61
62
63
64
65
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 57

def armor_speed_penalty
  begin
    return 0 if race.name == 'Dwarf'
    return (race.speed == 30) ? (30 - @inventory.equipped_armor.speed_thirty) :
        (20 - @inventory.equipped_armor.speed_twenty)
  rescue Exception
    return 0
  end
end

#get_ac_penaltyObject



67
68
69
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 67

def get_ac_penalty
  @inventory.ac_penalty(self.bonuses)
end

#get_armor_modifierObject



12
13
14
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 12

def get_armor_modifier
  get_bonus("armor").to_i
end

#get_attack_filtersObject



71
72
73
74
75
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 71

def get_attack_filters
  base = class_features.select { |x| x.attack_filter != nil }
  filter_classes = base.collect { |x| [x,x.attack_filter] }
  filter_classes.map { |x| x[1].new(self,x[0])}
end

#get_damage_reductionObject



24
25
26
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 24

def get_damage_reduction
  get_bonus('damage_reduction')
end

#get_deflection_modifierObject



8
9
10
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 8

def get_deflection_modifier
  get_bonus("deflection").to_i
end

#get_dodge_modifierObject



4
5
6
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 4

def get_dodge_modifier
  get_bonus("dodge").to_i
end

#get_highest_attack_bonusObject

the accurate BAB for a character is the sum of the highest granted bonuses from each class this method is NOT concerned with generating multi-attack bonuses



48
49
50
51
52
53
54
55
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 48

def get_highest_attack_bonus
  bab = 0
  latest_levels.each do |l|
    bab += l.base_attack_bonus[0]
  end
  bab
  return bab
end

#get_max_dex_bonusObject



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 32

def get_max_dex_bonus
  max_dex_bonus = 100
  any_max = false
  @inventory.equipment.each do |e|
    if (e.max_dex_bonus != nil) && (e.max_dex_bonus < max_dex_bonus)
      any_max = true
      max_dex_bonus = e.max_dex_bonus
    end
  end
  max_dex_bonus += get_bonus("max_dex_bonus").to_i
  max_dex_bonus
end

#get_natural_armorObject



20
21
22
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 20

def get_natural_armor
  get_bonus("natural_armor").to_i
end

#get_size_modifierObject



16
17
18
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 16

def get_size_modifier
  NullObject.maybe(@race).size_modifier
end

#get_spell_resistanceObject



28
29
30
# File 'lib/pfrpg_core/derived/combat_bonuses.rb', line 28

def get_spell_resistance
  get_bonus('spell_resistance')
end