Example #1
0
        public static void SetUnitSupport(this City city, CosmicRules constants)
        {
            var isFun       = city.Owner.Government == GovernmentType.Fundamentalism;
            var freeSupport = city.FreeSupport(city.Owner.Government, constants);

            city.SupportedUnits.ForEach(unit =>
            {
                unit.NeedsSupport = !unit.FreeSupport(isFun) && freeSupport > 0;
                freeSupport--;
            });
        }
Example #2
0
 private static int FreeSupport(this City city, GovernmentType government, CosmicRules constants)
 {
     return(government switch
     {
         GovernmentType.Anarchy => city.Size                                  // Only units above city size cost 1 shield
         ,
         GovernmentType.Despotism => city.Size                                // Only units above city size cost 1 shield
         ,
         GovernmentType.Communism => constants.CommunismPaysSupport           // First 3 units have no shield cost
         ,
         GovernmentType.Monarchy => constants.MonarchyPaysSupport             // First 3 units have no shield cost
         ,
         GovernmentType.Fundamentalism => constants.FundamentalismPaysSupport // First 10 units have no shield cost
         ,
         GovernmentType.Republic => 0                                         // Each unit costs 1 shield per turn
         ,
         GovernmentType.Democracy => 0                                        // Each unit costs 1 shield per turn
         ,
         _ => 0
     });