Firing in to Melee explained in detail:
There are two primary factors that come into play when you are shooting at someone who is in melee with an ally of yours: The modifier to your attack roll (for firing into melee) and the modifier to your target's AC (if an ally is providing cover for the target). These two modifiers are separate, as it is possible for an ally of yours to be providing cover to your target even if they aren't in melee with them, and it's possible for an ally to be in melee with your target without providing any cover for them.
The -4 penalty to your attck roll is because you have to aim more carefully to avoid hitting your ally.
· If your target is at least 10 feet away from you ally (such as when you are fighting a creature with Reach), then you avoid the -4 attack penalty. (See Players Handbook, page 124)
· If you have the Precise Shot feat, then you negate the penalty altogether. (See Players Handbook, page 84)
The Cover modifier to your targets AC only comes into play if one of your allies is between you and your target (or the part of your target you are aiming at if they take up more than one square). If you draw a line from the center of your square to the center of your target's square, and it passes through the square an ally is in, then they are providing Cover to the target. The amount of cover depends on the relative sizes of your ally and the target (See page 133 of the Players Handbook, Table 8-9: Cover):
· If your ally is two size categories (or more) smaller than the target: No cover, +0 to target's AC.
· If your ally is one size category smaller than the target: 1/4 cover, +2 to target's AC.
· If your ally and the target are in the same size category: 1/2 cover, +4 to target's AC.
· If your ally is one size category larger than the target: 3/4 cover, +7 to target's AC.
· If your ally is two size categories larger than the target: 9/10 cover, +10 to target's AC.
· If your ally is three size categories larger than the target: Total Cover, you can't even see the target.
· If the target has a Tower Shield, the shield spell, or is hiding behind a wall, then they may already have an AC bonus from cover. Only use the highest AC modifier from cover, do not add them together.
· If you have the Sharp-shooting feat from the Sword and Fist (page 9), then you get a +2 bonus on attack rolls when your target has an AC bonus from cover.
If your ally is providing cover to your target, it is possible to miss the target and hit your ally instead. It is also possible for a nimble ally to dodge out of the way at the last moment and not actually provide any cover to the target at all. (See Players Handbook, page 133.) To see if this happens, follow these steps:
1. Make your attack roll as normal, and check it against the targets' AC (including the cover bonus).
· If you exceed their total AC, then you hit them despite the cover.
2. If you miss them because of the cover bonus to AC your ally provided, then compare your attack roll with the your ally's flat-footed AC (even if they have Uncanny Dodge).
Their flat-footed AC is their normal AC, minus any AC bonus from Dexterity or from Dodge bonuses. Always use the original attack roll; do not roll the attack again.
· If your attack roll is below your ally's flat-footed AC, then your shot hit them but did not penetrate their armor. No damage is dealt.
· If your attack roll is above your ally's flat-footed AC, then you either hit your ally or they dodge the attack at the last moment. Now compare the attack roll to your ally's full AC.
· If you miss your ally because of the additional AC from their Dexterity or Dodge bonuses, then they sidestepped the shot, and it continues on to hit the original target.
· If you hit your ally even with the additional AC from their Dexterity or Dodge bonuses, then they were not able to get out of the way, and the attack penetrated their armor. They take the damage.