Exemplo n.º 1
0
        //Used for biological survey
        internal static DMCollectScience fetchBioSurveyScience(CelestialBody body)
        {
            string biome = "";

            DMUtils.DebugLog("Checking Contract Requirements");

            //Make sure our experiment is OK
            if (ResearchAndDevelopment.GetExperiment("dmbiodrillscan") == null)
            {
                return(null);
            }

            //Build a list of acceptable biomes if applicable, choose one with remaining science
            DMUtils.DebugLog("Checking For Biome Usage");
            List <string> bList = DMUtils.fetchBiome(body);

            if (bList.Count == 0)
            {
                return(null);
            }
            int i = rand.Next(0, 2);

            if (i == 0)
            {
                biome = bList[rand.Next(0, bList.Count)];
                DMUtils.DebugLog("Acceptable Biome Found: {0}", biome);
            }

            return(new DMCollectScience(body, ExperimentSituations.SrfLanded, biome, "Bio Drill Scan", 1));
        }
Exemplo n.º 2
0
        //Used for orbital survey
        internal static DMCollectScience fetchSurveyScience(CelestialBody Body, DMScienceContainer DMScience)
        {
            ExperimentSituations targetSituation;
            ScienceSubject       sub;
            AvailablePart        aPart;
            string name;

            name = DMUtils.availableScience["All"].FirstOrDefault(n => n.Value == DMScience).Key;

            //Determine if the science part is available if applicable
            if (DMScience.sciPart != "None")
            {
                DMUtils.DebugLog("Checking For Part {0} Now", DMScience.sciPart);
                aPart = PartLoader.getPartInfoByName(DMScience.sciPart);
                if (aPart == null)
                {
                    return(null);
                }
                if (!ResearchAndDevelopment.PartModelPurchased(aPart))
                {
                    return(null);
                }
                DMUtils.DebugLog("Part: [{0}] Purchased; Contract Meets Requirements", aPart.name);
            }

            //Make sure our experiment is OK
            if (DMScience.exp == null)
            {
                return(null);
            }

            if (!Body.atmosphere && DMScience.exp.requireAtmosphere)
            {
                return(null);
            }
            if (((ExperimentSituations)DMScience.sitMask & ExperimentSituations.InSpaceHigh) == ExperimentSituations.InSpaceHigh)
            {
                if (rand.Next(0, 2) == 0)
                {
                    targetSituation = ExperimentSituations.InSpaceHigh;
                }
                else
                {
                    targetSituation = ExperimentSituations.InSpaceLow;
                }
            }
            else
            {
                targetSituation = ExperimentSituations.InSpaceLow;
            }

            if (DMUtils.biomeRelevant(targetSituation, DMScience.bioMask))
            {
                DMUtils.DebugLog("Checking For Biome Usage");
                List <string> bList = DMUtils.fetchBiome(Body, DMScience.exp, targetSituation);
                if (bList.Count == 0)
                {
                    DMUtils.DebugLog("Planet All Tapped Out; No Remaining Science Here");
                    return(null);
                }
            }

            if ((sub = ResearchAndDevelopment.GetSubjectByID(string.Format("{0}@{1}{2}", DMScience.exp.id, Body.name, targetSituation))) != null)
            {
                if (sub.scientificValue < 0.5f)
                {
                    return(null);
                }
            }

            return(new DMCollectScience(Body, targetSituation, "", name, 0));
        }
Exemplo n.º 3
0
        //Used for initial orbital and surface survey parameter
        internal static DMCollectScience fetchSurveyScience(Contract.ContractPrestige c, List <CelestialBody> cR, List <CelestialBody> cUR, DMScienceContainer DMScience, int sT)
        {
            CelestialBody        body;
            ExperimentSituations targetSituation;
            ScienceSubject       sub;
            AvailablePart        aPart;
            string name;
            string biome      = "";
            int    surveyType = sT;

            name = DMUtils.availableScience["All"].FirstOrDefault(n => n.Value == DMScience).Key;

            //Determine if the science part is available if applicable
            if (DMScience.sciPart != "None")
            {
                DMUtils.DebugLog("Checking For Part {0} Now", DMScience.sciPart);
                aPart = PartLoader.getPartInfoByName(DMScience.sciPart);
                if (aPart == null)
                {
                    return(null);
                }
                if (!ResearchAndDevelopment.PartModelPurchased(aPart))
                {
                    return(null);
                }
                DMUtils.DebugLog("Part: [{0}] Purchased; Contract Meets Requirements", aPart.name);
            }

            body = DMUtils.nextTargetBody(c, cR, cUR);
            DMUtils.DebugLog("Body: {0} Selected", body.name);
            if (body == null)
            {
                return(null);
            }

            //Make sure our experiment is OK
            if (DMScience.exp == null)
            {
                return(null);
            }

            if (surveyType == 0)
            {
                if (!body.atmosphere && DMScience.exp.requireAtmosphere)
                {
                    return(null);
                }
                if (((ExperimentSituations)DMScience.sitMask & ExperimentSituations.InSpaceHigh) == ExperimentSituations.InSpaceHigh)
                {
                    if (rand.Next(0, 2) == 0)
                    {
                        targetSituation = ExperimentSituations.InSpaceHigh;
                    }
                    else
                    {
                        targetSituation = ExperimentSituations.InSpaceLow;
                    }
                }
                else
                {
                    targetSituation = ExperimentSituations.InSpaceLow;
                }
            }
            else if (surveyType == 1)
            {
                if (body.pqsController == null)
                {
                    return(null);
                }
                if (!body.atmosphere && DMScience.exp.requireAtmosphere)
                {
                    return(null);
                }
                if (((ExperimentSituations)DMScience.sitMask & ExperimentSituations.SrfLanded) == ExperimentSituations.SrfLanded)
                {
                    if (DMScience.exp.id != "dmbiodrillscan")
                    {
                        targetSituation = ExperimentSituations.SrfLanded;
                    }
                    else if (body.atmosphere)
                    {
                        targetSituation = ExperimentSituations.SrfLanded;
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            else if (surveyType == 2)
            {
                if (!body.atmosphere)
                {
                    return(null);
                }
                if (rand.Next(0, 2) == 0)
                {
                    targetSituation = ExperimentSituations.FlyingHigh;
                }
                else
                {
                    targetSituation = ExperimentSituations.FlyingLow;
                }
            }
            else
            {
                return(null);
            }

            DMUtils.DebugLog("Experimental Situation: {0} Selected", targetSituation.ToString());

            if (DMUtils.biomeRelevant(targetSituation, DMScience.bioMask) && targetSituation != ExperimentSituations.SrfSplashed)
            {
                DMUtils.DebugLog("Checking For Biome Usage");
                List <string> bList = DMUtils.fetchBiome(body, DMScience.exp, targetSituation);
                if (bList.Count == 0)
                {
                    DMUtils.DebugLog("Planet All Tapped Out; No Remaining Science Here");
                    return(null);
                }
                else
                {
                    biome = bList[rand.Next(0, bList.Count)];
                    DMUtils.DebugLog("Acceptable Biome Found: {0}", biome);
                }
            }

            DMUtils.DebugLog("Checking For Remaining Science");
            //Make sure that our chosen science subject has science remaining to be gathered
            if ((sub = ResearchAndDevelopment.GetSubjectByID(string.Format("{0}@{1}{2}{3}", DMScience.exp.id, body.name, targetSituation, biome.Replace(" ", "")))) != null)
            {
                if (sub.scientificValue < 0.5f)
                {
                    return(null);
                }
            }

            if (surveyType == 0)
            {
                return(new DMCollectScience(body, targetSituation, "", name, 0));
            }
            else if (surveyType == 1)
            {
                return(new DMCollectScience(body, targetSituation, biome, name, 0));
            }
            else if (surveyType == 2)
            {
                return(new DMCollectScience(body, targetSituation, biome, name, 1));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 4
0
        //Used for orbital survey
        internal static DMCollectScience fetchSurveyScience(CelestialBody Body, DMScienceContainer DMScience)
        {
            ExperimentSituations targetSituation;
            ScienceSubject       sub;
            string name;

            if (!DMUtils.availableScience.ContainsKey("All"))
            {
                return(null);
            }

            name = DMUtils.availableScience["All"].FirstOrDefault(n => n.Value == DMScience).Key;

            //Determine if the science part is available if applicable
            if (DMScience.SciPart != "None")
            {
                if (!DMUtils.partAvailable(new List <string>(1)
                {
                    DMScience.SciPart
                }))
                {
                    return(null);
                }
            }

            //Make sure our experiment is OK
            if (DMScience.Exp == null)
            {
                return(null);
            }

            if (!Body.atmosphere && DMScience.Exp.requireAtmosphere)
            {
                return(null);
            }
            if (((ExperimentSituations)DMScience.Exp.situationMask & ExperimentSituations.InSpaceHigh) == ExperimentSituations.InSpaceHigh && ((ExperimentSituations)DMScience.Exp.situationMask & ExperimentSituations.InSpaceLow) == ExperimentSituations.InSpaceLow)
            {
                if (rand.Next(0, 2) == 0)
                {
                    targetSituation = ExperimentSituations.InSpaceHigh;
                }
                else
                {
                    targetSituation = ExperimentSituations.InSpaceLow;
                }
            }
            else if (((ExperimentSituations)DMScience.Exp.situationMask & ExperimentSituations.InSpaceHigh) == ExperimentSituations.InSpaceHigh)
            {
                targetSituation = ExperimentSituations.InSpaceHigh;
            }
            else
            {
                targetSituation = ExperimentSituations.InSpaceLow;
            }

            if (DMUtils.biomeRelevant(targetSituation, (int)DMScience.Exp.biomeMask))
            {
                List <string> bList = DMUtils.fetchBiome(Body, DMScience.Exp, targetSituation);
                if (bList.Count == 0)
                {
                    return(null);
                }
            }
            else
            {
                string subId = string.Format("{0}@{1}{2}", DMScience.Exp.id, Body.bodyName, targetSituation);

                if (ResearchAndDevelopment.GetSubjects().Any(s => s.id == subId))
                {
                    sub = ResearchAndDevelopment.GetSubjectByID(subId);
                    if (sub.scientificValue < 0.5f)
                    {
                        return(null);
                    }
                }
            }

            return(new DMCollectScience(Body, targetSituation, "", name, 0));
        }
Exemplo n.º 5
0
        //Used for initial orbital and surface survey parameter
        internal static DMCollectScience fetchSurveyScience(Contract.ContractPrestige c, List <CelestialBody> cR, List <CelestialBody> cUR, DMScienceContainer DMScience)
        {
            CelestialBody        body;
            ExperimentSituations targetSituation;
            ScienceSubject       sub;
            string name;
            string biome = "";

            if (!DMUtils.availableScience.ContainsKey("All"))
            {
                return(null);
            }

            name = DMUtils.availableScience["All"].FirstOrDefault(n => n.Value == DMScience).Key;

            //Determine if the science part is available if applicable
            if (DMScience.SciPart != "None")
            {
                if (!DMUtils.partAvailable(new List <string>(1)
                {
                    DMScience.SciPart
                }))
                {
                    return(null);
                }
            }

            List <CelestialBody>       bodies = new List <CelestialBody>();
            Func <CelestialBody, bool> cb     = null;

            switch (c)
            {
            case Contract.ContractPrestige.Trivial:
                cb = delegate(CelestialBody b)
                {
                    if (b == Planetarium.fetch.Sun)
                    {
                        return(false);
                    }

                    if (b.scienceValues.RecoveryValue > 4)
                    {
                        return(false);
                    }

                    return(true);
                };
                bodies.AddRange(ProgressUtilities.GetBodiesProgress(ProgressType.ORBIT, true, cb));
                break;

            case Contract.ContractPrestige.Significant:
                cb = delegate(CelestialBody b)
                {
                    if (b == Planetarium.fetch.Sun)
                    {
                        return(false);
                    }

                    if (b == Planetarium.fetch.Home)
                    {
                        return(false);
                    }

                    if (b.scienceValues.RecoveryValue > 8)
                    {
                        return(false);
                    }

                    return(true);
                };
                bodies.AddRange(ProgressUtilities.GetBodiesProgress(ProgressType.FLYBY, true, cb));
                bodies.AddRange(ProgressUtilities.GetNextUnreached(2, cb));
                break;

            case Contract.ContractPrestige.Exceptional:
                cb = delegate(CelestialBody b)
                {
                    if (b == Planetarium.fetch.Home)
                    {
                        return(false);
                    }

                    if (Planetarium.fetch.Home.orbitingBodies.Count > 0)
                    {
                        foreach (CelestialBody B in Planetarium.fetch.Home.orbitingBodies)
                        {
                            if (b == B)
                            {
                                return(false);
                            }
                        }
                    }

                    if (b.scienceValues.RecoveryValue < 4)
                    {
                        return(false);
                    }

                    return(true);
                };
                bodies.AddRange(ProgressUtilities.GetBodiesProgress(ProgressType.FLYBY, true, cb));
                bodies.AddRange(ProgressUtilities.GetNextUnreached(4, cb));
                break;
            }

            if (bodies.Count <= 0)
            {
                return(null);
            }

            body = bodies[rand.Next(0, bodies.Count)];

            if (body == null)
            {
                return(null);
            }

            //Make sure our experiment is OK
            if (DMScience.Exp == null)
            {
                return(null);
            }

            if (!body.atmosphere && DMScience.Exp.requireAtmosphere)
            {
                return(null);
            }
            if (((ExperimentSituations)DMScience.Exp.situationMask & ExperimentSituations.InSpaceHigh) == ExperimentSituations.InSpaceHigh && ((ExperimentSituations)DMScience.Exp.situationMask & ExperimentSituations.InSpaceLow) == ExperimentSituations.InSpaceLow)
            {
                if (rand.Next(0, 2) == 0)
                {
                    targetSituation = ExperimentSituations.InSpaceHigh;
                }
                else
                {
                    targetSituation = ExperimentSituations.InSpaceLow;
                }
            }
            else if (((ExperimentSituations)DMScience.Exp.situationMask & ExperimentSituations.InSpaceHigh) == ExperimentSituations.InSpaceHigh)
            {
                targetSituation = ExperimentSituations.InSpaceHigh;
            }
            else
            {
                targetSituation = ExperimentSituations.InSpaceLow;
            }

            if (DMUtils.biomeRelevant(targetSituation, (int)DMScience.Exp.biomeMask) && targetSituation != ExperimentSituations.SrfSplashed)
            {
                List <string> bList = DMUtils.fetchBiome(body, DMScience.Exp, targetSituation);
                if (bList.Count == 0)
                {
                    return(null);
                }
                else
                {
                    biome = bList[rand.Next(0, bList.Count)];
                }
            }

            //Make sure that our chosen science subject has science remaining to be gathered
            string subId = string.Format("{0}@{1}{2}{3}", DMScience.Exp.id, body.bodyName, targetSituation, biome.Replace(" ", ""));

            if (ResearchAndDevelopment.GetSubjects().Any(s => s.id == subId))
            {
                sub = ResearchAndDevelopment.GetSubjectByID(subId);
                if (sub.scientificValue < 0.5f)
                {
                    return(null);
                }
            }

            return(new DMCollectScience(body, targetSituation, "", name, 0));
        }
Exemplo n.º 6
0
        //Used for initial orbital and surface survey parameter
        internal static DMCollectScience fetchSurveyScience(Contract.ContractPrestige c, List <CelestialBody> cR, List <CelestialBody> cUR, DMScienceContainer DMScience)
        {
            CelestialBody        body;
            ExperimentSituations targetSituation;
            ScienceSubject       sub;
            AvailablePart        aPart;
            string name;
            string biome = "";

            name = DMUtils.availableScience["All"].FirstOrDefault(n => n.Value == DMScience).Key;

            //Determine if the science part is available if applicable
            if (DMScience.SciPart != "None")
            {
                aPart = PartLoader.getPartInfoByName(DMScience.SciPart);
                if (aPart == null)
                {
                    return(null);
                }
                if (!ResearchAndDevelopment.PartModelPurchased(aPart))
                {
                    return(null);
                }
            }

            body = DMUtils.nextTargetBody(c, cR, cUR);
            if (body == null)
            {
                return(null);
            }

            //Make sure our experiment is OK
            if (DMScience.Exp == null)
            {
                return(null);
            }

            if (!body.atmosphere && DMScience.Exp.requireAtmosphere)
            {
                return(null);
            }
            if (((ExperimentSituations)DMScience.SitMask & ExperimentSituations.InSpaceHigh) == ExperimentSituations.InSpaceHigh && ((ExperimentSituations)DMScience.SitMask & ExperimentSituations.InSpaceLow) == ExperimentSituations.InSpaceLow)
            {
                if (rand.Next(0, 2) == 0)
                {
                    targetSituation = ExperimentSituations.InSpaceHigh;
                }
                else
                {
                    targetSituation = ExperimentSituations.InSpaceLow;
                }
            }
            else if (((ExperimentSituations)DMScience.SitMask & ExperimentSituations.InSpaceHigh) == ExperimentSituations.InSpaceHigh)
            {
                targetSituation = ExperimentSituations.InSpaceHigh;
            }
            else
            {
                targetSituation = ExperimentSituations.InSpaceLow;
            }

            if (DMUtils.biomeRelevant(targetSituation, DMScience.BioMask) && targetSituation != ExperimentSituations.SrfSplashed)
            {
                List <string> bList = DMUtils.fetchBiome(body, DMScience.Exp, targetSituation);
                if (bList.Count == 0)
                {
                    return(null);
                }
                else
                {
                    biome = bList[rand.Next(0, bList.Count)];
                }
            }

            //Make sure that our chosen science subject has science remaining to be gathered
            string subId = string.Format("{0}@{1}{2}{3}", DMScience.Exp.id, body.name, targetSituation, biome.Replace(" ", ""));

            if (ResearchAndDevelopment.GetSubjects().Any(s => s.id == subId))
            {
                sub = ResearchAndDevelopment.GetSubjectByID(subId);
                if (sub.scientificValue < 0.5f)
                {
                    return(null);
                }
            }

            return(new DMCollectScience(body, targetSituation, "", name, 0));
        }
Exemplo n.º 7
0
        protected override bool Generate()
        {
            int total = ContractSystem.Instance.GetCurrentContracts <DMSurveyContract>().Count();

            if (total >= DMUtils.maxSurvey)
            {
                return(false);
            }

            surveyType = rand.Next(0, 3);
            if (surveyType == 0)
            {
                //Make sure that the magnetometer is at least available
                AvailablePart aPart = PartLoader.getPartInfoByName("dmmagBoom");
                if (aPart == null)
                {
                    return(false);
                }
                if (!ResearchAndDevelopment.PartModelPurchased(aPart))
                {
                    return(false);
                }

                sciList.AddRange(DMUtils.availableScience[DMScienceType.Space.ToString()].Values);

                if (sciList.Count > 0)
                {
                    DMScience = sciList[rand.Next(0, sciList.Count)];
                    sciList.Remove(DMScience);
                }
                else
                {
                    return(false);
                }

                //Generates the science experiment, returns null if experiment fails any check
                if ((newParams[0] = DMSurveyGenerator.fetchSurveyScience(this.Prestige, GetBodies_Reached(false, true), GetBodies_NextUnreached(4, null), DMScience, 0)) == null)
                {
                    return(false);
                }

                body = newParams[0].Body;
                //Add an orbital parameter
                this.AddParameter(new EnterOrbit(body), null);
            }
            else if (surveyType == 1)
            {
                //Make sure that the laser is at least available
                AvailablePart aPart = PartLoader.getPartInfoByName("dmsurfacelaser");
                if (aPart == null)
                {
                    return(false);
                }
                if (!ResearchAndDevelopment.PartModelPurchased(aPart))
                {
                    return(false);
                }

                sciList.AddRange(DMUtils.availableScience[DMScienceType.Surface.ToString()].Values);

                if (sciList.Count > 0)
                {
                    DMScience = sciList[rand.Next(0, sciList.Count)];
                    sciList.Remove(DMScience);
                }
                else
                {
                    return(false);
                }

                if ((newParams[0] = DMSurveyGenerator.fetchSurveyScience(this.Prestige, GetBodies_Reached(false, true), GetBodies_NextUnreached(4, null), DMScience, 1)) == null)
                {
                    return(false);
                }

                body  = newParams[0].Body;
                biome = newParams[0].Biome;

                if (biome == "")
                {
                    List <string> biomes = DMUtils.fetchBiome(body);
                    biome = biomes[rand.Next(0, biomes.Count)];
                }
                this.AddParameter(new LandOnBody(body), null);
            }
            else if (surveyType == 2)
            {
                if (this.Prestige == ContractPrestige.Trivial)
                {
                    return(false);
                }
                //Make sure that drill is at least available
                AvailablePart aPart = PartLoader.getPartInfoByName("dmbioDrill");
                if (aPart == null)
                {
                    return(false);
                }
                if (!ResearchAndDevelopment.PartModelPurchased(aPart))
                {
                    return(false);
                }

                //Duna and Eve are the easy targets
                if (this.Prestige == ContractPrestige.Significant)
                {
                    if (!ProgressTracking.Instance.NodeComplete(new string[] { "Kerbin", "Escape" }))
                    {
                        return(false);
                    }
                    if (rand.Next(0, 2) == 0)
                    {
                        body = FlightGlobals.Bodies[5];
                    }
                    else
                    {
                        body = FlightGlobals.Bodies[6];
                    }
                }
                else if (this.Prestige == ContractPrestige.Exceptional)
                {
                    //Account for mod planets and Laythe
                    if (!ProgressTracking.Instance.NodeComplete(new string[] { "Jool", "Flyby" }))
                    {
                        return(false);
                    }
                    List <CelestialBody> bList = new List <CelestialBody>();
                    foreach (CelestialBody b in FlightGlobals.Bodies)
                    {
                        if (b.flightGlobalsIndex != 1 && b.flightGlobalsIndex != 5 && b.flightGlobalsIndex != 6 && b.flightGlobalsIndex != 8)
                        {
                            if (b.atmosphere && b.pqsController != null)
                            {
                                bList.Add(b);
                            }
                        }
                    }
                    body = bList[rand.Next(0, bList.Count)];
                }
                else
                {
                    return(false);
                }

                sciList.AddRange(DMUtils.availableScience[DMScienceType.Biological.ToString()].Values);

                if ((newParams[0] = DMSurveyGenerator.fetchBioSurveyScience(body)) == null)
                {
                    return(false);
                }

                biome = newParams[0].Biome;

                if (biome == "")
                {
                    List <string> biomes = DMUtils.fetchBiome(body);
                    biome = biomes[rand.Next(0, biomes.Count)];
                }

                this.AddParameter(new LandOnBody(body), null);
                this.AddParameter(new EnterOrbit(body), null);
            }
            else
            {
                return(false);
            }

            for (j = 1; j < 7; j++)
            {
                if (sciList.Count > 0)
                {
                    DMScience = sciList[rand.Next(0, sciList.Count)];
                    if (surveyType == 0)
                    {
                        newParams[j] = DMSurveyGenerator.fetchSurveyScience(body, DMScience);
                    }
                    else if (surveyType == 1)
                    {
                        newParams[j] = DMSurveyGenerator.fetchSurveyScience(body, DMScience, biome);
                    }
                    else if (surveyType == 2)
                    {
                        newParams[j] = DMSurveyGenerator.fetchBioSurveyScience(body, DMScience, biome);
                    }
                    sciList.Remove(DMScience);
                }
                else
                {
                    newParams[j] = null;
                }
            }

            //Add in all acceptable paramaters to the contract
            foreach (DMCollectScience DMC in newParams)
            {
                if (i > (3 + (int)this.prestige))
                {
                    break;
                }
                if (DMC != null)
                {
                    this.AddParameter(DMC, "collectDMScience");
                    float locationMod = GameVariables.Instance.ScoreSituation(DMUtils.convertSit(DMC.Situation), DMC.Body) * ((float)rand.Next(85, 116) / 100f);
                    DMC.SetScience(DMC.Container.exp.baseValue * 0.7f * DMUtils.science * DMUtils.fixSubjectVal(DMC.Situation, 1f, body), null);
                    DMC.SetFunds(4000f * DMUtils.reward * locationMod, 1500f * DMUtils.penalty * locationMod, body);
                    DMC.SetReputation(15f * DMUtils.reward * locationMod, 10f * DMUtils.penalty * locationMod, body);
                    i++;
                    DMUtils.DebugLog("Survey Parameter Added");
                }
            }

            if (surveyType == 0 || surveyType == 1)
            {
                if (this.ParameterCount < 4)
                {
                    return(false);
                }
            }
            else if (surveyType == 2)
            {
                if (this.ParameterCount < 5)
                {
                    return(false);
                }
            }

            int a = rand.Next(0, 4);

            if (a == 0)
            {
                this.agent = AgentList.Instance.GetAgent("DMagic");
            }
            else if (a == 1)
            {
                this.agent = AgentList.Instance.GetAgent(newParams[0].Container.agent);
            }
            else
            {
                this.agent = AgentList.Instance.GetAgentRandom();
            }

            float primaryLocationMod = GameVariables.Instance.ScoreSituation(DMUtils.convertSit(newParams[0].Situation), newParams[0].Body) * ((float)rand.Next(85, 116) / 100f);

            base.SetExpiry(10f * DMUtils.deadline, 20f * DMUtils.deadline);
            base.SetDeadlineYears(1.9f * ((float)rand.Next(80, 121)) / 100f * DMUtils.deadline, body);
            base.SetReputation(newParams.Length * 8f * DMUtils.reward * primaryLocationMod, newParams.Length * 5f * DMUtils.penalty * primaryLocationMod, body);
            base.SetFunds(3000 * newParams.Length * DMUtils.forward * primaryLocationMod, 2500 * newParams.Length * DMUtils.reward * primaryLocationMod, 2000 * newParams.Length * DMUtils.penalty * primaryLocationMod, body);
            return(true);
        }