Attack bonus

__TOC__
A character's attack bonus (AB) represents how capable he is in combat. It is derived from the character's base attack bonus and any additional modifiers. AB is mainly used for attack rolls.
==Formula==
The basic formula is:
BAB+Ability modifier+Size modifier†+maximum of the attack bonus and enhancement bonus on weapon +situational modifiers‡ +bonuses from feats and spells.
For a melee attack: Your ability modifier would be your Strength modifier unless you have Weapon Finesse and your Dexterity modifier is greater than your Strength modifier, in which case you would use your Dexterity modifier instead.
For a ranged attack: Your ability modifier would be your Dexterity modifier unless you have Zen Archery and your Wisdom modifier is greater than your Dexterity modifier, in which case you would use your Wisdom modifier instead.
†=For player characters the Small stature feat notes the size modifier for small PCs and grants a +1 to hit. However creatures have their size set by their appearance and that reflects the bonus or penalty they recieve.
‡=The situational modifiers include a +2 bonus for flanking an opponent and a +4 bonus for attacking a prone opponent.
==+20 AB cap==
There is an engine enforced cap of +20 to bonuses from feats and spells. However there are some bonuses that do not count towards this cap.
Things that do count towards the cap:
*Attack bonuses on weapons
*Enhancement bonuses on weapons (including enhancement bonuses from spells like Holy Sword and (Greater) Magic Weapon)
*True Strike
*(Greater/Mass) Reduce Person/Reduce Animal
*(Mass) Snake’s Swiftness
*Haste (and all those spell like abilties that grant Haste)
*(Greater) Heroism
*Tenser's Transformation
*War Cry
*Inspire Courage
*Divine Favor
*Bless
*(Mass) Aid
*Prayer
*Recitation
*Battletide
*(Greater) Magic Fang
*Awaken
*Nature's Avatar
*Divine wrath
*Battle Master
Things that do not count towards the cap:
*Ability modifier bonus to AB
*Weapon Focus
*Greater Weapon Focus
*Epic Weapon Focus
*Superior Weapon Focus
*Epic Prowess
*Bane of Enemies
*Small stature/Size modifier to AB
*Good Aim
*Eldritch Master
*Charisma modifier added during smites (Smite Good, Smite Evil, Smite Infidel)
*Stormlord Enhanced Weapon bonus
*Arcane Archer Enhance Arrows bonus
*Circumstantial Bonuses
Abilities like Divine Power and Legionnaire's march increase BAB instead of AB and do not count towards the cap. Community feats (such as from Kaedrin's PrC Pack) are considered magic bonuses and count towards the cap.