Aurora 4x

New Players => The Academy => Topic started by: NuclearStudent on August 16, 2016, 01:27:54 PM

Title: What's the formula for repair speed of hangared ships?
Post by: NuclearStudent on August 16, 2016, 01:27:54 PM
So, I noticed that ships put in hangars get their armor repaired by the mothership, but not at a consistent rate.  Ships that are docked at the same time aren't repaired at the same time.  If it's a set number of armor hexes repaired per tick, I haven't a clue how large the ticks are or what the rates are. 

In general, I've been unable to find formulas for how damage control repair speed is calculated, and I would be interested to know if someone else has already done the testing before I do further experiments. 
Title: Re: What's the formula for repair speed of hangared ships?
Post by: DIT_grue on August 17, 2016, 12:16:29 AM
It's not consistent because there's a random factor involved. Trying to dig up the details for this sort of thing can be hit or miss, but this one was easy because I did it earlier in the week for another thread.  ;)

The psuedo code is as follows:

Repair Chance = Round Down ((Increment Length in Seconds / Item Cost) x Highest Damage Control Rating*)

If Repair Chance > 1000 Then
    Repair Done = True
Else
    If Random Number(1000) <= Repair Chance Then
        Repair Done = True
    End
End

* This is usually the damage control rating of the ship. However, if the ship is in a hangar and the mothership has a higher damage control rating, then the damage control rating of the mothership is used. This could be used by fighters on a carrier or it could be a huge repair ship that takes full size ships into its internal hangar. In this case, the maintenance supplies of the mothership are used.