Rapid Fire

Rapid Fire is the ability of a ship to shoot multiple units in one round.

During combat, if rapid fire didn't exist, each unit only had the ability to shoot one enemy unit in each round (at random). However, if the shooting unit has rapid fire against the target unit, there is a probability of it to shoot again at another target at random. This cycle of "extra" shots is cumulative, which means that a unit can effectively shoot 1000 times in just one round.

If r is the value of the rapid fire of shooting ship to the target ships, on average, the shooting ship will fire r times.

Consider the following example:

Cruisers have Rapid Fire 10 against rocket launchers. Let's consider the battle of 1 cruiser against 2 rocket launchers and 1 light laser. Each defensive building will shoot once against the cruiser, as it is the only attacker. When it's the cruiser's turn, it chooses a target randomly from the three available targets. Let's suppose it chooses one of the rocket launchers. The cruiser shoots as normal but then, since it has rapid fire, it gets a dice roll to decide if it has another chance to shoot. Let's suppose the roll is successful, and it gets an extra shot (it is important to note that destroyed ships and defensive facilities are not removed from combat until the end of the round in which they are destroyed, meaning that a ship [the Cruiser in this case] can target a defensive facility which has already been destroyed, effectively wasting the shot). Then it randomly chooses another target. Let's suppose this time it chooses the light laser. It'll shoot, but since cruisers do not have rapid fire against light lasers, doesn't get a rapid fire roll, and the round ends here. Had it chosen the rocket launcher it would have been granted the chance to roll dice again for an extra shot.

It is important to note that during combat, the ship has a probability (the current hull/total initial hull) of exploding after each shot it receives. This is one of the best advantages of rapid fire; if a ship has a probability of x to explode after the first shot received, besides receiving more damage, the dice to tell whether it explodes or not is rolled again with probability x' > x. The joint probability of exploding after two shots is x + (1 - x)*x' ( probability of exploding on the first shot x, plus the probability of not exploding in the first shot (1-x) times exploding on the 2nd shot x').

As an example, if the ship is x = 35% after the first shot, and receives damage on the second shot, say x' = 40%, the probability of exploding during the round is now 35% + 65%*40% = 61% >> 35%.

Statistics
Every time a unit with rapid fire (with value r) shoots against a target unit, the probability to shoot again is given by $$P_r = \frac{r-1}{r}$$.

Because shots are independent events, the (joint) probability to shoot n times is given by $$P_r(n) = \Big(\frac{r-1}{r}\Big)^n$$.

One can calculate the average number of shots by taking the average of times with distribution P_r(n). It follows that

$$\left\langle n \right\rangle = (r - 1)$$

i.e. on average, the ship will fire (r - 1) times due to rapid fire. With the initial shot, on average it will fire r times.

Another important aspect of this average is how often it occurs. The standard deviation is given by $$\sigma_r = \sqrt{(r - 1)r}\simeq r$$

i.e. the higher the r, the higher the deviation of the number of shots from the mean value.

In other words, the % chance of ship A firing again can be worked out by finding out what RF it has against ship B (example: 5), dividing 100 by it (100/5=20), and then taking the result away from 100 (100-20=80% chance). The number of RF that ship A has against ship B is the average of how many ship B's ship A destroys per round.

Here are the rapid fire ratings of all ships and defenses and the chance that if it destroys a certain Ship that it has of firing again.