Talk:Augmenter Tweaking
if the aug says +40% then posaug1 is .4
if the aug says -40% then negaug1 is -.4
from HAL's:
Ok I'll explain it the best I can.
Let us say we have our stats start out at 0. Now if you have a +100% (x2) bonus, you will get +1. If you have a +200% (x3) bonus it is +2.
The direct opposite of a +100% bonus would be a -50%, which is -1. Therefore it stands to reason that the direct opposite of a +200% bonus would be -2, which works out to -66% when you invert it back (which if you multiply out by x3 evens out exactly).
Here is the code we get when initially applying the bonuses to find a number relative to zero. The bonus is a number relative to 1, so for example -50% would be 0.5, +30% would be 1.3, etc.
if (bonus > 1.0) factor += bonus - 1.0; else factor += (-1 / bonus) + 1;
Here is the formula for reverting back to a number relative to 1 so that it can be easily multiplied out by the rest of your ship stats.
if (factor < 0.0) factor = (-1 / (factor - 1)); else factor += 1.0;