コード例 #1
0
ファイル: Amnesia.cs プロジェクト: FrodoOf9Fingers/Amnesia
        public override void Initialize()
        {
            base.Initialize();
            Backstory cbs = new Backstory();
            Backstory abs = new Backstory();

            cbs.identifier     = childBS;
            cbs.slot           = BackstorySlot.Childhood;
            cbs.baseDesc       = "Questions... ";
            cbs.bodyTypeGlobal = BodyType.Undefined;
            cbs.bodyTypeMale   = BodyType.Male;
            cbs.bodyTypeFemale = BodyType.Female;
            cbs.shuffleable    = false;
            cbs.SetTitleShort("Amnesiac");
            cbs.SetTitle("Child Amnesiac");

            abs.identifier     = adultBS;
            abs.slot           = BackstorySlot.Adulthood;
            abs.baseDesc       = "Nope, still nothing.";
            abs.bodyTypeGlobal = BodyType.Undefined;
            abs.bodyTypeMale   = BodyType.Male;
            abs.bodyTypeFemale = BodyType.Female;
            abs.shuffleable    = false;
            abs.SetTitleShort("Amnesiac");
            abs.SetTitle("Complete Amnesiac");

            BackstoryDatabase.AddBackstory(abs);
            BackstoryDatabase.AddBackstory(cbs);
        }
コード例 #2
0
        private static void CheckAllInjected()
        {
            // Thanks to all modders out there for providing help and support.
            // This is just for me.
            Backstory childMe = new Backstory
            {
                bodyTypeMale   = BodyType.Male,
                bodyTypeFemale = BodyType.Female,
                slot           = BackstorySlot.Childhood,
                baseDesc       =
                    "NAME never believed what was common sense and always doubted other people. HECAP later went on inflating toads with HIS sushi stick. It was there HE earned HIS nickname.",
                requiredWorkTags = WorkTags.Violent,
                shuffleable      = false
            };

            childMe.SetTitle("Lost child");
            childMe.SetTitleShort("Seeker");
            childMe.skillGains.Add("Shooting", 4);
            childMe.skillGains.Add("Medicine", 2);
            childMe.skillGains.Add("Social", 1);
            childMe.PostLoad();
            childMe.ResolveReferences();

            Backstory adultMale = new Backstory
            {
                bodyTypeMale   = BodyType.Male,
                bodyTypeFemale = BodyType.Female,
                slot           = BackstorySlot.Adulthood,
                baseDesc       =
                    "HECAP tells no one about his past. HECAP doesn't like doctors, thus HECAP prefers to tend his wounds himself.",
                shuffleable     = false,
                spawnCategories = new List <string>()
            };

            adultMale.spawnCategories.AddRange(new[] { "Civil", "Raider", "Slave", "Trader", "Traveler" });
            adultMale.SetTitle("Lone gunman");
            adultMale.SetTitleShort("Gunman");
            adultMale.skillGains.Add("Shooting", 4);
            adultMale.skillGains.Add("Medicine", 3);
            adultMale.skillGains.Add("Cooking", 2);
            adultMale.skillGains.Add("Social", 1);
            adultMale.PostLoad();
            adultMale.ResolveReferences();

            PawnBio me = new PawnBio
            {
                childhood = childMe,
                adulthood = adultMale,
                gender    = GenderPossibility.Male,
                name      = NameTriple.FromString("Gator 'Killface' Stinkwater")
            };

            me.PostLoad();
            SolidBioDatabase.allBios.Add(me);
            BackstoryDatabase.AddBackstory(childMe);

            BackstoryDatabase.AddBackstory(adultMale);
        }
コード例 #3
0
 public static void LoadAndInjectBackstoryData(LoadedLanguage lang)
 {
     foreach (XElement item in BackstoryTranslationUtility.BackstoryTranslationElements(lang))
     {
         string text = "[unknown]";
         try
         {
             text = item.Name.ToString();
             string    value     = item.Element("title").Value;
             string    value2    = item.Element("titleShort").Value;
             string    value3    = item.Element("desc").Value;
             Backstory backstory = default(Backstory);
             if (!BackstoryDatabase.TryGetWithIdentifier(text, out backstory))
             {
                 throw new Exception("Backstory not found matching identifier " + text);
             }
             if (value == backstory.Title && value2 == backstory.TitleShort && value3 == backstory.baseDesc)
             {
                 Log.Error("Backstory translation exactly matches default data: " + text);
             }
             else
             {
                 if (value != null)
                 {
                     backstory.SetTitle(value);
                 }
                 if (value2 != null)
                 {
                     backstory.SetTitleShort(value2);
                 }
                 if (value3 != null)
                 {
                     backstory.baseDesc = value3;
                 }
             }
         }
         catch (Exception ex)
         {
             Log.Warning("Couldn't load backstory " + text + ": " + ex + "\nFull XML text:\n\n" + item.ToString());
         }
     }
 }
コード例 #4
0
        private static IEnumerable <Backstory> NewBackstories()
        {
            if (backstories == null)
            {
                Backstory backstory;

                backstories = new List <Backstory>();
                string   txtBaseDesc   = "----------";
                string   txtTitle      = "---";
                string   txtTitleShort = "AI";
                BodyType bodyType      = BodyType.Female;

                if (workTagCollection == null)
                {
                    // Set a list with the possible disabled items
                    workTagCollection = new List <WorkTags>();
                    workTagCollection.Add(WorkTags.Animals);
                    //workTagCollection.Add(WorkTags.Artistic); //- In BasicWorkDisables
                    workTagCollection.Add(WorkTags.Caring);
                    workTagCollection.Add(WorkTags.Cleaning);
                    workTagCollection.Add(WorkTags.Cooking);
                    workTagCollection.Add(WorkTags.Crafting);
                    workTagCollection.Add(WorkTags.Firefighting);
                    workTagCollection.Add(WorkTags.Hauling);
                    workTagCollection.Add(WorkTags.Intellectual);
                    workTagCollection.Add(WorkTags.ManualDumb);
                    workTagCollection.Add(WorkTags.ManualSkilled);
                    workTagCollection.Add(WorkTags.Mining);
                    workTagCollection.Add(WorkTags.PlantWork);
                    workTagCollection.Add(WorkTags.Social);
                    workTagCollection.Add(WorkTags.Violent);
                    //workTagCollection.Add();
                }

                // Get the base disables (The AI can never do these)
                WorkTags workDisables1 = GetBasicWorkDisables();
                WorkTags workDisables2;

                // Create minimal backstory
                backstory          = new Backstory();
                backstory.baseDesc = txtBaseDesc;
                backstory.SetTitle(txtTitle);
                backstory.SetTitleShort(txtTitleShort);
                backstory.bodyTypeGlobal = bodyType;
                backstory.bodyTypeFemale = BodyType.Female;
                backstory.bodyTypeMale   = BodyType.Male;
                backstory.workDisables   = workDisables1;
                backstory.identifier     = GetBackstoryUniqueKey(backstory.workDisables);
                backstories.Add(backstory);

                //string log = workDisables1.ToString().Replace(", ", "_"); //Logging

                // add other backstories
                if (allCombos == null)
                {
                    allCombos = HelperAIPawn.GetAllCombos <WorkTags>(workTagCollection);
                }

                foreach (List <WorkTags> activeCombo in allCombos)
                {
                    workDisables2 = GetBasicWorkDisables();
                    foreach (WorkTags entry in activeCombo)
                    {
                        workDisables2 = workDisables2 | entry;
                    }

                    backstory          = new Backstory();
                    backstory.baseDesc = txtBaseDesc;
                    backstory.SetTitle(txtTitle);
                    backstory.SetTitleShort(txtTitleShort);
                    backstory.bodyTypeGlobal = bodyType;
                    backstory.bodyTypeFemale = BodyType.Female;
                    backstory.bodyTypeMale   = BodyType.Male;
                    backstory.workDisables   = workDisables2;
                    backstory.identifier     = GetBackstoryUniqueKey(backstory.workDisables);
                    backstories.Add(backstory);

                    //log = log + Environment.NewLine + backstory.defName; // workDisables2.ToString().Replace(", ", "_"); //Logging
                }
            }

            //Log.Error(log); //Logging

            return(backstories.AsEnumerable <Backstory>());
        }
コード例 #5
0
        public static void init()
        {
            {
                Backstory bs = new Backstory();
                bs.identifier = "";                 // identifier will be set by ResolveReferences
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_vatgrown_sex_slave");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Vat-Grown Sex Slave", "Vat-Grown Sex Slave");
                    bs.SetTitleShort("SexSlave", "SexSlave");
                    bs.baseDesc = "NAME is made as a sex machine, rather than a human.During HIS growing period in the factory, HE was taught plenty of social skills and sex skills, just to satisfy various sex demands.";
                }
                // bs.skillGains = new Dictionary<string, int> ();
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Social"), 8);
                // bs.skillGainsResolved = new Dictionary<SkillDef, int> (); // populated by ResolveReferences
                bs.workDisables     = WorkTags.Intellectual;
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Childhood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                //bs.bodyTypeFemale = BodyType.Female;
                //bs.bodyTypeMale = BodyType.Thin;
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                child.vatgrown_sex_slave = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed0");
            }
            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_feisty");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Feisty Nymph", "Feisty Nymph");
                    bs.SetTitleShort("Nymph", "Nymph");
                    bs.baseDesc = "NAME struts around the colony like a conqueror examining a newly annexed territory. You try to focus on your work but HE won't let you.";
                }
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Social"), -3);
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Shooting"), 2);
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Melee"), 9);
                bs.workDisables     = (WorkTags.Cleaning | WorkTags.Animals | WorkTags.Caring | WorkTags.Artistic | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.feisty = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed1");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_curious");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Curious Nymph", "Curious Nymph");
                    bs.SetTitleShort("Nymph", "Nymph");
                    bs.baseDesc = "Hold the covering plate back and place the actuator in slot C. Line the rod up. No, that won't do, it needs to be perfect. Now pop the JC-444 chip in place.";
                }
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Construction"), 2);
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Crafting"), 6);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Artistic | WorkTags.Caring | WorkTags.Cooking | WorkTags.Mining | WorkTags.PlantWork | WorkTags.Violent | WorkTags.ManualDumb);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.curious = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed2");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_tender");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Tender Nymph", "Tender Nymph");
                    bs.SetTitleShort("Nymph", "Nymph");
                    bs.baseDesc = "NAME has a pair of charming eyes, and HIS voice is soft and sweet. Due to HIS previous nurse job, HE tends people quite well.";
                }
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Medicine"), 4);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Artistic | WorkTags.Hauling | WorkTags.Violent | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.tender = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed3");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_chatty");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Chatty Nymph", "Chatty Nymph");
                    bs.SetTitleShort("Nymph", "Nymph");
                    bs.baseDesc = "No one can be more loquacious than NAME. HECAP has a flexible tongue, a sharp mind, and hot lips.";
                }
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Social"), 6);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Caring | WorkTags.Artistic | WorkTags.Violent | WorkTags.ManualDumb | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.chatty = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed4");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_broken");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Broken Nymph", "Broken Nymph");
                    bs.SetTitleShort("Nymph", "Nymph");
                    bs.baseDesc = "Maybe NAME suffered some terrible Things, HE looks rather emaciated, and no one wants to speak with HIM.\nHECAP only behaves a bit vivaciously while staring at some rod-like stuffs.";
                }
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Social"), -5);
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Artistic"), 8);
                bs.workDisables     = (WorkTags.Cleaning | WorkTags.Animals | WorkTags.Caring | WorkTags.Violent | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.broken = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed5");
            }
        }
コード例 #6
0
ファイル: PsychologyBase.cs プロジェクト: XNoNameX/Psychology
        public override void DefsLoaded()
        {
            if (ModIsActive)
            {
                /* Mod settings */

                toggleEmpathy       = Settings.GetHandle <bool>("EnableEmpathy", "EmpathyChangesTitle".Translate(), "EmpathyChangesTooltip".Translate(), true);
                toggleKinsey        = Settings.GetHandle <bool>("EnableSexuality", "SexualityChangesTitle".Translate(), "SexualityChangesTooltip".Translate(), true);
                kinseyMode          = Settings.GetHandle <KinseyMode>("KinseyMode", "KinseyModeTitle".Translate(), "KinseyModeTooltip".Translate(), KinseyMode.Realistic, null, "KinseyMode_");
                toggleIndividuality = Settings.GetHandle <bool>("EnableIndividuality", "IndividualityTitle".Translate(), "IndividualityTooltip".Translate(), true);
                toggleElections     = Settings.GetHandle <bool>("EnableElections", "ElectionsTitle".Translate(), "ElectionsTooltip".Translate(), true);

                notBabyMode = toggleIndividuality.Value;
                elections   = toggleElections.Value;

                if (PsychologyBase.ActivateKinsey())
                {
                    mode = kinseyMode.Value;
                }

                /* Mod conflict detection */

                TraitDef bisexual = DefDatabase <TraitDef> .GetNamedSilentFail("Bisexual");

                TraitDef asexual = DefDatabase <TraitDef> .GetNamedSilentFail("Asexual");

                if (bisexual != null || asexual != null || !toggleKinsey)
                {
                    if (toggleKinsey)
                    {
                        Logger.Message("KinseyDisable".Translate());
                    }
                    kinsey = false;
                }

                /* Conditional vanilla Def edits */

                ThoughtDef knowGuestExecuted = AddNullifyingTraits("KnowGuestExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowGuestExecuted != null && toggleEmpathy)
                {
                    knowGuestExecuted = ModifyThoughtStages(knowGuestExecuted, new int[] { -1, -2, -4, -5 });
                }
                ThoughtDef knowColonistExecuted = AddNullifyingTraits("KnowColonistExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistExecuted != null && toggleEmpathy)
                {
                    knowColonistExecuted = ModifyThoughtStages(knowColonistExecuted, new int[] { -1, -2, -4, -5 });
                }
                ThoughtDef knowPrisonerDiedInnocent = AddNullifyingTraits("KnowPrisonerDiedInnocent", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowPrisonerDiedInnocent != null && toggleEmpathy)
                {
                    knowPrisonerDiedInnocent = ModifyThoughtStages(knowPrisonerDiedInnocent, new int[] { -4 });
                }
                ThoughtDef knowColonistDied = AddNullifyingTraits("KnowColonistDied", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistDied != null && toggleEmpathy)
                {
                    knowColonistDied = ModifyThoughtStages(knowColonistDied, new int[] { -2 });
                }
                ThoughtDef colonistAbandoned = AddNullifyingTraits("ColonistAbandoned", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (colonistAbandoned != null && toggleEmpathy)
                {
                    colonistAbandoned = ModifyThoughtStages(colonistAbandoned, new int[] { -2 });
                }
                ThoughtDef colonistAbandonedToDie = AddNullifyingTraits("ColonistAbandonedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (colonistAbandonedToDie != null && toggleEmpathy)
                {
                    colonistAbandonedToDie = ModifyThoughtStages(colonistAbandonedToDie, new int[] { -4 });
                }
                ThoughtDef prisonerAbandonedToDie = AddNullifyingTraits("PrisonerAbandonedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (prisonerAbandonedToDie != null && toggleEmpathy)
                {
                    prisonerAbandonedToDie = ModifyThoughtStages(prisonerAbandonedToDie, new int[] { -3 });
                }
                ThoughtDef knowPrisonerSold = AddNullifyingTraits("KnowPrisonerSold", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowPrisonerSold != null && toggleEmpathy)
                {
                    knowPrisonerSold = ModifyThoughtStages(knowPrisonerSold, new int[] { -4 });
                }
                ThoughtDef knowGuestOrganHarvested = AddNullifyingTraits("KnowGuestOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowGuestOrganHarvested != null && toggleEmpathy)
                {
                    knowGuestOrganHarvested = ModifyThoughtStages(knowGuestOrganHarvested, new int[] { -4 });
                }
                ThoughtDef knowColonistOrganHarvested = AddNullifyingTraits("KnowColonistOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistOrganHarvested != null && toggleEmpathy)
                {
                    knowColonistOrganHarvested = ModifyThoughtStages(knowColonistOrganHarvested, new int[] { -4 });
                }
                ThoughtDef beauty = AddNullifyingTraits("KnowColonistOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistOrganHarvested != null && toggleEmpathy)
                {
                    knowColonistOrganHarvested = ModifyThoughtStages(knowColonistOrganHarvested, new int[] { -4 });
                }


                IEnumerable <ThingDef> things = (from m in LoadedModManager.RunningMods
                                                 from def in m.AllDefs.OfType <ThingDef>()
                                                 where typeof(Pawn).IsAssignableFrom(def.thingClass)
                                                 select def);
                foreach (ThingDef t in things)
                {
                    if (t.race.intelligence == Intelligence.Humanlike && (DefDatabase <ThinkTreeDef> .GetNamedSilentFail("Zombie") == null || t.race.thinkTreeMain != DefDatabase <ThinkTreeDef> .GetNamedSilentFail("Zombie")))
                    {
                        t.thingClass = typeof(PsychologyPawn);
                        t.inspectorTabsResolved.Add(InspectTabManager.GetSharedInstance(typeof(ITab_Pawn_Psyche)));
                        t.recipes.Add(RecipeDefOfPsychology.TreatPyromania);
                        t.recipes.Add(RecipeDefOfPsychology.TreatChemicalInterest);
                        t.recipes.Add(RecipeDefOfPsychology.TreatChemicalFascination);
                        t.recipes.Add(RecipeDefOfPsychology.TreatDepression);
                        if (!t.race?.hediffGiverSets?.NullOrEmpty() ?? false)
                        {
                            if (t.race.hediffGiverSets.Contains(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicStandard")))
                            {
                                t.race.hediffGiverSets.Add(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicPsychology"));
                            }
                        }
                    }
                }

                /*
                 * Now to enjoy the benefits of having made a popular mod!
                 * This will be our little secret.
                 */
                Backstory childMe = new Backstory();
                childMe.bodyTypeMale   = BodyType.Male;
                childMe.bodyTypeFemale = BodyType.Female;
                childMe.slot           = BackstorySlot.Childhood;
                childMe.SetTitle("Child soldier");
                childMe.SetTitleShort("Scout");
                childMe.baseDesc = "NAME was born into a dictatorial outlander society on a nearby rimworld. Their chief export was war, and HE was conscripted at a young age into the military to serve as a scout due to HIS runner's build. HECAP learned how to use a gun, patch wounds on the battlefield, and communicate with HIS squad. It was there HE earned HIS nickname.";
                childMe.skillGains.Add("Shooting", 4);
                childMe.skillGains.Add("Medicine", 2);
                childMe.skillGains.Add("Social", 1);
                childMe.requiredWorkTags = WorkTags.Violent;
                childMe.shuffleable      = false;
                childMe.PostLoad();
                childMe.ResolveReferences();
                //Disabled until I can be bothered to code it so they're actually siblings.

                /*Backstory adultMale = new Backstory();
                 * adultMale.bodyTypeMale = BodyType.Male;
                 * adultMale.bodyTypeFemale = BodyType.Female;
                 * adultMale.slot = BackstorySlot.Adulthood;
                 * adultMale.SetTitle("Missing in action");
                 * adultMale.SetTitleShort("P.O.W.");
                 * adultMale.baseDesc = "Eventually, HE was captured on a mission by one of his faction's many enemies. HECAP was tortured for information, the techniques of which HE never forgot. When they could get no more out of HIM, HE was sent to a prison camp, where HE worked for years before staging an escape and fleeing into civilization.";
                 * adultMale.skillGains.Add("Crafting", 4);
                 * adultMale.skillGains.Add("Construction", 3);
                 * adultMale.skillGains.Add("Mining", 2);
                 * adultMale.skillGains.Add("Social", 1);
                 * adultMale.spawnCategories = new List<string>();
                 * adultMale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" });
                 * adultMale.shuffleable = false;
                 * adultMale.PostLoad();
                 * adultMale.ResolveReferences();*/
                Backstory adultFemale = new Backstory();
                adultFemale.bodyTypeMale   = BodyType.Male;
                adultFemale.bodyTypeFemale = BodyType.Female;
                adultFemale.slot           = BackstorySlot.Adulthood;
                adultFemale.SetTitle("Battlefield medic");
                adultFemale.SetTitleShort("Medic");
                adultFemale.baseDesc = "HECAP continued to serve in the military, being promoted through the ranks as HIS skill increased. HECAP learned how to treat more serious wounds as HIS role slowly transitioned from scout to medic, as well as how to make good use of army rations. HECAP built good rapport with HIS squad as a result.";
                adultFemale.skillGains.Add("Shooting", 4);
                adultFemale.skillGains.Add("Medicine", 3);
                adultFemale.skillGains.Add("Cooking", 2);
                adultFemale.skillGains.Add("Social", 1);
                adultFemale.spawnCategories = new List <string>();
                adultFemale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" });
                adultFemale.shuffleable = false;
                adultFemale.PostLoad();
                adultFemale.ResolveReferences();

                /*PawnBio maleMe = new PawnBio();
                 * maleMe.childhood = childMe;
                 * maleMe.adulthood = adultMale;
                 * maleMe.gender = GenderPossibility.Male;
                 * maleMe.name = NameTriple.FromString("Nathan 'Jackal' Tarai");
                 * maleMe.PostLoad();
                 * SolidBioDatabase.allBios.Add(maleMe);*/
                PawnBio femaleMe = new PawnBio();
                femaleMe.childhood = childMe;
                femaleMe.adulthood = adultFemale;
                femaleMe.gender    = GenderPossibility.Female;
                femaleMe.name      = NameTriple.FromString("Elizabeth 'Eagle' Tarai");
                femaleMe.PostLoad();
                SolidBioDatabase.allBios.Add(femaleMe);
                BackstoryDatabase.AddBackstory(childMe);
                //BackstoryDatabase.AddBackstory(adultMale);
                BackstoryDatabase.AddBackstory(adultFemale);
            }
        }
コード例 #7
0
        public override void DefsLoaded()
        {
            if (ModIsActive)
            {
                toggleEmpathy       = Settings.GetHandle <bool>("EnableEmpathy", "EmpathyChangesTitle".Translate(), "EmpathyChangesTooltip".Translate(), true);
                toggleKinsey        = Settings.GetHandle <bool>("EnableSexuality", "SexualityChangesTitle".Translate(), "SexualityChangesTooltip".Translate(), true);
                kinseyMode          = Settings.GetHandle <KinseyMode>("KinseyMode", "KinseyModeTitle".Translate(), "KinseyModeTooltip".Translate(), KinseyMode.Realistic, null, "KinseyMode_");
                toggleSabotage      = Settings.GetHandle <bool>("EnableSabotage", "SabotageIncidentTitle".Translate(), "SabotageIncidentTooltip".Translate(), false);
                toggleIndividuality = Settings.GetHandle <bool>("EnableIndividuality", "IndividualityTitle".Translate(), "IndividualityTooltip".Translate(), true);

                sabotabby   = toggleSabotage.Value;
                notBabyMode = toggleIndividuality.Value;

                if (!detoursMedical)
                {
                    Logger.Warning("MedicalDetourDisable".Translate());
                }

                //Vanilla Defs will be edited at load to improve compatibility with other mods.
                AddConflictingTraits("Nudist", new TraitDef[] { TraitDefOfPsychology.Prude });
                AddConflictingTraits("Bloodlust", new TraitDef[] { TraitDefOfPsychology.BleedingHeart, TraitDefOfPsychology.Desensitized });
                AddConflictingTraits("Psychopath", new TraitDef[] { TraitDefOfPsychology.BleedingHeart, TraitDefOfPsychology.Desensitized, TraitDefOfPsychology.OpenMinded });
                AddConflictingTraits("Cannibal", new TraitDef[] { TraitDefOfPsychology.BleedingHeart, TraitDefOfPsychology.Gourmet });
                AddConflictingTraits("Ascetic", new TraitDef[] { TraitDefOfPsychology.Gourmet });
                AddConflictingTraits("Neurotic", new TraitDef[] { TraitDefOfPsychology.HeavySleeper });
                AddConflictingTraits("DislikesMen", new TraitDef[] { TraitDefOfPsychology.OpenMinded });
                AddConflictingTraits("DislikesWomen", new TraitDef[] { TraitDefOfPsychology.OpenMinded });
                AddConflictingTraits("Prosthophobe", new TraitDef[] { TraitDefOfPsychology.OpenMinded });

                TraitDef bisexual = DefDatabase <TraitDef> .GetNamedSilentFail("Bisexual");

                TraitDef asexual = DefDatabase <TraitDef> .GetNamedSilentFail("Asexual");

                if (bisexual != null || asexual != null || !toggleKinsey || !detoursSexual)
                {
                    if (toggleKinsey)
                    {
                        Logger.Message("KinseyDisable".Translate());
                        if (!detoursSexual)
                        {
                            Logger.Warning("KinseyDetourDisable".Translate());
                            TraitDefOfPsychology.Codependent.SetCommonality(0f);
                            TraitDefOfPsychology.Lecher.SetCommonality(0f);
                            TraitDefOfPsychology.OpenMinded.SetCommonality(0f);
                            TraitDefOfPsychology.Polygamous.SetCommonality(0f);
                        }
                    }
                    kinsey = false;
                }

                if (PsychologyBase.ActivateKinsey())
                {
                    mode = kinseyMode.Value;
                    TraitDef gay = TraitDef.Named("Gay");
                    if (gay != null)
                    {
                        gay.SetCommonality(0f);
                    }
                    foreach (ThingDef t in DefDatabase <ThingDef> .AllDefsListForReading)
                    {
                        if (t.thingClass == typeof(Pawn))
                        {
                            t.thingClass = typeof(PsychologyPawn);
                        }
                    }
                }

                AddNullifyingTraits("AteLavishMeal", new TraitDef[] { TraitDefOfPsychology.Gourmet });
                AddNullifyingTraits("AteFineMeal", new TraitDef[] { TraitDefOfPsychology.Gourmet });
                AddNullifyingTraits("AteAwfulMeal", new TraitDef[] { TraitDefOfPsychology.Gourmet });
                AddNullifyingTraits("AteRawFood", new TraitDef[] { TraitDefOfPsychology.Gourmet });
                AddNullifyingTraits("AteInsectMeatAsIngredient", new TraitDef[] { TraitDefOfPsychology.Gourmet });
                AddNullifyingTraits("AteInsectMeatDirect", new TraitDef[] { TraitDefOfPsychology.Gourmet });
                AddNullifyingTraits("AteRottenFood", new TraitDef[] { TraitDefOfPsychology.Gourmet });
                AddNullifyingTraits("SleepDisturbed", new TraitDef[] { TraitDefOfPsychology.HeavySleeper });
                AddNullifyingTraits("ObservedLayingCorpse", new TraitDef[] { TraitDefOfPsychology.Desensitized });
                AddNullifyingTraits("WitnessedDeathAlly", new TraitDef[] { TraitDefOfPsychology.BleedingHeart, TraitDefOfPsychology.Desensitized });
                AddNullifyingTraits("WitnessedDeathNonAlly", new TraitDef[] { TraitDefOfPsychology.BleedingHeart, TraitDefOfPsychology.Desensitized });
                AddNullifyingTraits("FeelingRandom", new TraitDef[] { TraitDefOfPsychology.Unstable });
                AddNullifyingTraits("ApparelDamaged", new TraitDef[] { TraitDefOfPsychology.Prude });
                AddNullifyingTraits("EnvironmentDark", new TraitDef[] { TraitDefOfPsychology.Photosensitive });
                AddNullifyingTraits("DeadMansApparel", new TraitDef[] { TraitDefOfPsychology.Desensitized });
                AddNullifyingTraits("Naked", new TraitDef[] { TraitDefOfPsychology.Prude });
                AddNullifyingTraits("ColonistLeftUnburied", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                AddNullifyingTraits("CheatedOnMe", new TraitDef[] { TraitDefOfPsychology.Polygamous });
                AddNullifyingTraits("Affair", new TraitDef[] { TraitDefOfPsychology.Polygamous });
                AddNullifyingTraits("Disfigured", new TraitDef[] { TraitDefOfPsychology.OpenMinded });
                AddNullifyingTraits("Pretty", new TraitDef[] { TraitDefOfPsychology.OpenMinded });
                AddNullifyingTraits("Ugly", new TraitDef[] { TraitDefOfPsychology.OpenMinded });
                AddNullifyingTraits("SleptOutside", new TraitDef[] { TraitDefOfPsychology.Outdoorsy });

                ThoughtDef knowGuestExecuted = AddNullifyingTraits("KnowGuestExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowGuestExecuted != null && toggleEmpathy)
                {
                    if (knowGuestExecuted.stages.Count >= 1) //We can't assume that other mods won't remove stages from this thought, so we'll try to avoid OutOfBounds exceptions.
                    {
                        knowGuestExecuted.stages[0].baseMoodEffect = -1;
                    }
                    if (knowGuestExecuted.stages.Count >= 2)
                    {
                        knowGuestExecuted.stages[1].baseMoodEffect = -2;
                    }
                    if (knowGuestExecuted.stages.Count >= 3)
                    {
                        knowGuestExecuted.stages[2].baseMoodEffect = -4;
                    }
                    if (knowGuestExecuted.stages.Count >= 4)
                    {
                        knowGuestExecuted.stages[3].baseMoodEffect = -5;
                    }
                }

                ThoughtDef knowColonistExecuted = AddNullifyingTraits("KnowColonistExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistExecuted != null && toggleEmpathy)
                {
                    if (knowColonistExecuted.stages.Count >= 1)
                    {
                        knowColonistExecuted.stages[0].baseMoodEffect = -1;
                    }
                    if (knowColonistExecuted.stages.Count >= 2)
                    {
                        knowColonistExecuted.stages[1].baseMoodEffect = -2;
                    }
                    if (knowColonistExecuted.stages.Count >= 3)
                    {
                        knowColonistExecuted.stages[2].baseMoodEffect = -4;
                    }
                    if (knowColonistExecuted.stages.Count >= 4)
                    {
                        knowColonistExecuted.stages[3].baseMoodEffect = -5;
                    }
                }

                ThoughtDef knowPrisonerDiedInnocent = AddNullifyingTraits("KnowPrisonerDiedInnocent", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowPrisonerDiedInnocent != null && toggleEmpathy)
                {
                    if (knowPrisonerDiedInnocent.stages.Count >= 1)
                    {
                        knowPrisonerDiedInnocent.stages[0].baseMoodEffect = -4;
                    }
                }

                ThoughtDef knowColonistDied = AddNullifyingTraits("KnowColonistDied", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistDied != null && toggleEmpathy)
                {
                    if (knowColonistDied.stages.Count >= 1)
                    {
                        knowColonistDied.stages[0].baseMoodEffect = -2;
                    }
                }

                ThoughtDef colonistAbandoned = AddNullifyingTraits("ColonistAbandoned", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (colonistAbandoned != null && toggleEmpathy)
                {
                    if (colonistAbandoned.stages.Count >= 1)
                    {
                        colonistAbandoned.stages[0].baseMoodEffect = -2;
                    }
                }

                ThoughtDef colonistAbandonedToDie = AddNullifyingTraits("ColonistAbandonedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (colonistAbandonedToDie != null && toggleEmpathy)
                {
                    if (colonistAbandonedToDie.stages.Count >= 1)
                    {
                        colonistAbandonedToDie.stages[0].baseMoodEffect = -4;
                    }
                }

                ThoughtDef prisonerAbandonedToDie = AddNullifyingTraits("PrisonerAbandonedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (prisonerAbandonedToDie != null && toggleEmpathy)
                {
                    if (prisonerAbandonedToDie.stages.Count >= 1)
                    {
                        prisonerAbandonedToDie.stages[0].baseMoodEffect = -3;
                    }
                }

                ThoughtDef knowPrisonerSold = AddNullifyingTraits("KnowPrisonerSold", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowPrisonerSold != null && toggleEmpathy)
                {
                    if (knowPrisonerSold.stages.Count >= 1)
                    {
                        knowPrisonerSold.stages[0].baseMoodEffect = -4;
                    }
                }

                ThoughtDef knowGuestOrganHarvested = AddNullifyingTraits("KnowGuestOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowGuestOrganHarvested != null && toggleEmpathy)
                {
                    if (knowGuestOrganHarvested.stages.Count >= 1)
                    {
                        knowGuestOrganHarvested.stages[0].baseMoodEffect = -4;
                    }
                }

                ThoughtDef knowColonistOrganHarvested = AddNullifyingTraits("KnowColonistOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistOrganHarvested != null && toggleEmpathy)
                {
                    if (knowColonistOrganHarvested.stages.Count >= 1)
                    {
                        knowColonistOrganHarvested.stages[0].baseMoodEffect = -4;
                    }
                }

                ReplaceThoughtWorker("CabinFever", typeof(ThoughtWorker_CabinFever));
                ReplaceThoughtWorker("Disfigured", typeof(ThoughtWorker_Disfigured));
                ReplaceThoughtWorker("Ugly", typeof(ThoughtWorker_Ugly));
                ReplaceThoughtWorker("AnnoyingVoice", typeof(ThoughtWorker_AnnoyingVoice));
                ReplaceThoughtWorker("CreepyBreathing", typeof(ThoughtWorker_CreepyBreathing));
                ReplaceThoughtWorker("Pretty", typeof(ThoughtWorker_Pretty));
                ReplaceIncidentWorker("RaidEnemy", typeof(IncidentWorker_RaidEnemy));

                // Credit to FluffierThanThou for the code.
                var livingRaces = DefDatabase <ThingDef>
                                  .AllDefsListForReading
                                  .Where(t => !t.race?.hediffGiverSets?.NullOrEmpty() ?? false);

                foreach (ThingDef alive in livingRaces)
                {
                    if (alive.race.hediffGiverSets.Contains(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicStandard")))
                    {
                        alive.race.hediffGiverSets.Add(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicPsychology"));
                        alive.recipes.Add(RecipeDefOfPsychology.TreatPyromania);
                    }
                }

                MentalBreakDef berserk = DefDatabase <MentalBreakDef> .GetNamed("Berserk");

                berserk.baseCommonality = 0f;
                MentalStateDef fireStartingSpree = DefDatabase <MentalStateDef> .GetNamed("FireStartingSpree");

                fireStartingSpree.workerClass = typeof(MentalStateWorker_FireStartingSpree);

                /*
                 * Now to enjoy the benefits of having made a popular mod!
                 * This will be our little secret.
                 */
                Backstory childMe = new Backstory();
                childMe.bodyTypeMale   = BodyType.Male;
                childMe.bodyTypeFemale = BodyType.Female;
                childMe.slot           = BackstorySlot.Childhood;
                childMe.SetTitle("Child soldier");
                childMe.SetTitleShort("Scout");
                childMe.baseDesc = "NAME was born into a dictatorial outlander society on a nearby rimworld. Their chief export was war, and HE was conscripted at a young age into the military to serve as a scout due to HIS runner's build. HECAP learned how to use a gun, patch wounds on the battlefield, and communicate with HIS squad. It was there HE earned HIS nickname.";
                childMe.skillGains.Add("Shooting", 4);
                childMe.skillGains.Add("Medicine", 2);
                childMe.skillGains.Add("Social", 1);
                childMe.requiredWorkTags = WorkTags.Violent;
                childMe.shuffleable      = false;
                childMe.PostLoad();
                childMe.ResolveReferences();
                //Disabled until I can be bothered to code it so they're actually siblings.

                /*Backstory adultMale = new Backstory();
                 * adultMale.bodyTypeMale = BodyType.Male;
                 * adultMale.bodyTypeFemale = BodyType.Female;
                 * adultMale.slot = BackstorySlot.Adulthood;
                 * adultMale.SetTitle("Missing in action");
                 * adultMale.SetTitleShort("P.O.W.");
                 * adultMale.baseDesc = "Eventually, HE was captured on a mission by one of his faction's many enemies. HECAP was tortured for information, the techniques of which HE never forgot. When they could get no more out of HIM, HE was sent to a prison camp, where HE worked for years before staging an escape and fleeing into civilization.";
                 * adultMale.skillGains.Add("Crafting", 4);
                 * adultMale.skillGains.Add("Construction", 3);
                 * adultMale.skillGains.Add("Mining", 2);
                 * adultMale.skillGains.Add("Social", 1);
                 * adultMale.spawnCategories = new List<string>();
                 * adultMale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" });
                 * adultMale.shuffleable = false;
                 * adultMale.PostLoad();
                 * adultMale.ResolveReferences();*/
                Backstory adultFemale = new Backstory();
                adultFemale.bodyTypeMale   = BodyType.Male;
                adultFemale.bodyTypeFemale = BodyType.Female;
                adultFemale.slot           = BackstorySlot.Adulthood;
                adultFemale.SetTitle("Battlefield medic");
                adultFemale.SetTitleShort("Medic");
                adultFemale.baseDesc = "HECAP continued to serve in the military, being promoted through the ranks as HIS skill increased. HECAP learned how to treat more serious wounds as HIS role slowly transitioned from scout to medic, as well as how to make good use of army rations. HECAP built good rapport with HIS squad as a result.";
                adultFemale.skillGains.Add("Shooting", 4);
                adultFemale.skillGains.Add("Medicine", 3);
                adultFemale.skillGains.Add("Cooking", 2);
                adultFemale.skillGains.Add("Social", 1);
                adultFemale.spawnCategories = new List <string>();
                adultFemale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" });
                adultFemale.shuffleable = false;
                adultFemale.PostLoad();
                adultFemale.ResolveReferences();

                /*PawnBio maleMe = new PawnBio();
                 * maleMe.childhood = childMe;
                 * maleMe.adulthood = adultMale;
                 * maleMe.gender = GenderPossibility.Male;
                 * maleMe.name = NameTriple.FromString("Nathan 'Jackal' Tarai");
                 * maleMe.PostLoad();
                 * SolidBioDatabase.allBios.Add(maleMe);*/
                PawnBio femaleMe = new PawnBio();
                femaleMe.childhood = childMe;
                femaleMe.adulthood = adultFemale;
                femaleMe.gender    = GenderPossibility.Female;
                femaleMe.name      = NameTriple.FromString("Elizabeth 'Eagle' Tarai");
                femaleMe.PostLoad();
                SolidBioDatabase.allBios.Add(femaleMe);
                BackstoryDatabase.AddBackstory(childMe);
                //BackstoryDatabase.AddBackstory(adultMale);
                BackstoryDatabase.AddBackstory(adultFemale);
            }
        }
コード例 #8
0
        public override void DefsLoaded()
        {
            if (ModIsActive)
            {
                /* Mod settings */

                toggleEmpathy        = Settings.GetHandle <bool>("EnableEmpathy", "EmpathyChangesTitle".Translate(), "EmpathyChangesTooltip".Translate(), true);
                toggleKinsey         = Settings.GetHandle <bool>("EnableSexuality", "SexualityChangesTitle".Translate(), "SexualityChangesTooltip".Translate(), true);
                kinseyMode           = Settings.GetHandle <KinseyMode>("KinseyMode", "KinseyModeTitle".Translate(), "KinseyModeTooltip".Translate(), KinseyMode.Realistic, null, "KinseyMode_");
                toggleIndividuality  = Settings.GetHandle <bool>("EnableIndividuality", "IndividualityTitle".Translate(), "IndividualityTooltip".Translate(), true);
                toggleElections      = Settings.GetHandle <bool>("EnableElections", "ElectionsTitle".Translate(), "ElectionsTooltip".Translate(), true);
                conversationDuration = Settings.GetHandle <float>("ConversationDuration", "DurationTitle".Translate(), "DurationTooltip".Translate(), 60f, (String s) => float.Parse(s) >= 15f && float.Parse(s) <= 180f);
                toggleDateLetters    = Settings.GetHandle <bool>("SendDateLetters", "SendDateLettersTitle".Translate(), "SendDateLettersTooltip".Translate(), true);
                toggleBenchmarking   = Settings.GetHandle <bool>("Benchmarking", "BenchmarkingTitle".Translate(), "BenchmarkingTooltip".Translate(), false);

                kinsey        = toggleKinsey.Value;
                notBabyMode   = toggleIndividuality.Value;
                elections     = toggleElections.Value;
                dateLetters   = toggleDateLetters.Value;
                benchmark     = toggleBenchmarking.Value;
                convoDuration = conversationDuration.Value;

                if (PsychologyBase.ActivateKinsey())
                {
                    mode = kinseyMode.Value;
                }

                /* Mod conflict detection */

                TraitDef bisexual = DefDatabase <TraitDef> .GetNamedSilentFail("Bisexual");

                TraitDef asexual = DefDatabase <TraitDef> .GetNamedSilentFail("Asexual");

                if (bisexual != null || asexual != null || !toggleKinsey)
                {
                    if (toggleKinsey)
                    {
                        Logger.Message("KinseyDisable".Translate());
                    }
                    kinsey = false;
                }

                /* Conditional vanilla Def edits */

                ThoughtDef knowGuestExecuted = AddNullifyingTraits("KnowGuestExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowGuestExecuted != null && toggleEmpathy)
                {
                    knowGuestExecuted = ModifyThoughtStages(knowGuestExecuted, new int[] { -1, -2, -4, -5 });
                }
                ThoughtDef knowColonistExecuted = AddNullifyingTraits("KnowColonistExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistExecuted != null && toggleEmpathy)
                {
                    knowColonistExecuted = ModifyThoughtStages(knowColonistExecuted, new int[] { -1, -2, -4, -5 });
                }
                ThoughtDef knowPrisonerDiedInnocent = AddNullifyingTraits("KnowPrisonerDiedInnocent", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowPrisonerDiedInnocent != null && toggleEmpathy)
                {
                    knowPrisonerDiedInnocent = ModifyThoughtStages(knowPrisonerDiedInnocent, new int[] { -4 });
                }
                ThoughtDef knowColonistDied = AddNullifyingTraits("KnowColonistDied", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistDied != null && toggleEmpathy)
                {
                    knowColonistDied = ModifyThoughtStages(knowColonistDied, new int[] { -2 });
                }
                ThoughtDef colonistAbandoned = AddNullifyingTraits("ColonistBanished", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (colonistAbandoned != null && toggleEmpathy)
                {
                    colonistAbandoned = ModifyThoughtStages(colonistAbandoned, new int[] { -2 });
                }
                ThoughtDef colonistAbandonedToDie = AddNullifyingTraits("ColonistBanishedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (colonistAbandonedToDie != null && toggleEmpathy)
                {
                    colonistAbandonedToDie = ModifyThoughtStages(colonistAbandonedToDie, new int[] { -4 });
                }
                ThoughtDef prisonerAbandonedToDie = AddNullifyingTraits("PrisonerBanishedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (prisonerAbandonedToDie != null && toggleEmpathy)
                {
                    prisonerAbandonedToDie = ModifyThoughtStages(prisonerAbandonedToDie, new int[] { -3 });
                }
                ThoughtDef knowPrisonerSold = AddNullifyingTraits("KnowPrisonerSold", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowPrisonerSold != null && toggleEmpathy)
                {
                    knowPrisonerSold = ModifyThoughtStages(knowPrisonerSold, new int[] { -4 });
                }
                ThoughtDef knowGuestOrganHarvested = AddNullifyingTraits("KnowGuestOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowGuestOrganHarvested != null && toggleEmpathy)
                {
                    knowGuestOrganHarvested = ModifyThoughtStages(knowGuestOrganHarvested, new int[] { -4 });
                }
                ThoughtDef knowColonistOrganHarvested = AddNullifyingTraits("KnowColonistOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistOrganHarvested != null && toggleEmpathy)
                {
                    knowColonistOrganHarvested = ModifyThoughtStages(knowColonistOrganHarvested, new int[] { -4 });
                }
                ThoughtDef beauty = AddNullifyingTraits("KnowColonistOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart });
                if (knowColonistOrganHarvested != null && toggleEmpathy)
                {
                    knowColonistOrganHarvested = ModifyThoughtStages(knowColonistOrganHarvested, new int[] { -4 });
                }

                /* ThingDef injection reworked by notfood */
                var zombieThinkTree = DefDatabase <ThinkTreeDef> .GetNamedSilentFail("Zombie");

                IEnumerable <ThingDef> things = (
                    from def in DefDatabase <ThingDef> .AllDefs
                    where typeof(Pawn).IsAssignableFrom(def.thingClass) &&
                    def.race?.intelligence == Intelligence.Humanlike &&
                    !def.defName.Contains("AIPawn") &&
                    (zombieThinkTree == null || def.race.thinkTreeMain != zombieThinkTree)
                    select def
                    );

                List <string> registered = new List <string>();
                foreach (ThingDef t in things)
                {
                    if (t.inspectorTabsResolved == null)
                    {
                        t.inspectorTabsResolved = new List <InspectTabBase>(1);
                    }
                    t.inspectorTabsResolved.Add(InspectTabManager.GetSharedInstance(typeof(ITab_Pawn_Psyche)));

                    if (t.recipes == null)
                    {
                        t.recipes = new List <RecipeDef>(6);
                    }
                    t.recipes.Add(RecipeDefOfPsychology.TreatPyromania);
                    t.recipes.Add(RecipeDefOfPsychology.TreatChemicalInterest);
                    t.recipes.Add(RecipeDefOfPsychology.TreatChemicalFascination);
                    t.recipes.Add(RecipeDefOfPsychology.TreatDepression);
                    t.recipes.Add(RecipeDefOfPsychology.TreatInsomnia);
                    t.recipes.Add(RecipeDefOfPsychology.CureAnxiety);

                    if (t.comps == null)
                    {
                        t.comps = new List <CompProperties>(1);
                    }
                    t.comps.Add(new CompProperties_Psychology());

                    if (!t.race.hediffGiverSets.NullOrEmpty())
                    {
                        if (t.race.hediffGiverSets.Contains(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicStandard")))
                        {
                            t.race.hediffGiverSets.Add(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicPsychology"));
                        }
                    }
                    registered.Add(t.defName);
                }
                if (Prefs.DevMode && Prefs.LogVerbose)
                {
                    Log.Message("Psychology :: Registered " + string.Join(", ", registered.ToArray()));
                }

                /*
                 * Now to enjoy the benefits of having made a popular mod!
                 * This will be our little secret.
                 */
                Traverse.Create(child).Field("bodyTypeMale").SetValue("Male");
                Traverse.Create(child).Field("bodyTypeFemale").SetValue("Female");
                child.slot = BackstorySlot.Childhood;
                child.SetTitle("Child soldier", "Child soldier");
                child.SetTitleShort("Scout", "Scout");
                child.baseDesc = "[PAWN_nameDef] was born into a dictatorial outlander society on a nearby rimworld. Their chief export was war, and [PAWN_pronoun] was conscripted at a young age into the military to serve as a scout due to [PAWN_possessive] runner's build. [PAWN_pronoun] learned how to use a gun, patch wounds on the battlefield, and communicate with [PAWN_possessive] squad. It was there [PAWN_pronoun] earned [PAWN_possessive] nickname.";
                Traverse.Create(child).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Shooting", 4);
                Traverse.Create(child).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Medicine", 2);
                Traverse.Create(child).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Social", 1);
                child.requiredWorkTags = WorkTags.Violent;
                child.shuffleable      = false;
                child.PostLoad();
                child.ResolveReferences();
                Backstory adultMale = new Backstory();
                Traverse.Create(adultMale).Field("bodyTypeMale").SetValue("Male");
                Traverse.Create(adultMale).Field("bodyTypeFemale").SetValue("Female");
                adultMale.slot = BackstorySlot.Adulthood;
                adultMale.SetTitle("Missing in action", "Missing in action");
                adultMale.SetTitleShort("Ex-P.O.W.", "Ex-P.O.W.");
                adultMale.baseDesc = "Eventually, [PAWN_pronoun] was captured on a mission by one of [PAWN_possessive] faction's many enemies. [PAWN_pronoun] was tortured for information, the techniques of which [PAWN_pronoun] never forgot. When they could get no more out of [PAWN_objective], [PAWN_pronoun] was sent to a prison camp, where [PAWN_pronoun] worked for years before staging an escape and fleeing into civilization.";
                Traverse.Create(adultMale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Crafting", 4);
                Traverse.Create(adultMale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Construction", 3);
                Traverse.Create(adultMale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Mining", 2);
                Traverse.Create(adultMale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Social", 1);
                adultMale.spawnCategories = new List <string>();
                adultMale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" });
                adultMale.shuffleable = false;
                adultMale.PostLoad();
                adultMale.ResolveReferences();
                Backstory adultFemale = new Backstory();
                Traverse.Create(adultFemale).Field("bodyTypeMale").SetValue("Male");
                Traverse.Create(adultFemale).Field("bodyTypeFemale").SetValue("Female");
                adultFemale.slot = BackstorySlot.Adulthood;
                adultFemale.SetTitle("Battlefield medic", "Battlefield medic");
                adultFemale.SetTitleShort("Medic", "Medic");
                adultFemale.baseDesc = "[PAWN_pronoun] continued to serve in the military, being promoted through the ranks as [PAWN_possessive] skill increased. [PAWN_pronoun] learned how to treat more serious wounds as [PAWN_possessive] role slowly transitioned from scout to medic, as well as how to make good use of army rations. [PAWN_pronoun] built good rapport with [PAWN_possessive] squad as a result.";
                Traverse.Create(adultFemale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Shooting", 4);
                Traverse.Create(adultFemale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Medicine", 3);
                Traverse.Create(adultFemale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Cooking", 2);
                Traverse.Create(adultFemale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Social", 1);
                adultFemale.spawnCategories = new List <string>();
                adultFemale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" });
                adultFemale.shuffleable = false;
                adultFemale.PostLoad();
                adultFemale.ResolveReferences();
                PawnBio male = new PawnBio();
                male.childhood = child;
                male.adulthood = adultMale;
                male.gender    = GenderPossibility.Male;
                male.name      = NameTriple.FromString("Jason 'Jackal' Tarai");
                male.PostLoad();
                SolidBioDatabase.allBios.Add(male);
                PawnBio female = new PawnBio();
                female.childhood = child;
                female.adulthood = adultFemale;
                female.gender    = GenderPossibility.Female;
                female.name      = NameTriple.FromString("Elizabeth 'Eagle' Tarai");
                female.PostLoad();
                SolidBioDatabase.allBios.Add(female);
                BackstoryDatabase.AddBackstory(child);
                BackstoryDatabase.AddBackstory(adultMale);
                BackstoryDatabase.AddBackstory(adultFemale);
            }
        }
コード例 #9
0
        public void GetNeoAdultStory(ref Backstory _bs, int _index = 0)
        {
            tempBS = new Backstory();
            int i = 0;

            if (_index == 0)
            {
                i = Rand.Range(1, intAdultStoriesAmount + 1);
            }
            else
            {
                i = _index;
            }

            switch (i)
            {
            case 1:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Foreign herd owner");
                tempBS.SetTitleShort("Herder");
                tempBS.baseDesc         = "NAME had wealthy life as a owner of a large herd in a remote and foreign land. That is, until disaster struck. Now HE strives to carve a new life among people HE can't understand. HISCAP culture is so different that HE has chosen to remain silent.";
                tempBS.workDisables     = WorkTags.Social;
                tempBS.requiredWorkTags = WorkTags.ManualSkilled | WorkTags.Animals;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Animals", 3 }, { "Artistic", 1 }, { "Cooking", 2 }, { "Crafting", 2 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 2:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Storyteller");
                tempBS.SetTitleShort("Storyteller");
                tempBS.baseDesc         = "NAME has traveled the world gathering and recounting many legends and histories. After many years, HE now looks for place to belong.";
                tempBS.requiredWorkTags = WorkTags.Social | WorkTags.Artistic;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Artistic", 4 }, { "Construction", -4 }, { "Crafting", 1 }, { "Growing", -4 }, { "Medicine", -2 }, { "Mining", -4 }, { "Social", 3 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 3:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Maker");
                tempBS.SetTitleShort("Maker");
                tempBS.baseDesc         = "NAME struggled with hunting, but when it came to farming, HE had no patients. HECAP found his calling in building and creating things. HECAP has a natural talent for making plans become a reality.";
                tempBS.workDisables     = WorkTags.PlantWork;
                tempBS.requiredWorkTags = WorkTags.ManualSkilled;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Construction", 4 }, { "Crafting", 2 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 4:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Warrior cook");
                tempBS.SetTitleShort("Cook");
                tempBS.baseDesc         = "NAME joined a raiding tribe and spent most of HIS time cooking and repairing. During HIS travels, HE managed to get a basic knoweldge of combat.";
                tempBS.requiredWorkTags = WorkTags.ManualSkilled | WorkTags.Violent | WorkTags.Cooking;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Animals", -1 }, { "Construction", 1 }, { "Cooking", 3 }, { "Growing", -2 }, { "Medicine", -1 }, { "Melee", 3 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 5:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Adornment crafter");
                tempBS.SetTitleShort("Crafter");
                tempBS.baseDesc         = "Name was quite good at making tinkets and pendants. As people traded HIM goods for these, NAME soon found that HE could spend all of HIS time and energy crafting more complicated and intrquet things.";
                tempBS.requiredWorkTags = WorkTags.ManualSkilled | WorkTags.Artistic | WorkTags.Crafting;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Animals", -4 }, { "Artistic", 3 }, { "Crafting", 4 }, { "Growing", -4 }, { "Melee", -2 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 6:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Stalwart farmer");
                tempBS.SetTitleShort("Farmer");
                tempBS.baseDesc         = "NAME had deadly shot with the bow and arrow, but that couldn't save HIS farm from the brigands. HECAP had done such a good job growing wheat and vegetables, people thought it was the soil. ";
                tempBS.workDisables     = WorkTags.None;
                tempBS.requiredWorkTags = WorkTags.PlantWork | WorkTags.Violent | WorkTags.ManualDumb | WorkTags.Hauling;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Animals", -2 }, { "Artistic", -2 }, { "Construction", 0 }, { "Cooking", 0 }, { "Crafting", 0 }, { "Growing", 4 }
                    , { "Medicine", 0 }, { "Melee", 0 }, { "Mining", -2 }, { "Intellectual", 0 }, { "Shooting", 3 }, { "Social", -4 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 7:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Forest shaman");
                tempBS.SetTitleShort("Shaman");
                tempBS.baseDesc         = "NAME stuidied the shamanistic ways, but was dissatisified with HIS tribe elders. HECAP chose to wander the forests and practice HIS learnings until HS could find a place that needed HIM most.";
                tempBS.workDisables     = WorkTags.None;
                tempBS.requiredWorkTags = WorkTags.Caring | WorkTags.Animals | WorkTags.PlantWork;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Animals", 2 }, { "Artistic", 0 }, { "Construction", -4 }, { "Cooking", 0 }, { "Crafting", -4 }, { "Growing", 2 }
                    , { "Medicine", 4 }, { "Melee", 0 }, { "Mining", -4 }, { "Intellectual", 0 }, { "Shooting", 0 }, { "Social", 0 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 8:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Runaway mine slave");
                tempBS.SetTitleShort("Ex slave");
                tempBS.baseDesc         = "NAME was captured by a hostile clan and forced to mine stone and flint as a slave. Secretly the slaves practiced combat until the day came where they incited a massive revolt and fought their way to freedom. NAME can never pick at stone again without remembering the horrors HE endured as a cruely treated slave.";
                tempBS.workDisables     = WorkTags.Mining;
                tempBS.requiredWorkTags = WorkTags.ManualDumb | WorkTags.Violent | WorkTags.Hauling;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Animals", 0 }, { "Artistic", 0 }, { "Construction", 2 }, { "Cooking", 0 }, { "Crafting", 0 }, { "Growing", 0 }
                    , { "Medicine", 1 }, { "Melee", 3 }, { "Mining", 0 }, { "Intellectual", 0 }, { "Shooting", 2 }, { "Social", 0 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 9:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Gold miner");
                tempBS.SetTitleShort("Miner");
                tempBS.baseDesc         = "NAME made HIS mark in the world when HE joined a lucrative gold mining community deep in the jungle mountains. HECAP learned a lot about life, but most of all, HE learned how to mine and HE learned how to grow food in the harshest conditions.";
                tempBS.workDisables     = WorkTags.None;
                tempBS.requiredWorkTags = WorkTags.ManualSkilled | WorkTags.ManualDumb | WorkTags.Hauling | WorkTags.PlantWork | WorkTags.Mining;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Animals", -3 }, { "Artistic", -3 }, { "Construction", 0 }, { "Cooking", -3 }, { "Crafting", -3 }, { "Growing", 3 }
                    , { "Medicine", -2 }, { "Melee", 1 }, { "Mining", 4 }, { "Intellectual", 0 }, { "Shooting", 0 }, { "Social", 0 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 10:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Lore keeper");
                tempBS.SetTitleShort("Keeper");
                tempBS.baseDesc         = "NAME learned to read and write from a long line of lore keepers in HIS tribe. HECAP would stay up by fire every night and work on scrolls to pass on knowledge and helpful wisdom. It is through this mass of information that NAME now finds HIS purpose.";
                tempBS.workDisables     = WorkTags.None;
                tempBS.requiredWorkTags = WorkTags.Social | WorkTags.Intellectual;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Animals", 0 }, { "Artistic", 0 }, { "Construction", 0 }, { "Cooking", 0 }, { "Crafting", 0 }, { "Growing", 0 }
                    , { "Medicine", 0 }, { "Melee", 0 }, { "Mining", 0 }, { "Intellectual", 4 }, { "Shooting", 0 }, { "Social", 0 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 11:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Cave tribe hunter");
                tempBS.SetTitleShort("Hunter");
                tempBS.baseDesc         = "NAME would leave HIS tribe's cave system and only return home once HE had a fresh kill. NAME was usually home by sunset. HISCAP tribe would have loved HIM, if HE only learned to clean up after HIMSELF. And this is coming from cave people.";
                tempBS.workDisables     = WorkTags.Cleaning;
                tempBS.requiredWorkTags = WorkTags.Violent | WorkTags.Animals | WorkTags.Hauling | WorkTags.Mining;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Animals", 0 }, { "Artistic", -2 }, { "Construction", 1 }, { "Cooking", 0 }, { "Crafting", 0 }, { "Growing", 0 }
                    , { "Medicine", 0 }, { "Melee", 2 }, { "Mining", 2 }, { "Intellectual", -4 }, { "Shooting", 4 }, { "Social", -4 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            case 12:
                tempBS.slot = BackstorySlot.Adulthood;
                tempBS.SetTitle("Clan missionary");
                tempBS.SetTitleShort("Missionary");
                tempBS.baseDesc         = "NAME decided to devote HIS life to religious service. HECAP would do farm work by day in exchange for religious teachings in the evening. HECAP was an important member of HIS clan's society until a new warcheif took over, and kicked HIM out.";
                tempBS.workDisables     = WorkTags.None;
                tempBS.requiredWorkTags = WorkTags.ManualDumb | WorkTags.Caring | WorkTags.Social | WorkTags.Intellectual | WorkTags.Animals | WorkTags.Cleaning | WorkTags.Hauling | WorkTags.PlantWork;
                tempBS.skillGains       = new Dictionary <string, int> {
                    { "Animals", 3 }, { "Artistic", 0 }, { "Construction", 0 }, { "Cooking", -3 }, { "Crafting", -3 }, { "Growing", 2 }
                    , { "Medicine", 0 }, { "Melee", -4 }, { "Mining", 0 }, { "Intellectual", 2 }, { "Shooting", -4 }, { "Social", 3 }
                };
                tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                tempBS.bodyTypeMale    = BodyType.Male;
                tempBS.bodyTypeFemale  = BodyType.Female;
                break;

            default:
                Log.Message("ProBackstories.GetNeoAdultStory failed switch.");
                break;
            }

            tempBS.PostLoad();
            tempBS.ResolveReferences();

            _bs = tempBS;
        }
コード例 #10
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();
            if (!this.addToDatabase)
            {
                return;
            }
            if (BackstoryDatabase.allBackstories.ContainsKey(this.UniqueSaveKey()))
            {
                Log.Error("Backstory Error (" + this.defName + "): Duplicate defName.");
                return;
            }
            Backstory b = new Backstory();

            if (!this.title.NullOrEmpty())
            {
                b.SetTitle(this.title, this.title);
            }
            else
            {
                return;
            }
            if (!titleShort.NullOrEmpty())
            {
                b.SetTitleShort(titleShort, titleShort);
            }
            else
            {
                b.SetTitleShort(b.title, b.title);
            }
            if (!baseDesc.NullOrEmpty())
            {
                b.baseDesc = baseDesc;
            }
            else
            {
                b.baseDesc = "Empty.";
            }
            bool bodyTypeSet = false;

            if (!string.IsNullOrEmpty(bodyTypeGlobal))
            {
                bodyTypeSet = SetGlobalBodyType(b, bodyTypeGlobal);
            }
            if (!bodyTypeSet)
            {
                if (!SetMaleBodyType(b, bodyTypeMale))
                {
                    SetMaleBodyType(b, "Male");
                }
                if (!SetFemaleBodyType(b, bodyTypeFemale))
                {
                    SetFemaleBodyType(b, "Female");
                }
            }
            b.slot        = slot;
            b.shuffleable = shuffleable;
            if (spawnCategories.NullOrEmpty())
            {
                return;
            }
            else
            {
                b.spawnCategories = spawnCategories;
            }
            if (workAllows.Count > 0)
            {
                foreach (WorkTags current in Enum.GetValues(typeof(WorkTags)))
                {
                    if (!workAllows.Contains(current))
                    {
                        b.workDisables |= current;
                    }
                }
            }
            else if (workDisables.Count > 0)
            {
                foreach (var tag in workDisables)
                {
                    b.workDisables |= tag;
                }
            }
            else
            {
                b.workDisables = WorkTags.None;
            }
            if (requiredWorkTags.Count > 0)
            {
                foreach (var tag in requiredWorkTags)
                {
                    b.requiredWorkTags |= tag;
                }
            }
            else
            {
                b.requiredWorkTags = WorkTags.None;
            }
            Dictionary <SkillDef, int> skillDefs = new Dictionary <SkillDef, int>();

            foreach (BackstoryDefSkillListItem skillGain in this.skillGains)
            {
                SkillDef named = DefDatabase <SkillDef> .GetNamed(skillGain.key, false);

                if (named == null)
                {
                    Log.Error(string.Concat(new string[] { "Tribal Raiders: Unable to find SkillDef of [", skillGain.key, "] for Backstory.Title [", b.title, "]" }), false);
                    continue;
                }
                skillDefs.Add(named, skillGain.@value);
            }
            b.skillGainsResolved = skillDefs;
            Dictionary <string, int> fTraitList = forcedTraits.ToDictionary(i => i.key, i => i.value);

            if (fTraitList.Count > 0)
            {
                b.forcedTraits = new List <TraitEntry>();
                foreach (KeyValuePair <string, int> trait in fTraitList)
                {
                    b.forcedTraits.Add(new TraitEntry(TraitDef.Named(trait.Key), trait.Value));
                }
            }
            Dictionary <string, int> dTraitList = disallowedTraits.ToDictionary(i => i.key, i => i.value);

            if (dTraitList.Count > 0)
            {
                b.disallowedTraits = new List <TraitEntry>();
                foreach (KeyValuePair <string, int> trait in dTraitList)
                {
                    b.disallowedTraits.Add(new TraitEntry(TraitDef.Named(trait.Key), trait.Value));
                }
            }
            b.ResolveReferences();
            b.PostLoad();
            b.identifier = this.UniqueSaveKey();
            bool flag2 = false;

            foreach (var s in b.ConfigErrors(false))
            {
                Log.Error("Backstory Error (" + b.identifier + "): " + s);
                if (!flag2)
                {
                    flag2 = true;
                }
            }
            if (!flag2)
            {
                BackstoryDatabase.allBackstories.Add(b.identifier, b);
            }
        }
コード例 #11
0
        public override void ResolveReferences()
        {
            if (BackstoryDatabase.allBackstories.ContainsKey(this.saveKeyIdentifier))
            {
                Log.Error(this.defName + " contains a saveKeyIdentifier value " + saveKeyIdentifier + " which is used already. It won't be added as a def. Make sure that the identifier is unique.");
                return;
            }

            Backstory backstory = new Backstory();

            if (this.forcedTraits?.Any() ?? false)
            {
                backstory.forcedTraits = new List <TraitEntry>();
                foreach (var trait in this.forcedTraits.Where(x => Rand.RangeInclusive(0, 100) < x.chance))
                {
                    backstory.forcedTraits.Add(new TraitEntry(trait.defName, trait.degree));
                }
            }

            if (this.disallowedTraits?.Any() ?? false)
            {
                backstory.disallowedTraits = new List <TraitEntry>();
                foreach (var trait in this.disallowedTraits.Where(x => Rand.RangeInclusive(0, 100) < x.chance))
                {
                    backstory.disallowedTraits.Add(new TraitEntry(trait.defName, trait.degree));
                }
            }

            backstory.SetTitle(this.title, this.title);
            if (!GenText.NullOrEmpty(this.titleShort))
            {
                backstory.SetTitleShort(this.titleShort, this.titleShort);
            }
            else
            {
                backstory.SetTitleShort(backstory.title, backstory.title);
            }
            if (!GenText.NullOrEmpty(this.baseDescription))
            {
                backstory.baseDesc = this.baseDescription;
            }

            Traverse.Create(backstory).Field("bodyTypeGlobal").SetValue(this.bodyTypeGlobal);
            Traverse.Create(backstory).Field("bodyTypeMale").SetValue(this.bodyTypeMale);
            Traverse.Create(backstory).Field("bodyTypeFemale").SetValue(this.bodyTypeFemale);
            if (skillGains?.Any() ?? false)
            {
                var skillGainsDict = skillGains.ToDictionary(x => x.skill.defName, y => y.minLevel);
                Traverse.Create(backstory).Field("skillGains").SetValue(skillGainsDict);
            }

            backstory.slot            = this.slot;
            backstory.shuffleable     = this.shuffleable;
            backstory.spawnCategories = this.spawnCategories;

            if (this.workDisables.Any())
            {
                foreach (var workTag in this.workDisables)
                {
                    backstory.workDisables |= workTag;
                }
            }
            else
            {
                backstory.workDisables = WorkTags.None;
            }

            backstory.PostLoad();
            backstory.ResolveReferences();
            backstory.identifier = this.saveKeyIdentifier;

            if (!backstory.ConfigErrors(true).Any())
            {
                BackstoryDatabase.AddBackstory(backstory);
            }
            else
            {
                foreach (var err in backstory.ConfigErrors(true))
                {
                    Log.Error(backstory + " - " + err);
                }
            }
        }
コード例 #12
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();
            if (!this.addToDatabase)
            {
                return;
            }
            if (BackstoryDatabase.allBackstories.ContainsKey(this.UniqueSaveKey()))
            {
                Log.Error("Backstory Error (" + this.defName + "): Duplicate defName.");
                return;
            }
            Backstory b = new Backstory();

            if (!string.IsNullOrEmpty(this.title) || !string.IsNullOrEmpty(this.titleFemale))
            {
                b.SetTitle((string.IsNullOrEmpty(this.title) ? this.titleFemale : this.title), (string.IsNullOrEmpty(this.titleFemale) ? this.title : this.titleFemale));
            }
            else
            {
                return;
            }
            if (!string.IsNullOrEmpty(titleShort) || !string.IsNullOrEmpty(titleShortFemale))
            {
                b.SetTitleShort((string.IsNullOrEmpty(this.titleShort) ? this.titleShortFemale : this.titleShort), (string.IsNullOrEmpty(this.titleShortFemale) ? this.titleShort : this.titleShortFemale));
            }
            else
            {
                b.SetTitleShort((string.IsNullOrEmpty(this.title) ? this.titleFemale : this.title), (string.IsNullOrEmpty(this.titleFemale) ? this.title : this.titleFemale));
            }
            if (!baseDesc.NullOrEmpty())
            {
                b.baseDesc = baseDesc;
            }
            else
            {
                b.baseDesc = "Empty.";
            }
            bool bodyTypeSet = false;

            if (!string.IsNullOrEmpty(bodyTypeGlobal))
            {
                bodyTypeSet = SetGlobalBodyType(b, bodyTypeGlobal);
            }
            if (!bodyTypeSet)
            {
                if (!SetMaleBodyType(b, bodyTypeMale))
                {
                    SetMaleBodyType(b, "Male");
                }
                if (!SetFemaleBodyType(b, bodyTypeFemale))
                {
                    SetFemaleBodyType(b, "Female");
                }
            }
            b.slot        = slot;
            b.shuffleable = shuffleable;
            if (spawnCategories.NullOrEmpty())
            {
                return;
            }
            else
            {
                for (int i = 0; i < spawnCategories.Count; i++)
                {
                    if (Util.Categories.Contains(spawnCategories[i]))
                    {
                        spawnCategories[i] = "REB" + spawnCategories[i];
                    }
                }
            }
            b.spawnCategories = spawnCategories;
            if (workAllows.Count > 0)
            {
                foreach (WorkTags current in Enum.GetValues(typeof(WorkTags)))
                {
                    if (!workAllows.Contains(current))
                    {
                        b.workDisables |= current;
                    }
                }
            }
            else if (workDisables.Count > 0)
            {
                foreach (var tag in workDisables)
                {
                    b.workDisables |= tag;
                }
            }
            else
            {
                b.workDisables = WorkTags.None;
            }
            if (requiredWorkTags.Count > 0)
            {
                foreach (var tag in requiredWorkTags)
                {
                    b.requiredWorkTags |= tag;
                }
            }
            else
            {
                b.requiredWorkTags = WorkTags.None;
            }
            Dictionary <SkillDef, int> d = new Dictionary <SkillDef, int>();

            foreach (BackstoryDefSkillListItem i in skillGains)
            {
                SkillDef def = DefDatabase <SkillDef> .GetNamed(i.key, false);

                if (def == null)
                {
                    if (i.key.Equals("Growing"))
                    {
                        Log.Message("Editable Backstories: Converting SkillDef of [" + i.key + "] to [" + SkillDefOf.Plants.ToString() + "] for Backstory.Title [" + b.title + "]");
                        def = SkillDefOf.Plants;
                    }
                    else
                    {
                        Log.Error("Editable Backstories: Unable to find SkillDef of [" + i.key + "] for Backstory.Title [" + b.title + "]");
                    }
                }
                if (def != null)
                {
                    d.Add(def, i.value);
                }
            }
            b.skillGainsResolved = d;
            Dictionary <string, int> fTraitList = forcedTraits.ToDictionary(i => i.key, i => i.value);

            if (fTraitList.Count > 0)
            {
                b.forcedTraits = new List <TraitEntry>();
                foreach (KeyValuePair <string, int> trait in fTraitList)
                {
                    b.forcedTraits.Add(new TraitEntry(TraitDef.Named(trait.Key), trait.Value));
                }
            }
            Dictionary <string, int> dTraitList = disallowedTraits.ToDictionary(i => i.key, i => i.value);

            if (dTraitList.Count > 0)
            {
                b.disallowedTraits = new List <TraitEntry>();
                foreach (KeyValuePair <string, int> trait in dTraitList)
                {
                    b.disallowedTraits.Add(new TraitEntry(TraitDef.Named(trait.Key), trait.Value));
                }
            }
            b.ResolveReferences();
            b.PostLoad();
            b.identifier = this.UniqueSaveKey();
            bool skip = false;

            foreach (var s in b.ConfigErrors(false))
            {
                Log.Error("Backstory Error (" + b.identifier + "): " + s);
                skip = true;
            }
            if (!skip)
            {
                if (b.slot.Equals(BackstorySlot.Adulthood))
                {
                    if (b.shuffleable.Equals(true))
                    {
                        REB_Initializer.adultCount++;
                    }
                    else
                    {
                        REB_Initializer.adultNSCount++;
                    }
                }
                if (b.slot.Equals(BackstorySlot.Childhood))
                {
                    if (b.shuffleable.Equals(true))
                    {
                        REB_Initializer.childCount++;
                    }
                    else
                    {
                        REB_Initializer.childNSCount++;
                    }
                }
                BackstoryDatabase.allBackstories[b.identifier] = b;
            }
        }
コード例 #13
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();


            if (!this.addToDatabase || BackstoryDatabase.allBackstories.ContainsKey(this.defName) || this.title.NullOrEmpty() || this.spawnCategories.NullOrEmpty())
            {
                return;
            }

            Backstory b = new Backstory()
            {
                baseDesc         = this.baseDescription.NullOrEmpty() ? "Empty." : this.baseDescription,
                bodyTypeGlobal   = this.bodyTypeGlobal,
                bodyTypeFemale   = this.bodyTypeFemale,
                bodyTypeMale     = this.bodyTypeMale,
                slot             = this.slot,
                shuffleable      = this.shuffleable,
                spawnCategories  = this.spawnCategories,
                skillGains       = this.skillGains.ToDictionary(i => i.defName, i => i.amount),
                forcedTraits     = this.forcedTraits.NullOrEmpty() ? null : this.forcedTraits.Where(trait => Rand.Range(0, 100) < trait.chance).ToList().ConvertAll(trait => new TraitEntry(TraitDef.Named(trait.defname), trait.degree)),
                disallowedTraits = this.disallowedTraits.NullOrEmpty() ? null : this.disallowedTraits.Where(trait => Rand.Range(0, 100) < trait.chance).ToList().ConvertAll(trait => new TraitEntry(TraitDef.Named(trait.defname), trait.degree)),
                workDisables     = this.workAllows.NullOrEmpty() ? this.workDisables.NullOrEmpty() ? WorkTags.None : ((Func <WorkTags>) delegate
                {
                    WorkTags wt = WorkTags.None;
                    this.workDisables.ForEach(tag => wt |= tag);
                    return(wt);
                })() : ((Func <WorkTags>) delegate
                {
                    WorkTags wt = WorkTags.None;
                    Enum.GetValues(typeof(WorkTags)).Cast <WorkTags>().ToList().ForEach(tag => { if (this.workAllows.Contains(tag))
                                                                                                 {
                                                                                                     wt |= tag;
                                                                                                 }
                                                                                        });
                    return(wt);
                })(),
                identifier = this.defName
            };

            b.SetTitle(this.title);
            if (!this.titleShort.NullOrEmpty())
            {
                b.SetTitleShort(this.titleShort);
            }
            else
            {
                b.SetTitleShort(b.Title);
            }

            b.ResolveReferences();
            b.PostLoad();

            b.identifier = this.defName;

            IEnumerable <string> errors;

            if (!(errors = b.ConfigErrors(false)).Any())
            {
                BackstoryDatabase.AddBackstory(b);
            }
            else
            {
                Log.Error(this.defName + " has errors: " + string.Join("\n", errors.ToArray()));
            }
        }
コード例 #14
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();

            if (!this.addToDatabase)
            {
                return;
            }
            if (BackstoryDatabase.allBackstories.ContainsKey(this.UniqueSaveKey()))
            {
                return;
            }

            Backstory b = new Backstory();

            if (!this.title.NullOrEmpty())
            {
                b.SetTitle(this.title, this.title);
            }
            else
            {
                return;
            }
            if (!titleShort.NullOrEmpty())
            {
                b.SetTitleShort(titleShort, titleShort);
            }
            else
            {
                b.SetTitleShort(b.title, b.title);
            }

            if (!baseDescription.NullOrEmpty())
            {
                b.baseDesc = baseDescription;
            }
            else
            {
                b.baseDesc = "Empty.";
            }

            // [B19] These are now private variables.
            Traverse.Create(b).Field("bodyTypeGlobal").SetValue(bodyTypeGlobal);
            Traverse.Create(b).Field("bodyTypeMale").SetValue(bodyTypeMale);
            Traverse.Create(b).Field("bodyTypeFemale").SetValue(bodyTypeFemale);

            b.slot = slot;

            b.shuffleable = shuffleable;
            if (spawnCategories.NullOrEmpty())
            {
                return;
            }
            else
            {
                b.spawnCategories = spawnCategories;
            }

            if (workAllows.Count > 0)
            {
                foreach (WorkTags current in Enum.GetValues(typeof(WorkTags)))
                {
                    if (!workAllows.Contains(current))
                    {
                        b.workDisables |= current;
                    }
                }
            }
            else if (workDisables.Count > 0)
            {
                foreach (var tag in workDisables)
                {
                    b.workDisables |= tag;
                }
            }
            else
            {
                b.workDisables = WorkTags.None;
            }
            Dictionary <string, int> skGains = skillGains.ToDictionary(i => i.defName, i => i.amount);

            foreach (KeyValuePair <string, int> current in skGains)
            {
                b.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed(current.Key, true), current.Value);
            }

            if (forcedTraits.Count > 0)
            {
                b.forcedTraits = new List <TraitEntry>();
                foreach (var trait in forcedTraits)
                {
                    var newTrait = new TraitEntry(trait.def, trait.degree);
                    b.forcedTraits.Add(newTrait);
                }
            }

            if (disallowedTraits.Count > 0)
            {
                b.disallowedTraits = new List <TraitEntry>();
                foreach (var trait in disallowedTraits)
                {
                    var newTrait = new TraitEntry(trait.def, trait.degree);
                    b.disallowedTraits.Add(newTrait);
                }
            }

            b.ResolveReferences();
            b.PostLoad();
            b.identifier = this.UniqueSaveKey();

            bool flag = false;

            foreach (var s in b.ConfigErrors(false))
            {
                if (!flag)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                BackstoryDatabase.AddBackstory(b);
                //Log.Message("Added " + this.UniqueSaveKey() + " backstory");
                //CCL_Log.Message("Added " + this.UniqueSaveKey() + " backstory", "Backstories");
            }
        }
コード例 #15
0
        public void GetNeoChildStory(ref Backstory _bs, int _index = 0)
        {
            tempBS = new Backstory();
            int i = 0;

            if (_index == 0)
            {
                i = Rand.Range(1, intChildStoriesAmount + 1);
            }
            else
            {
                i = _index;
            }

            try
            {
                switch (i)
                {
                case 1:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Amateur astronomer");
                    tempBS.SetTitleShort("Astronomer");
                    tempBS.baseDesc   = "NAME was fascinated with the stars. HECAP would spend hours gazing at night. HECAP has even made discoveries unkown to most scholars.";
                    tempBS.skillGains = new Dictionary <string, int> {
                        { "Artistic", 1 }, { "Intellectual", 3 }, { "Social", 1 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 2:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Amateur botanist");
                    tempBS.SetTitleShort("Botanist");
                    tempBS.baseDesc   = "Spending many summers crawling through dirt, NAME found he had quite the green thumb. Instead of learning to cook the food HE grew, HE just grew more and more.";
                    tempBS.skillGains = new Dictionary <string, int> {
                        { "Growing", 4 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 3:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Cave child");
                    tempBS.SetTitleShort("Cave child");
                    tempBS.baseDesc   = "NAME grew up in a large and intricate cave complex that extended deep into a mountainside. HECAP helped the adults maintain and improve the deep caves.";
                    tempBS.skillGains = new Dictionary <string, int> {
                        { "Construction", 2 }, { "Mining", 3 }, { "Shooting", -1 }, { "Social", 1 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 4:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Caveworld tender");
                    tempBS.SetTitleShort("Cave kid");
                    tempBS.baseDesc   = "NAME grew up in cave complex deep beneath the surface of an inhospitable world. HECAP worked with the other children tending the tribe’s fungus crops.";
                    tempBS.skillGains = new Dictionary <string, int> {
                        { "Construction", 2 }, { "Mining", 3 }, { "Shooting", -1 }, { "Social", 1 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 5:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Disaster survivor");
                    tempBS.SetTitleShort("Survivor");
                    tempBS.baseDesc   = "NAME was uprooted when marauders attacked HIS family farm, destroying machinery and killing farmhands and beasts alike. After the death of all HE knew, HE was left in the ruins to fend for HIMself.";
                    tempBS.skillGains = new Dictionary <string, int> {
                        { "Crafting", 2 }, { "Growing", 2 }, { "Melee", 2 }, { "Shooting", 1 }, { "Social", -1 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 6:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Feral child");
                    tempBS.SetTitleShort("Feral");
                    tempBS.baseDesc   = "Abandoned in the wilderness as a small child with nought but a blanket with a name embroidered on it, NAME made HIMself one with the wild. When HE was 13, HE encountered a group of hunters, who \"offered\" HIM a home.";
                    tempBS.skillGains = new Dictionary <string, int> {
                        { "Animals", 3 }, { "Melee", 3 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 7:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Fire keeper");
                    tempBS.SetTitleShort("Firekeep");
                    tempBS.baseDesc   = "NAME was responsible for keeping the tribe’s fire going. HECAP took this responsibility very seriously.";
                    tempBS.skillGains = new Dictionary <string, int> {
                        { "Construction", 1 }, { "Cooking", 2 }, { "Crafting", 2 }, { "Growing", -1 }, { "Intellectual", 2 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 8:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Fire-scarred child");
                    tempBS.SetTitleShort("Scarred");
                    tempBS.baseDesc     = "NAMED was an active child who lived an uneventful childhood until HE fell into a fire and suffered horrific burns to HIS hands and arms. Although the scars have faded, HE can't bear to be in close proximity to fire.";
                    tempBS.workDisables = WorkTags.Firefighting;
                    tempBS.skillGains   = new Dictionary <string, int> {
                        { "Artistic", 3 }, { "Growing", 2 }, { "Melee", 1 }, { "Mining", 2 }, { "Social", -1 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 9:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Frightened child");
                    tempBS.SetTitleShort("Scared");
                    tempBS.baseDesc     = "NAME grew up with a laundry list of phobias and neuroses. HECAP feared, among other things, doctors and foodborne pathogens. As a result, HE learned to cook and care for HIMself, but many of HIS fears dog HIM in adulthood.";
                    tempBS.workDisables = WorkTags.Violent;
                    tempBS.skillGains   = new Dictionary <string, int> {
                        { "Animals", -1 }, { "Construction", 1 }, { "Cooking", 3 }, { "Crafting", 1 }, { "Growing", 1 }, { "Medicine", 3 }, { "Intellectual", -1 }, { "Social", -2 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 10:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Herder");
                    tempBS.SetTitleShort("Herder");
                    tempBS.baseDesc   = "As a child, NAME tended the tribe’s muffalo herds, keeping them safe from predators and treating the sick. It was quiet work, but HE enjoyed being away from people.";
                    tempBS.skillGains = new Dictionary <string, int> {
                        { "Animals", 3 }, { "Medicine", 2 }, { "Melee", 2 }, { "Social", -2 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 11:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Tundra child");
                    tempBS.SetTitleShort("Ice child");
                    tempBS.baseDesc   = "Growing up on the frozen wastes of the far North, NAME only had animals and a few hard-bitten sailors as companions. The lack of social interaction made HIM develop a interest in engineering - but HE never developed any great fondness for humans.";
                    tempBS.skillGains = new Dictionary <string, int> {
                        { "Animals", 2 }, { "Construction", 2 }, { "Crafting", 2 }, { "Growing", -4 }, { "Melee", 2 }, { "Intellectual", 1 }, { "Social", -4 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                case 12:
                    tempBS.slot = BackstorySlot.Childhood;
                    tempBS.SetTitle("Hunting child");
                    tempBS.SetTitleShort("Hunter");
                    tempBS.baseDesc   = "NAME had an great understanding of the sling and bow. HECAP spent hours almost everyday perfecting HIS shot. HECAP wanted to be the best hunter that ever lived.";
                    tempBS.skillGains = new Dictionary <string, int> {
                        { "Animals", 1 }, { "Crafting", 2 }, { "Shooting", 3 }
                    };
                    tempBS.spawnCategories = new List <string>(new string[] { "New_Arrival", "Tribal" });
                    tempBS.bodyTypeMale    = BodyType.Male;
                    tempBS.bodyTypeFemale  = BodyType.Female;
                    break;

                default:
                    Log.Message("ProBackstories.GetNeoChildStory failed switch.");
                    break;
                }
            }
            catch (Exception e)
            {
                Log.Message(e.TargetSite.Name + " \n" + e.Message);
            }


            tempBS.PostLoad();
            tempBS.ResolveReferences();

            _bs = tempBS;
        }
コード例 #16
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();

            if (!this.addToDatabase)
            {
                return;
            }
            if (BackstoryDatabase.allBackstories.ContainsKey(this.UniqueSaveKey()))
            {
                return;
            }

            Backstory b = new Backstory();

            if (!this.title.NullOrEmpty())
            {
                b.SetTitle(this.title);
            }
            else
            {
                return;
            }
            if (!titleShort.NullOrEmpty())
            {
                b.SetTitleShort(titleShort);
            }
            else
            {
                b.SetTitleShort(b.Title);
            }

            if (!baseDescription.NullOrEmpty())
            {
                b.baseDesc = baseDescription;
            }
            else
            {
                b.baseDesc = "Empty.";
            }

            b.bodyTypeGlobal = bodyTypeGlobal;
            b.bodyTypeMale   = bodyTypeMale;
            b.bodyTypeFemale = bodyTypeFemale;

            b.slot = slot;

            b.shuffleable = shuffleable;
            if (spawnCategories.NullOrEmpty())
            {
                return;
            }
            else
            {
                b.spawnCategories = spawnCategories;
            }

            if (workAllows.Count > 0)
            {
                foreach (WorkTags current in Enum.GetValues(typeof(WorkTags)))
                {
                    if (!workAllows.Contains(current))
                    {
                        b.workDisables |= current;
                    }
                }
            }
            else if (workDisables.Count > 0)
            {
                foreach (var tag in workDisables)
                {
                    b.workDisables |= tag;
                }
            }
            else
            {
                b.workDisables = WorkTags.None;
            }
            b.skillGains = skillGains.ToDictionary(i => i.defName, i => i.amount);

            if (forcedTraits.Count > 0)
            {
                b.forcedTraits = new List <TraitEntry>();
                foreach (var trait in forcedTraits)
                {
                    var newTrait = new TraitEntry(trait.def, trait.degree);
                    b.forcedTraits.Add(newTrait);
                }
            }

            if (disallowedTraits.Count > 0)
            {
                b.disallowedTraits = new List <TraitEntry>();
                foreach (var trait in disallowedTraits)
                {
                    var newTrait = new TraitEntry(trait.def, trait.degree);
                    b.disallowedTraits.Add(newTrait);
                }
            }

            b.ResolveReferences();
            b.PostLoad();

            bool flag = false;

            foreach (var s in b.ConfigErrors(false))
            {
                if (!flag)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                BackstoryDatabase.AddBackstory(b);
                //CCL_Log.Message("Added " + this.UniqueSaveKey() + " backstory", "Backstories");
            }
        }
コード例 #17
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();
            if (!this.addToDatabase)
            {
                return;
            }
            if (BackstoryDatabase.allBackstories.ContainsKey(this.saveKeyIdentifier))
            {
                return;
            }
            Backstory backstory = new Backstory();

            if (GenText.NullOrEmpty(this.title))
            {
                return;
            }
            backstory.SetTitle(this.title, this.title);
            if (!GenText.NullOrEmpty(this.titleShort))
            {
                backstory.SetTitleShort(this.titleShort, this.titleShort);
            }
            else
            {
                backstory.SetTitleShort(backstory.title, backstory.title);
            }
            if (!GenText.NullOrEmpty(this.baseDescription))
            {
                backstory.baseDesc = this.baseDescription;
            }
            else
            {
                backstory.baseDesc = "Empty.";
            }
            Traverse.Create(backstory).Field("bodyTypeGlobal").SetValue(this.bodyTypeGlobal);
            Traverse.Create(backstory).Field("bodyTypeMale").SetValue(this.bodyTypeMale);
            Traverse.Create(backstory).Field("bodyTypeFemale").SetValue(this.bodyTypeFemale);
            backstory.slot        = this.slot;
            backstory.shuffleable = this.shuffleable;
            if (GenList.NullOrEmpty <string>(this.spawnCategories))
            {
                return;
            }
            backstory.spawnCategories = this.spawnCategories;
            if (this.workDisables.Count > 0)
            {
                using (List <WorkTags> .Enumerator enumerator2 = this.workDisables.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        WorkTags workTags2 = enumerator2.Current;
                        backstory.workDisables |= workTags2;
                    }
                    goto IL_1E9;
                }
            }
            backstory.workDisables = 0;
IL_1E9:
            backstory.ResolveReferences();
            backstory.PostLoad();
            backstory.identifier = this.saveKeyIdentifier;
            bool flag = false;

            foreach (string text in backstory.ConfigErrors(false))
            {
                if (!flag)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                BackstoryDatabase.AddBackstory(backstory);
            }
        }
コード例 #18
0
ファイル: nymph_backstories.cs プロジェクト: deanec64/RJW
        public static void init()
        {
            {
                Backstory bs = new Backstory();
                bs.identifier = "";                 // identifier will be set by ResolveReferences
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_vatgrown_sex_slave");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Vat-Grown Sex Slave");
                    bs.SetTitleShort("SexSlave");
                    bs.baseDesc = "NAME is made as a sex machine, rather than a human.During HIS growing period in the factory, HE was taught plenty of social skills and sex skills, just to satisfy various sex demands.";
                }
                // bs.skillGains = new Dictionary<string, int> ();
                bs.skillGains.Add("Social", 8);
                // bs.skillGainsResolved = new Dictionary<SkillDef, int> (); // populated by ResolveReferences
                bs.workDisables     = WorkTags.Intellectual;
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Childhood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                child.vatgrown_sex_slave = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed0");
            }
            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_feisty");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Feisty Nymph");
                    bs.SetTitleShort("Nymph");
                    bs.baseDesc = "NAME struts around the colony like a conqueror examining a newly annexed territory. You try to focus on your work but HE won't let you.\n" + "\"I heard what you said about me!\" HE accuses. You didn't say anything about HIM. HECAP knows that. " + "\"Wanna fight?\" HE challenges. You already know what HE means: a few minutes of play wrestling and then you take HIM, or, if you hesitate, HE takes you.\n" + "Though NAME can be hard to get along with you've come to appreciate how HE's more practical than the others.\n" + "You explain to HIM, \"See these things here? They need to be over there\" and \"Those people are trying to kill us, so let's kill them first.\" HECAP listens, and does what is necessary.";
                }
                bs.skillGains.Add("Social", -3);
                bs.skillGains.Add("Shooting", 4);
                bs.skillGains.Add("Melee", 6);
                bs.workDisables     = (WorkTags.Cleaning | WorkTags.Animals | WorkTags.Caring | WorkTags.Artistic | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.feisty = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed1");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_curious");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Curious Nymph");
                    bs.SetTitleShort("Nymph");
                    bs.baseDesc = "Hold the covering plate back and place the actuator in slot C. Line the rod up. No, that won't do, it needs to be perfect. Now pop the JC-444 chip in place. \n" + "Solder the orange wire to pin #16 and the striped wire to pin #5. \n" + "Suddenly, there HE is. You aren't surprised to see NAME, you just didn't hear HIM approach. By now you're used to it. \n" + "You continue your work in silence as HE hovers over you, her large eyes fixated on the rapid, rythmic, deliberate motions of your hands.";
                }
                bs.skillGains.Add("Construction", 2);
                bs.skillGains.Add("Crafting", 6);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Artistic | WorkTags.Caring | WorkTags.Cooking | WorkTags.Mining | WorkTags.PlantWork | WorkTags.Violent | WorkTags.ManualDumb);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.curious = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed2");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_tender");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Tender Nymph");
                    bs.SetTitleShort("Nymph");
                    bs.baseDesc = "NAME has a pair of charming eyes, and HIS voice is soft and sweet. Due to HIS previous nurse job, HE tends people quite well.\n" + "HE's crouched in the corner, hands over HIS ears and tears in HIS eyes." + "You don't understand, then you notice it: the distant sound of the pained squeals of pigs being slaughtered.";
                }
                bs.skillGains.Add("Medicine", 4);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Artistic | WorkTags.Hauling | WorkTags.Violent | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.tender = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed3");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_chatty");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Chatty Nymph");
                    bs.SetTitleShort("Nymph");
                    bs.baseDesc = "No one can be more loquacious than NAME. HECAP has a flexible tongue, a sharp mind, and hot lips.";
                }
                bs.skillGains.Add("Social", 6);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Caring | WorkTags.Artistic | WorkTags.Violent | WorkTags.ManualDumb | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.chatty = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed4");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_broken");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Broken Nymph");
                    bs.SetTitleShort("Nymph");
                    bs.baseDesc = "Maybe NAME suffered some terrible things, HE looks rather emaciated, and no one wants to speak with HIM.\n" + "HECAP only behaves a bit vivaciously while staring at some rod-like stuffs.";
                }
                bs.skillGains.Add("Social", -5);
                bs.skillGains.Add("Artistic", 8);
                bs.workDisables     = (WorkTags.Cleaning | WorkTags.Animals | WorkTags.Caring | WorkTags.Violent | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.broken = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed5");
            }
        }