コード例 #1
0
ファイル: AiPlayer.cs プロジェクト: simonides/space_concept
 float getHangarUpgradePoints(PlanetData planet)
 {
     //
     Debug.Assert(planet.Owner != null);
     if (planet.Ships < planet.GetHangarUpgradeCosts() || planet.HangarLevel >= planet.MaxHangarLevel) {
         return NO_POINTS;
     }
     float fillGrade = (float)planet.Ships / (float)planet.HangarSize; // [0..1]
     if (fillGrade < 0.6f) {
         return NO_POINTS;
     }
     float points = fillGrade * fillGrade * 100; // exp. [0 .. 100]
     points += Math.Min((planet.GetNextHangarUpgrade() - planet.HangarSize) * 0.1f, 50);   // hangar improvement / 2
     if (fillGrade >= 0.95) { points += 10; }
     points *= 0.6f;
     return (points - 30f) * 0.5f;
 }