Beispiel #1
0
        public virtual double CalculateQualityModifier(ProductionPointsCalculateArgs args)
        {
            double qualityDivider = 1.0;

            switch (args.Quality)
            {
            case 2:
                qualityDivider = 1.5;
                break;

            case 3:
                qualityDivider = 2.25;
                break;

            case 4:
                qualityDivider = 3.375;
                break;

            case 5:
                qualityDivider = 5.0;
                break;
            }

            return(1.0 / qualityDivider);
        }
Beispiel #2
0
        public override double CalculateDistanceModifier(ProductionPointsCalculateArgs args)
        {
            if (args.Distance == 0)
            {
                return(1f);
            }

            return(.4f + .6f / Math.Sqrt(args.Distance / 500f + 1f));
        }
Beispiel #3
0
        public virtual double CalculateDistanceModifier(ProductionPointsCalculateArgs args)
        {
            if (args.Distance == 0)
            {
                return(1f);
            }

            return(.6f + .4f / Math.Sqrt(args.Distance / 1000f + 1f));
        }
        public override double CalculatePeopleModifier(ProductionPointsCalculateArgs args)
        {
            if (args.PeopleCount <= 10)
            {
                return(0.75 + args.PeopleCount * 0.25 / 10.0);
            }

            return(Math.Max(1.0 - (args.PeopleCount - 10) * 0.1, 0.1));
        }
Beispiel #5
0
        public double CalculateHealthModifier(ProductionPointsCalculateArgs args)
        {
            double x = args.HitPoints;

            x = (x - 50.0) / 20.0;
            double exp = Math.Exp(x);

            return(Math.Min(1.0,
                            exp / (exp + 1) + 0.08));
        }
        public override double Calculate(ProductionPointsCalculateArgs args)
        {
            WorkTypeEnum workType            = args.ProducedProduct.GetWorkType();
            double       skill               = args.Skill;
            double       distanceModifier    = CalculateDistanceModifier(args);
            double       developmentModifier = CalculateDevelopmentModifier(args);
            double       peopleModifier      = CalculatePeopleModifier(args);
            double       hpModifier          = CalculateHealthModifier(args);

            return(Math.Pow(Math.Pow((skill + 1) * distanceModifier, 0.89) * developmentModifier * peopleModifier, 0.125) * hpModifier / 50.0);
        }
Beispiel #7
0
        public virtual double CalculateRawMultiplier(ProductionPointsCalculateArgs args)
        {
            double rawMultiplier = 1.0;

            if (args.WorkType == WorkTypeEnum.Raw)
            {
                ResourceTypeEnum resourceType = args.ResourceType.Value;

                rawMultiplier = GetRawMultiplierForResourceQuality(args.ResourceQuality);
            }

            return(rawMultiplier);
        }
Beispiel #8
0
        public virtual double CalculateProductModifier(ProductionPointsCalculateArgs args)
        {
            double productModifier = 1.0;

            switch (args.ProducedProduct)
            {
            case ProductTypeEnum.Paper:
                productModifier = 3.5;
                break;

            case ProductTypeEnum.SellingPower:
                productModifier = 7; break;

            case ProductTypeEnum.Fuel:
                productModifier = 1.5;
                break;
            }

            return(productModifier);
        }
Beispiel #9
0
        public virtual double Calculate(ProductionPointsCalculateArgs args)
        {
            WorkTypeEnum workType            = args.ProducedProduct.GetWorkType();
            double       skill               = args.Skill;
            var          hpModifier          = CalculateHealthModifier(args);
            double       distanceModifier    = CalculateDistanceModifier(args);
            double       qualityModifier     = CalculateQualityModifier(args);
            double       productModifier     = CalculateProductModifier(args);
            double       developmentModifier = CalculateDevelopmentModifier(args);
            double       peopleModifier      = CalculatePeopleModifier(args);
            double       rawMultiplier       = 1.0;

            if (args.ProducedProduct.IsRaw())
            {
                rawMultiplier = CalculateRawMultiplier(args);
            }


            return((Math.Pow((skill * productModifier + 1) * qualityModifier * distanceModifier, 0.9 - (double)(args.Quality / 100.0))
                    * rawMultiplier * developmentModifier) * peopleModifier * hpModifier * 1.5);
        }
Beispiel #10
0
        public virtual double CalculatePeopleModifier(ProductionPointsCalculateArgs args)
        {
            int    firstStage   = 4;
            int    secondStage  = 20;
            double inc2Modifier = 0.005;
            double dec          = 0.05;
            double max          = 0.5;

            switch (args.CompanyType)
            {
            case CompanyTypeEnum.Producer:
                secondStage = 40;
                break;

            case CompanyTypeEnum.Shop:
                secondStage  = 50;
                inc2Modifier = 0.025;
                break;

            case CompanyTypeEnum.Construction:
                inc2Modifier = 0.015;
                dec          = 0.01;
                break;
            }

            if (args.PeopleCount <= firstStage)
            {
                return(0.75 + 0.25 / firstStage * args.PeopleCount);
            }
            else if (args.PeopleCount > firstStage && args.PeopleCount <= secondStage)
            {
                return(1 + inc2Modifier * (args.PeopleCount - firstStage));
            }
            else
            {
                return(Math.Max(1 + inc2Modifier * (secondStage - firstStage) - dec * (args.PeopleCount - secondStage), max));
            }
        }
Beispiel #11
0
 public virtual double CalculateDevelopmentModifier(ProductionPointsCalculateArgs args)
 {
     return(Math.Log(Math.Pow(args.Development * Math.Sin((args.Development + 1.6) / 5 * Math.PI / 2), 2) + 1, 10) + 0.8);
 }
 public override double CalculateDevelopmentModifier(ProductionPointsCalculateArgs args)
 {
     return(Math.Pow(6 - args.Development, 3));
 }