CleverRaven/Cataclysm-DDA — pull request #4511 by ssheafer (2013-11-20 02:17:53+00:00)
Title: Implementation of zoom_factor for gunmods [CR]

The rifle scope item was mechanically useless for a few reasons. It could only be attached to rifles, which usually have 0-1 dispersion. Gun dispersion is capped at 0, therefore very little effect from the -8 dispersion was applied. I wanted to remedy that, so I've created a zoom magnification system for shooting. The only item changed so far with zoom_factor is the rifle scope.

How it works - You give a gunmod the attribute zoom_factor. It's a float, nominally above 1. When the mod is attached to a gun, the actual range of a long shot is divided by the zoom factor to find the reduced range that is used for dispersion calculations (5 + range / zoom_factor). This is very similar to what was previously done for rifles, where range above 10 counted for only 60% real range. The rational for this change is that scopes make it easier to aim at faraway targets.

Drawbacks - A gun with a scope suffers from two drawbacks. First, the recoil dispersion effects are multiplied by the zoom factor. The rational for this is that it is more difficult to keep the view on target during recoil. Second, below LONG_DISTANCE range (10), the gun is treated as being at range 10. The rational for this is that the scope partially or completely blocks the ironsights, and it is more difficult to aim at close range.

Testing done:
Character with 12 Dex & Per, 5 in all skills hit a coyote 25-30 range away with an SKS and 3x scope about 1 in 5 times.
Character with 12 Dex & Per, 10 in all skills was able to hit spiders 25-30 tiles away more often than missing.

Excel spreadsheet of range values:
![scope](https://f.cloud.github.com/assets/1406446/1578921/988c94fa-5188-11e3-89a5-aed233d43c2a.png)

Comments welcome!