Add Population Target and more deriveds
This commit is contained in:
@ -40,7 +40,7 @@ public class GameEngine
|
||||
public static int PlanetPopGrowthForPlayer(int currentPop, int value)
|
||||
{
|
||||
int maxPop = MaxPopOnPlanetForPlayer(value);
|
||||
double growth;
|
||||
int growth;
|
||||
|
||||
if (value < 0)
|
||||
{
|
||||
@ -49,16 +49,30 @@ public class GameEngine
|
||||
else
|
||||
{
|
||||
double popRatio = (double) currentPop / maxPop;
|
||||
if (popRatio <= 0.25)
|
||||
growth = currentPop * value / 100.0 * Game.Player.GrowthRatePercent / 100.0;
|
||||
else if (popRatio <= 1)
|
||||
growth = currentPop * value / 100.0 * Game.Player.GrowthRatePercent / 100.0 * 16.0 / 9.0 * Math.Pow(1.0 - popRatio, 2);
|
||||
else
|
||||
growth = currentPop * (popRatio - 1) * 0.04;
|
||||
if (popRatio <= 0.25)
|
||||
{
|
||||
growth = currentPop
|
||||
* Game.Player.GrowthRatePercent / 100
|
||||
* value / 100;
|
||||
}
|
||||
else if (popRatio < 1)
|
||||
{
|
||||
double factor = Math.Pow(1.0 - popRatio, 2);
|
||||
growth = currentPop
|
||||
* Game.Player.GrowthRatePercent / 100
|
||||
* value / 100
|
||||
* 16 / 9;
|
||||
growth = (int) ((double) growth * factor);
|
||||
}
|
||||
else
|
||||
{
|
||||
double factor = 0.04 * (popRatio - 1);
|
||||
growth = (int) ((double) currentPop * factor);
|
||||
}
|
||||
}
|
||||
|
||||
// round to nearest 100
|
||||
return ((int) growth) / 100 * 100;
|
||||
// round down by 100
|
||||
return growth / 100 * 100;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user