/**
  * Returns the to-hit modifier of the weapon at the given range using the specified ammunition.
  * Some ammunition may affect the to-hit modifiers for a specific weapon, in general ATMs, MMLs,
  * and LB-X ACs. This is only weapon-specific, it does not account for target or firer movement,
  * or other modifiers. If the weapon cannot hit at the given range, we return 12.
  *
  * @param w The weapon in question.
  * @param a The ammunition that the weapon will be using.
  * @param range The range that the weapon will be hitting a target at.
  * @return The to-hit modifier for the weapon at the given range.
  */
 public static int GetToHitAtRange(Ammunition a, int range) {
   if (range > a.GetLongRange()) {
     return 12;
   } else if (range > a.GetMediumRange()) {
     return 4 + a.GetToHitLong();
   } else if (range > a.GetShortRange()) {
     return 2 + a.GetToHitMedium();
   } else {
     if (range <= a.GetMinRange() && a.GetMinRange() > 0) {
       int min = a.GetMinRange() - range + 1;
       return 0 + min + a.GetToHitShort();
     } else {
       return 0 + a.GetToHitShort();
     }
   }
 }