Damage = (4 * Gold * fire rate * damage factor) / (0.06 * Range)
Every weapon uses this formula, with a little rounding here and there. Of course, the higher the range of a weapon, the smaller is the Damage per Second. But the calculated values are not that linear. In fact, this formual has been designed in a way, which benefits long range and low range weapons. Not considering the range, 1000 range weapons are the least effective ones in the game, but easy to use. Weapons become more efficent, the more their range differs from the 1000 range.
Restrictions on targets influence the damage factor as follows:
- Only Creep: 75% Bonus
- Only Hero: No Bonus
- Only Ground: 25% Bonus
- Only Air: 25% Bonus
- Only Buildings 75% Bonus
- No Buildings: 5% Bonus