示例#1
0
 float getFactoryUpgradePoints(PlanetData planet)
 {
     // = ~[-10..90]
     Debug.Assert(planet.Owner != null);
     if(planet.Ships < planet.GetFactoryUpgradeCosts() || planet.FactoryLevel >= planet.MaxFactoryLevel) {
         return NO_POINTS;
     }
     float fillGrade = (float)planet.Ships / (float)planet.HangarSize; // [0..1]
     if(fillGrade < 0.7f) {
         return NO_POINTS;
     }
     float points = fillGrade * fillGrade * 100; // exp. [0 .. 100]
     points += Math.Min((planet.GetNextFactoryUpgrade() - planet.FactorySpeed) * 0.5f, 150);   // factory speedup / 2
     points *= 0.6f;
     // points [0..50] + improvement/4 =   ~[0..200]
     return (points-20f) * 0.5f;
 }