Hi, I found a bug in the expedition system calculation.
When the random offset is negative and the current system is low (e.g., 43 - 50 = -7), the code does:
if(randomSystem >= 500) randomSystem = randomSystem - 499;
if(randomSystem <= -1) randomSystem = 499 - randomSystem;
For -7, the second condition gives 499 - (-7) = 506, but the first condition is never checked again, so the final system becomes 506 (invalid).
The same issue can happen if the first correction produces a value still > 499, but that's rarer.
Thanks for looking into this!