Exemple #1
0
        public static SimDescription MakeAlienBaby(SimDescription alien, SimDescription abductee, CASAgeGenderFlags gender, float averageMood, Random pregoRandom, bool interactive)
        {
            SimDescription baby = MakeAlien(CASAgeGenderFlags.Baby, gender, GameUtils.GetCurrentWorld(), 1f, interactive);

            if (baby != null)
            {
                if (interactive)
                {
                    baby.FirstName = string.Empty;
                }

                baby.LastName = alien.LastName;
                Genetics.AssignTraits(baby, alien, abductee, interactive, averageMood, pregoRandom);
                baby.TraitManager.AddHiddenElement(BuffsAndTraits.sAlienChild);

                if (Abductor.Settings.mFutureSim)
                {
                    baby.TraitManager.AddHiddenElement(TraitNames.FutureSim);
                }

                baby.CelebrityManager.SetBabyLevel(Genetics.AssignBabyCelebrityLevel(null, abductee));
                abductee.Genealogy.AddChild(baby.Genealogy);

                if (alien != null)
                {
                    alien.Genealogy.AddChild(baby.Genealogy);
                }

                /* WISHLIST-------------------------------------------------------------------------------------- */
                // Link to NRaasHybrid to allow alien children to inherit one or more occult types from abductee.
                /* ---------------------------------------------------------------------------------------------- */
            }

            return(baby);
        }
Exemple #2
0
        public static SimDescription MakeDescendant(SimDescription dad, SimDescription mom, SimDescription robotDad, SimDescription robotMom,
                                                    CASAgeGenderFlags age, CASAgeGenderFlags gender, float averageMood, Random pregoRandom, bool interactive, bool updateGenealogy,
                                                    bool setName, WorldName homeWorld, bool plantSimBaby, Pregnancy.BabyCustomizeData customizeData)
        {
            if (robotDad == null && robotMom == null)
            {
                Common.DebugNotify("CommonSurrogatePregnancy.MakeDescendant" + Common.NewLine + " - Fail: Robot Parnets Null");
                return(null);
            }

            SimBuilder simBuilder = new SimBuilder();

            simBuilder.Age            = age;
            simBuilder.Gender         = gender;
            simBuilder.Species        = CASAgeGenderFlags.Human;
            simBuilder.TextureSize    = 1024u;
            simBuilder.UseCompression = true;
            List <SimDescription> list = new List <SimDescription>();

            if (mom != null)
            {
                list.Add(mom);
            }

            if (dad != null)
            {
                list.Add(dad);
            }

            float alienDNAPercentage = SimDescription.GetAlienDNAPercentage(dad, mom, true);

            SimDescription[] array = list.ToArray();
            bool             flag  = alienDNAPercentage >= SimDescription.kMinAlienDNAPercentToBeAlien;

            if (plantSimBaby)
            {
                float skinToneIndex = OccultPlantSim.kBaseGreenSkinIndex + RandomUtil.GetFloat(1f - OccultPlantSim.kBaseGreenSkinIndex);
                simBuilder.SkinTone      = new ResourceKey(2751605866008866797uL, 55867754u, 0u);
                simBuilder.SkinToneIndex = skinToneIndex;
            }
            else
            {
                Genetics.InheritSkinColor(simBuilder, array, pregoRandom, homeWorld);
            }

            if (customizeData.IsBabyCustomized)
            {
                CASPart mPart = customizeData.EyeColorPreset.mPart;

                if (simBuilder.AddPart(mPart))
                {
                    string mPresetString = customizeData.EyeColorPreset.mPresetString;

                    if (!string.IsNullOrEmpty(mPresetString))
                    {
                        OutfitUtils.ApplyPresetStringToPart(simBuilder, mPart, mPresetString);
                    }
                }
            }
            else
            {
                Genetics.InheritEyeColor(simBuilder, array, pregoRandom);
            }

            Genetics.InheritFacialBlends(simBuilder, array, pregoRandom);
            ResourceKey geneticHairstyleKey = Genetics.InheritHairStyle(gender, dad, mom, pregoRandom, flag);

            Genetics.InheritBodyShape(simBuilder, array, pregoRandom);
            bool  flag2 = pregoRandom.Next(0, 2) == 0;
            float num   = (float)pregoRandom.NextDouble() * 100f;

            Color[] array2;

            if (customizeData.IsBabyCustomized)
            {
                array2 = new Color[10];

                for (int i = 0; i < 4; i++)
                {
                    array2[i]     = customizeData.HairColor[i];
                    array2[i + 5] = customizeData.HairColor[i];
                }

                array2[4] = customizeData.HairColor[0];
                array2[9] = customizeData.HairColor[0];
            }
            else if (age == CASAgeGenderFlags.Elder)
            {
                array2 = Genetics.GetRandomElderHairColor();
            }
            else
            {
                array2 = Genetics.InheritHairColor(simBuilder, array, pregoRandom);
            }

            SimDescription baby = Genetics.MakeSim(simBuilder, CASAgeGenderFlags.Baby, gender, simBuilder.SkinTone, simBuilder.SkinToneIndex, array2, homeWorld, 4294967295u, false);

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

            baby.SetAlienDNAPercentage(alienDNAPercentage);
            baby.GeneticHairstyleKey = geneticHairstyleKey;
            bool flag3 = false;

            if (num < Genetics.kInheritMomHiddenBodyHairStyleChance)
            {
                flag3 |= Genetics.InheritBodyHairstyle(baby, mom);
            }

            if (!flag3 || num < Genetics.kInheritDadBodyHairStyleChance + Genetics.kInheritMomHiddenBodyHairStyleChance)
            {
                Genetics.InheritBodyHairstyle(baby, dad);
            }

            if (customizeData.IsBabyCustomized)
            {
                Genetics.TraitOutcome traitOutcome = Genetics.AssignTraits(baby, dad, mom, false, averageMood, pregoRandom);
                List <TraitNames>     list2        = new List <TraitNames>();
                List <Trait>          list3        = new List <Trait>();

                foreach (Trait current in baby.TraitManager.List)
                {
                    if (!current.IsVisible)
                    {
                        list3.Add(current);
                    }
                }

                baby.TraitManager.RemoveAllElements();

                if (customizeData.CurrentTraits != null)
                {
                    foreach (ITraitEntryInfo current2 in customizeData.CurrentTraits)
                    {
                        baby.TraitManager.AddElement((TraitNames)current2.TraitGuid);
                    }

                    if (customizeData.CurrentTraits.Count != 2)
                    {
                        baby.TraitManager.AddRandomTrait(2 - customizeData.CurrentTraits.Count);
                    }

                    foreach (Trait current3 in list3)
                    {
                        baby.TraitManager.AddHiddenElement((TraitNames)current3.TraitGuid);
                    }
                }

                foreach (Trait current4 in baby.TraitManager.List)
                {
                    if (current4.IsVisible)
                    {
                        list2.Add((TraitNames)current4.TraitGuid);
                    }
                }

                if (interactive)
                {
                    bool   isFemale   = baby.IsFemale;
                    string titleText  = Localization.LocalizeString(baby.IsFemale, "Gameplay/CAS/Genetics:MakeBabyTitle", new object[0]);
                    string promptText = null;

                    switch (traitOutcome)
                    {
                    case Genetics.TraitOutcome.Horrible:
                    {
                        string entryKey = "Gameplay/CAS/Genetics:MakeBabyDescTwoTraitsHorrible";
                        promptText = Localization.LocalizeString(baby.IsFemale, entryKey, new object[]
                            {
                                robotMom == null ? mom : robotMom,
                                baby.TraitManager.GetElement((ulong)list2[0]).TraitName(baby.IsFemale),
                                baby.TraitManager.GetElement((ulong)list2[1]).TraitName(baby.IsFemale)
                            });
                        break;
                    }

                    case Genetics.TraitOutcome.Bad:
                    {
                        string entryKey = "Gameplay/CAS/Genetics:MakeBabyDescTwoTraitsBad";
                        promptText = Localization.LocalizeString(baby.IsFemale, entryKey, new object[]
                            {
                                robotMom == null ? mom : robotMom,
                                baby.TraitManager.GetElement((ulong)list2[0]).TraitName(baby.IsFemale),
                                baby.TraitManager.GetElement((ulong)list2[1]).TraitName(baby.IsFemale)
                            });
                        break;
                    }

                    case Genetics.TraitOutcome.Average:
                    {
                        string entryKey = "Gameplay/CAS/Genetics:MakeBabyDescTwoTraits";
                        promptText = Localization.LocalizeString(baby.IsFemale, entryKey, new object[]
                            {
                                robotMom == null ? mom : robotMom,
                                baby.TraitManager.GetElement((ulong)list2[0]).TraitName(baby.IsFemale),
                                baby.TraitManager.GetElement((ulong)list2[1]).TraitName(baby.IsFemale)
                            });
                        break;
                    }

                    case Genetics.TraitOutcome.Good:
                    {
                        string entryKey = "Gameplay/CAS/Genetics:MakeBabyDescOneTraits";
                        promptText = Localization.LocalizeString(baby.IsFemale, entryKey, new object[]
                            {
                                robotMom == null ? mom : robotMom,
                                baby.TraitManager.GetElement((ulong)list2[0]).TraitName(baby.IsFemale)
                            });
                        break;
                    }

                    case Genetics.TraitOutcome.Excellent:
                    {
                        string entryKey = "Gameplay/CAS/Genetics:MakeBabyDesc";
                        promptText = Localization.LocalizeString(baby.IsFemale, entryKey, new object[]
                            {
                                robotMom == null ? mom : robotMom,
                            });
                        break;
                    }
                    }

                    while (string.IsNullOrEmpty(baby.FirstName))
                    {
                        baby.FirstName = StringInputDialog.Show(titleText, promptText, "", CASBasics.GetMaxNameLength(), StringInputDialog.Validation.SimNameText);
                    }
                }
            }
            else
            {
                Genetics.AssignTraits(baby, dad, mom, interactive, averageMood, pregoRandom);
            }

            if (setName)
            {
                baby.LastName = array[0].LastName;

                if (!interactive)
                {
                    baby.FirstName = SimUtils.GetRandomGivenName(baby.IsMale, homeWorld);
                }
            }

            baby.CelebrityManager.SetBabyLevel(Genetics.AssignBabyCelebrityLevel(dad, mom));

            if (updateGenealogy)
            {
                if (robotDad != null && robotMom == null)
                {
                    if (robotDad.Genealogy != null)
                    {
                        robotDad.Genealogy.AddChild(baby.Genealogy);
                    }

                    if (mom != null && mom.Genealogy != null)
                    {
                        mom.Genealogy.AddChild(baby.Genealogy);
                    }
                }
                else if (robotMom != null && robotDad == null)
                {
                    if (robotMom.Genealogy != null)
                    {
                        robotMom.Genealogy.AddChild(baby.Genealogy);
                    }

                    if (dad != null && dad.Genealogy != null)
                    {
                        dad.Genealogy.AddChild(baby.Genealogy);
                    }
                }
                else
                {
                    if (robotDad.Genealogy != null)
                    {
                        robotDad.Genealogy.AddChild(baby.Genealogy);
                    }

                    if (robotMom.Genealogy != null)
                    {
                        robotMom.Genealogy.AddChild(baby.Genealogy);
                    }
                }
            }

            OccultTypes occultTypes = OccultTypes.None;

            if (flag2)
            {
                if (mom != null)
                {
                    CASSupernaturalData supernaturalData = mom.SupernaturalData;

                    if (supernaturalData != null)
                    {
                        occultTypes = supernaturalData.OccultType;
                    }
                }
            }
            else if (dad != null)
            {
                CASSupernaturalData supernaturalData2 = dad.SupernaturalData;

                if (supernaturalData2 != null)
                {
                    occultTypes = supernaturalData2.OccultType;
                }
            }

            if (plantSimBaby)
            {
                occultTypes = OccultTypes.PlantSim;
            }

            if (!OccultManager.DoesOccultTransferToOffspring(occultTypes))
            {
                occultTypes = OccultTypes.None;
            }

            if (RandomUtil.CoinFlip())
            {
                if (occultTypes == OccultTypes.Fairy)
                {
                    baby.AddSupernaturalData(OccultTypes.Fairy);
                    CASFairyData fairyData = baby.SupernaturalData as CASFairyData;

                    if (fairyData != null)
                    {
                        Vector3   wingColor;
                        WingTypes wingType;
                        Genetics.InheritWings(baby, mom, dad, pregoRandom, out wingColor, out wingType);
                        fairyData.WingType  = wingType;
                        fairyData.WingColor = wingColor;
                    }
                }

                if (occultTypes != OccultTypes.None)
                {
                    baby.OccultManager.AddOccultType(occultTypes, false, false, false);
                }
            }

            return(baby);
        }
Exemple #3
0
        public static SimDescription MakeAlienBaby(SimDescription alien, SimDescription abductee, CASAgeGenderFlags gender, float averageMood, Random pregoRandom, bool interactive)
        {
            SimBuilder sb = new SimBuilder();

            sb.Age            = CASAgeGenderFlags.Baby;
            sb.Gender         = gender;
            sb.Species        = CASAgeGenderFlags.Human;
            sb.SkinTone       = alien.SkinToneKey;
            sb.SkinToneIndex  = alien.SkinToneIndex;
            sb.TextureSize    = 1024u;
            sb.UseCompression = true;
            ApplyAlienFaceBlend(gender, ref sb);
            float hue = (sb.SkinToneIndex + 0.5f) % 1f;

            Color[] colors = new Color[]
            {
                HSLToRGB(hue, 0.71f, 0.5f),
                HSLToRGB(hue, 0.72f, 0.5f),
                HSLToRGB(hue, 0.73f, 0.5f),
                HSLToRGB(hue, 0.74f, 0.5f),
                HSLToRGB(hue, 0.75f, 0.5f),
                HSLToRGB(hue, 0.76f, 0.5f),
                HSLToRGB(hue, 0.77f, 0.5f),
                HSLToRGB(hue, 0.78f, 0.5f),
                HSLToRGB(hue, 0.79f, 0.5f),
                HSLToRGB(hue, 0.80f, 0.5f)
            };
            SimDescription baby = Genetics.MakeSim(sb, CASAgeGenderFlags.Baby, gender, alien.SkinToneKey, alien.SkinToneIndex, colors,
                                                   GameUtils.GetCurrentWorld(), 4294967295u, true);

            if (baby != null)
            {
                if (interactive)
                {
                    baby.FirstName = string.Empty;
                }
                else
                {
                    baby.FirstName = SimUtils.GetRandomAlienGivenName(baby.IsMale);
                }

                baby.LastName = abductee.LastName;
                Genetics.AssignTraits(baby, null, abductee, interactive, averageMood, pregoRandom);

                if (Aliens.Settings.mFutureSim)
                {
                    baby.TraitManager.AddHiddenElement(TraitNames.FutureSim);
                }

                if (Aliens.Settings.mAllowOccultBabies)
                {
                    List <OccultTypes> toInherit = OccultsToInherit(OccultTypeHelper.CreateList(abductee), OccultTypeHelper.CreateList(alien));

                    if (toInherit != null && toInherit.Count > 0)
                    {
                        for (int i = 0; i < toInherit.Count; i++)
                        {
                            if (toInherit[i] != OccultTypes.Ghost)
                            {
                                OccultTypeHelper.Add(baby, toInherit[i], false, false);
                            }
                            else
                            {
                                SimDescription.DeathType deathType = GetGhostBabyType(abductee, alien);
                                Urnstones.SimToPlayableGhost(baby, deathType);
                            }
                        }

                        if (OccultTypeHelper.HasType(baby, OccultTypes.Fairy))
                        {
                            CASFairyData casFairyData = baby.SupernaturalData as CASFairyData;

                            if (casFairyData != null)
                            {
                                Vector3   wingColor;
                                WingTypes wingType;
                                Genetics.InheritWings(baby, abductee, alien, pregoRandom, out wingColor, out wingType);
                                casFairyData.WingType  = wingType;
                                casFairyData.WingColor = wingColor;
                            }
                        }
                    }
                    else if (RandomUtil.RandomChance01(abductee.Pregnancy.mChanceOfRandomOccultMutation))
                    {
                        OccultTypeHelper.Add(baby, Pregnancy.ChooseARandomOccultMutation(), false, false);
                    }
                }

                baby.CelebrityManager.SetBabyLevel(Genetics.AssignBabyCelebrityLevel(null, abductee));
                abductee.Genealogy.AddChild(baby.Genealogy);

                if (alien != null)
                {
                    alien.Genealogy.AddChild(baby.Genealogy);
                }
            }

            return(baby);
        }