Пример #1
0
 public bool TestCooldown(Common.IStatGenerator stats, SimDescription sim)
 {
     if (sim.Partner == null)
     {
         stats.IncStat("No Partner");
         return(false);
     }
     else if (stats.AddScoring("Pregnancy Cooldown", TestElapsedTime <DayOfLastRomanceOption, ExpectedPregnancyScenario.MinTimeFromRomanceToPregnancyOption>(sim)) < 0)
     {
         stats.AddStat("Too Soon After Romance", GetElapsedTime <DayOfLastRomanceOption>(sim));
         return(false);
     }
     else if (stats.AddScoring("Pregnancy Cooldown", TestElapsedTime <DayOfLastRomanceOption, ExpectedPregnancyScenario.MinTimeFromRomanceToPregnancyOption>(sim.Partner)) < 0)
     {
         stats.AddStat("Too Soon After Romance", GetElapsedTime <DayOfLastRomanceOption>(sim.Partner));
         return(false);
     }
     else if (stats.AddScoring("New Baby Cooldown", TestElapsedTime <DayOfLastBabyOption, ExpectedPregnancyScenario.MinTimeFromBabyToPregnancyOption>(sim)) < 0)
     {
         stats.AddStat("Too Soon After Baby", GetElapsedTime <DayOfLastBabyOption>(sim));
         return(false);
     }
     else if (stats.AddScoring("New Baby Cooldown", TestElapsedTime <DayOfLastBabyOption, ExpectedPregnancyScenario.MinTimeFromBabyToPregnancyOption>(sim.Partner)) < 0)
     {
         stats.AddStat("Too Soon After Baby", GetElapsedTime <DayOfLastBabyOption>(sim.Partner));
         return(false);
     }
     return(true);
 }
Пример #2
0
        public static int AddStat(string stat, int val)
        {
            if (sStats == null)
            {
                return(val);
            }

            return(sStats.AddStat(stat, val));
        }
Пример #3
0
            public int AddStat(string stat, int val)
            {
                if (!Common.kDebugging)
                {
                    return(val);
                }

                return(mStats.AddStat(mName + " " + stat, val));
            }
Пример #4
0
        public BuyProductList(Common.IStatGenerator stats, BuildBuyProduct.eBuyCategory buyCategory, BuildBuyProduct.eBuySubCategory buySubCategory, int minimumPrice, int maximumPrice)
        {
            List <object> products = UserToolUtils.GetObjectProductListFiltered((uint)buyCategory, uint.MaxValue, (ulong)buySubCategory, ulong.MaxValue, ulong.MaxValue, 0x0, uint.MaxValue, 0x0, 0x0);

            stats.IncStat("BuyProduct " + buyCategory);
            stats.IncStat("BuyProduct " + buySubCategory);

            stats.AddStat("BuyProduct Possibles", products.Count);

            foreach (object obj in products)
            {
                BuildBuyProduct product = obj as BuildBuyProduct;
                if (product == null)
                {
                    continue;
                }

                if (!product.ShowInCatalog)
                {
                    continue;
                }

                if (product.Price < minimumPrice)
                {
                    continue;
                }

                if (product.Price > maximumPrice)
                {
                    continue;
                }

                // 319e4f1d:00000000:00000000000f5f40
                if (product.ObjectInstanceName == "RCcart")
                {
                    continue;
                }

                // 319e4f1d:00000000:00000000000f5e5a
                if (product.ProductResourceKey != ResourceKey.kInvalidResourceKey && product.ProductResourceKey.ToString() == "319e4f1d:00000000:00000000000f5e5a")
                {
                    continue;
                }

                // Common.WriteLog("Product: " + product.CatalogName + " ResKey: " + product.ProductResourceKey + " Instance: " + product.ObjectInstanceName);

                mProducts.Add(product);
            }

            stats.AddStat("BuyProduct Results", mProducts.Count);
        }
Пример #5
0
        public bool RandomChanceOfAttempt(Common.IStatGenerator stats, float baseChance)
        {
            stats.AddStat("Base Chance", baseChance);

            baseChance += (Sims.GetDepopulationDanger(false) * 10);
            if (Households.FamiliesPacked && (Lots.FreeLotRatio < 0.2f))
            {
                baseChance /= 3f;
            }

            stats.AddStat("Adjusted Chance", baseChance);

            return(RandomUtil.RandomChance(baseChance));
        }
Пример #6
0
        public bool Adjust(Common.IStatGenerator manager, SkillNames skillName)
        {
            if (mSkillLevels == null)
            {
                return(false);
            }

            Skill skill = Sim.SkillManager.GetElement(skillName);

            if (skill != null)
            {
                int   origLevel  = 0;
                float origPoints = 0;

                if (mSkillLevels.ContainsKey(skill.Guid))
                {
                    origLevel  = mSkillLevels[skill.Guid].First;
                    origPoints = mSkillLevels[skill.Guid].Second;
                }

                int change = skill.SkillLevel - origLevel;
                if (change > 0)
                {
                    manager.AddStat("Lowered: " + skill.Guid, change);

                    skill.SkillLevel  = origLevel;
                    skill.SkillPoints = origPoints;

                    skill.UpdateProgress();
                }
            }

            return(true);
        }
Пример #7
0
        protected static void AlterSkinBlend(Common.IStatGenerator stats, SimDescription sim, List <SimDescription> immediateParents)
        {
            List <SimDescription> choices = new List <SimDescription>(immediateParents);

            foreach (SimDescription parent in immediateParents)
            {
                if (parent.IsAlien)
                {
                    return;
                }

                foreach (SimDescription grand in Relationships.GetParents(parent))
                {
                    if (!grand.IsAlien)
                    {
                        choices.Add(grand);
                    }
                }
            }

            stats.AddStat("Blend Choices", choices.Count);

            if (choices.Count >= 2)
            {
                sim.SkinToneKey = FixInvisibleTask.ValidateSkinTone(RandomUtil.GetRandomObjectFromList(choices).SkinToneKey);

                RandomUtil.RandomizeListOfObjects(choices);

                float num4 = choices[0].SkinToneIndex;
                float num5 = choices[1].SkinToneIndex;
                if (num4 > num5)
                {
                    float num6 = num5;
                    num5 = num4;
                    num4 = num6;
                }
                float num8 = num5 - num4;

                float newIndex = 0;

                float num7 = RandomUtil.GetFloat(Sims3.Gameplay.CAS.Genetics.kSkinColorMaxPercentTravel / 100f);
                if (RandomUtil.CoinFlip())
                {
                    newIndex = num4 + (num8 * num7);
                }
                else
                {
                    newIndex = num5 - (num8 * num7);
                }

                sim.SkinToneIndex = newIndex;
            }
        }
Пример #8
0
        public T Get <T>(Common.IStatGenerator stats, string name, TestDelegate <T> test, out int price)
            where T : class
        {
            List <BuildBuyProduct> choices = new List <BuildBuyProduct>(mProducts);

            RandomUtil.RandomizeListOfObjects(choices);

            stats.AddStat(name + " Total", choices.Count);

            foreach (BuildBuyProduct choice in choices)
            {
                ResourceKey key = choice.ProductResourceKey;

                Hashtable overrides = new Hashtable(0x1);

                IGameObject obj = null;

                try
                {
                    obj = GlobalFunctions.CreateObjectInternal(key, overrides, null);
                }
                catch (Exception e)
                {
                    Common.DebugException(key.ToString(), e);
                    continue;
                }

                T result = obj as T;
                if (result == null)
                {
                    stats.IncStat(name + " Mismatch " + choice.ObjectInstanceName, Common.DebugLevel.High);
                    stats.IncStat(name + " Wrong Type " + obj.GetType().Name, Common.DebugLevel.High);
                }
                else if ((test != null) && (!test(result)))
                {
                    stats.IncStat(name + " Test Fail");
                }
                else
                {
                    BuildBuyModel model = Sims3.Gameplay.UI.Responder.Instance.BuildBuyModel;

                    List <ResourceKey> presets = new List <ResourceKey>();

                    uint[] objectPresetIdList = model.GetObjectPresetIdList(obj.ObjectId);
                    for (uint i = 0; i < objectPresetIdList.Length; i++)
                    {
                        ThumbnailKey thumbnail = model.GetObjectProductThumbnailKey(obj.ObjectId, ThumbnailSize.Large);
                        if (thumbnail.mDescKey != ResourceKey.kInvalidResourceKey)
                        {
                            uint id = objectPresetIdList[i];
                            thumbnail.mDescKey.GroupId = (thumbnail.mDescKey.GroupId & 0xff000000) | (id & 0xffffff);
                            ResourceKeyContentCategory customContentTypeFromKeyAndPresetIndex = UIUtils.GetCustomContentTypeFromKeyAndPresetIndex(model.GetObjectProductKey(obj.ObjectId), i);
                            if (customContentTypeFromKeyAndPresetIndex == ResourceKeyContentCategory.kInstalled)
                            {
                                customContentTypeFromKeyAndPresetIndex = UIUtils.GetCustomContentType(model.GetObjectProductKey(obj.ObjectId));
                            }
                            string presetString = model.GetPresetString(thumbnail.mDescKey);
                            if (presetString != string.Empty)
                            {
                                KeyValuePair <string, Dictionary <string, Complate> > presetEntryFromPresetString = (KeyValuePair <string, Dictionary <string, Complate> >)SimBuilder.GetPresetEntryFromPresetString(presetString);
                                if ((presetEntryFromPresetString.Value != null) && (presetEntryFromPresetString.Value.Count > 0))
                                {
                                    presets.Add(thumbnail.mDescKey);
                                }
                            }
                        }
                    }

                    if (presets.Count > 0)
                    {
                        ResourceKey preset = RandomUtil.GetRandomObjectFromList(presets);

                        string presetString = model.GetPresetString(preset);
                        if (!string.IsNullOrEmpty(presetString))
                        {
                            object presetEntryFromPresetString = SimBuilder.GetPresetEntryFromPresetString(presetString);
                            if (presetEntryFromPresetString is KeyValuePair <string, Dictionary <string, Complate> > )
                            {
                                FinalizePresetTask.Perform(obj.ObjectId, (KeyValuePair <string, Dictionary <string, Complate> >)presetEntryFromPresetString);
                            }
                        }
                    }

                    stats.IncStat(name + " Found");

                    price = (int)choice.Price;

                    return(result);
                }

                obj.Destroy();
            }

            price = 0;
            return(null);
        }
Пример #9
0
        protected static bool Perform(Common.IStatGenerator stats, SimDescription sim, int amount, ref bool push)
        {
            if (sim.CreatedSim == null)
            {
                stats.IncStat("Hibernating");
                return(false);
            }
            else if (!Inventories.VerifyInventory(sim))
            {
                stats.IncStat("No Inventory");
                return(false);
            }

            School school = sim.CareerManager.School;

            if (school != null)
            {
                if (school.OwnersHomework == null)
                {
                    school.OwnersHomework = GlobalFunctions.CreateObjectOutOfWorld("Homework") as Homework;
                    school.OwnersHomework.OwningSimDescription = sim;
                    Inventories.TryToMove(school.OwnersHomework, sim.CreatedSim);

                    stats.IncStat("Homework Created");
                }

                if ((!sim.CreatedSim.Inventory.Contains(school.OwnersHomework)) &&
                    (school.OwnersHomework.LotCurrent != sim.CreatedSim.LotCurrent) &&
                    (school.OwnersHomework.UseCount == 0))
                {
                    Inventories.TryToMove(school.OwnersHomework, sim.CreatedSim);

                    stats.IncStat("Homework Moved");
                }
            }

            if (amount > 100)
            {
                amount = 100;
            }

            bool success = false;

            foreach (Homework obj in Inventories.InventoryFindAll <Homework>(sim))
            {
                if (obj.PercentComplete < 0)
                {
                    continue;
                }

                if ((amount < 0) || (obj.PercentComplete < amount))
                {
                    obj.PercentComplete = amount;
                    stats.AddStat("Homework Value", amount);

                    if (amount > 90)
                    {
                        push = true;
                    }

                    success = true;
                }
            }
            return(success);
        }
Пример #10
0
        public bool BumpToLowerState(Common.IStatGenerator stats, SimDescription a, SimDescription b, bool story)
        {
            if (a.Partner == b)
            {
                if ((!AllowBreakup(this, a, Managers.Manager.AllowCheck.None)) || (!AllowBreakup(this, b, Managers.Manager.AllowCheck.None)))
                {
                    IncStat("BumpDown: Breakup: User Denied");
                    stats.IncStat("BumpDown: Breakup: User Denied");
                    return(false);
                }

                SetElapsedTime <DayOfLastPartnerOption>(a);
                SetElapsedTime <DayOfLastPartnerOption>(b);

                try
                {
                    a.Partner = null;
                }
                catch (Exception e)
                {
                    Common.DebugException(a, e);
                }

                try
                {
                    b.Partner = null;
                }
                catch (Exception e)
                {
                    Common.DebugException(b, e);
                }

                if ((a.CreatedSim != null) && (a.CreatedSim.BuffManager != null))
                {
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.NewlyEngaged);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstKiss);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstRomance);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.JustMarried);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.WeddingDay);
                }

                if ((b.CreatedSim != null) && (b.CreatedSim.BuffManager != null))
                {
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.NewlyEngaged);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstKiss);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstRomance);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.JustMarried);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.WeddingDay);
                }

                if (story)
                {
                    Stories.PrintStory(this, "Breakup", new object[] { a, b }, null);
                }
            }

            Relationship relation = ManagerSim.GetRelationship(a, b);

            if (relation != null)
            {
                LongTermRelationshipTypes currentState = relation.LTR.CurrentLTR;

                LongTermRelationshipTypes nextState = ChangeRelationship.NextNegativeRomanceState(currentState, relation.IsPetToPetRelationship);
                if (nextState != LongTermRelationshipTypes.Undefined)
                {
                    float liking = relation.LTR.Liking;

                    AddStat("BumpDown: Pre", liking);
                    stats.AddStat("BumpDown: Pre", liking);

                    ForceChangeState(relation, nextState);

                    int score = AddScoring("BumpDown: Hate Loss", ScoringLookup.GetScore("HateRomanceLoss", b));
                    if ((SimTypes.IsSelectable(a)) || (SimTypes.IsSelectable(b)) || (stats.AddScoring("BumpDown: Hate Loss", score) <= 0))
                    {
                        if (liking > relation.LTR.Liking)
                        {
                            try
                            {
                                relation.LTR.SetLiking(liking);
                            }
                            catch (Exception e)
                            {
                                Common.DebugException(a, b, e);

                                IncStat("BumpDown: Reset Liking Fail");
                                stats.IncStat("BumpDown: Reset Liking Fail");
                            }
                        }
                    }

                    AddStat("BumpDown: Post", relation.LTR.Liking);
                    stats.AddStat("BumpDown: Post", relation.LTR.Liking);

                    IncStat("BumpDown " + relation.LTR.CurrentLTR);
                    stats.IncStat("BumpDown " + relation.LTR.CurrentLTR);
                }
            }
            return(true);
        }
Пример #11
0
        protected SimDescription GetSim(CASAgeGenderFlags gender, CASAgeGenderFlags species, SimDescription exclude)
        {
            if (RandomUtil.RandomChance(mBinChance))
            {
                List <ExportBinContents> contents = new List <ExportBinContents>();
                foreach (IExportBinContents iContent in BinModel.Singleton.ExportBinContents)
                {
                    ExportBinContents content = iContent as ExportBinContents;
                    if (content == null)
                    {
                        continue;
                    }

                    contents.Add(content);
                }

                Dictionary <UISimInfo, ExportBinContents> uiSims = new Dictionary <UISimInfo, ExportBinContents>();

                if (Manager.GetValue <EqualBinChanceOption <TManager>, bool>())
                {
                    foreach (ExportBinContents content in contents)
                    {
                        if (!ValidContent(content))
                        {
                            continue;
                        }

                        foreach (UISimInfo sim in content.HouseholdSims)
                        {
                            if (!ValidContent(sim, species, exclude))
                            {
                                continue;
                            }

                            if (uiSims.ContainsKey(sim))
                            {
                                continue;
                            }

                            uiSims.Add(sim, content);
                        }
                    }
                }
                else
                {
                    RandomUtil.RandomizeListOfObjects(contents);
                    foreach (ExportBinContents content in contents)
                    {
                        if (!ValidContent(content))
                        {
                            continue;
                        }

                        foreach (UISimInfo sim in content.HouseholdSims)
                        {
                            if (!ValidContent(sim, species, exclude))
                            {
                                continue;
                            }

                            uiSims.Add(sim, content);
                        }

                        if (uiSims.Count > 0)
                        {
                            break;
                        }
                    }
                }

                if (uiSims.Count > 0)
                {
                    UISimInfo choice = RandomUtil.GetRandomObjectFromList(new List <UISimInfo>(uiSims.Keys));

                    ExportBinContents content = uiSims[choice];

                    if (!content.IsLoaded())
                    {
                        Dictionary <string, List <News.NewsTuning.ArticleTuning> > namedArticles = News.sNewsTuning.mNamedArticles;

                        bool fail = false;
                        try
                        {
                            // Doing so stops Marriage notices of imported sims from appearing in the newspaper
                            News.sNewsTuning.mNamedArticles = new Dictionary <string, List <News.NewsTuning.ArticleTuning> >();

                            ExportBinContentsEx.Import(content, false);

                            mStats.AddStat("Import Size", content.HouseholdSims.Count);
                        }
                        catch (Exception e)
                        {
                            Common.DebugException(content.HouseholdName, e);
                            fail = true;
                        }
                        finally
                        {
                            News.sNewsTuning.mNamedArticles = namedArticles;
                        }

                        mLoaded[content] = true;

                        if (fail)
                        {
                            return(null);
                        }
                    }

                    if ((content.Household != null) && (content.Household.AllSimDescriptions.Count > 0))
                    {
                        List <SimDescription> choices = new List <SimDescription>();

                        foreach (SimDescription sim in Households.All(content.Household))
                        {
                            if (SimTypes.IsSkinJob(sim))
                            {
                                continue;
                            }

                            if (SimTypes.IsOccult(sim, OccultTypes.ImaginaryFriend))
                            {
                                continue;
                            }

                            mStats.IncStat("Immigrant: Bin Sim");

                            if (sim.Species == choice.Species)
                            {
                                choices.Add(sim);

                                if (sim.FullName == choice.SimName)
                                {
                                    return(sim);
                                }
                            }
                        }

                        if (choices.Count > 0)
                        {
                            return(RandomUtil.GetRandomObjectFromList(choices));
                        }
                    }
                }
            }

            if ((RandomUtil.RandomChance(mRandomChance)) || (Manager.Sims.All.Count <= 20))
            {
                return(GetRandomSim(gender, species));
            }

            List <SimDescription> sims = new List <SimDescription>();

            bool allowAlien = Manager.GetValue <AllowAlienHouseholdOption <TManager>, bool>();

            foreach (SimDescription sim in Manager.Sims.All)
            {
                if (SimTypes.InServicePool(sim, ServiceType.GrimReaper))
                {
                    continue;
                }

                if (sim.Species != species)
                {
                    continue;
                }

                if (!allowAlien)
                {
                    if (SimTypes.IsServiceAlien(sim))
                    {
                        continue;
                    }
                }

                if (exclude != null)
                {
                    if (exclude == sim)
                    {
                        continue;
                    }

                    if (exclude.LastName == sim.LastName)
                    {
                        continue;
                    }
                }

                sims.Add(sim);
            }

            if (sims.Count == 0)
            {
                return(null);
            }
            else
            {
                mStats.IncStat("Immigrant: Town Sim");

                return(RandomUtil.GetRandomObjectFromList(sims));
            }
        }
Пример #12
0
        protected bool PassesHomeInspection(Common.IStatGenerator stats, Lot lot, ICollection <HomeInspection.Reason> existingResults, IEnumerable <HomeInspection.Result> results, FindLotFlags flags)
        {
            if (lot == null)
            {
                return(false);
            }

            Lot.LotMetrics metrics = new Lot.LotMetrics();
            lot.GetLotMetrics(ref metrics);

            if (metrics.FridgeCount == 0)
            {
                stats.IncStat("Home Inspection: No Fridge");
                return(false);
            }

            if (((flags & FindLotFlags.Inspect) == FindLotFlags.Inspect) && (GetValue <RigorousNewHomeOption, bool> ()))
            {
                bool failure = false;
                foreach (HomeInspection.Result result in results)
                {
                    switch (result.mReason)
                    {
                    case HomeInspection.Reason.NoDouble:
                        continue;

                    case HomeInspection.Reason.TooFewDouble:
                        if (!GetValue <DoubleBedInspectionOption, bool>())
                        {
                            stats.IncStat("Home Inspection: " + result.mReason + " Disabled");
                            continue;
                        }
                        break;

                    case HomeInspection.Reason.TooFewCribs:
                        if ((!GetValue <CribInspectionOption, bool>()))
                        {
                            stats.IncStat("Home Inspection: " + result.mReason + " Disabled");
                            continue;
                        }
                        else if (existingResults.Contains(HomeInspection.Reason.TooFewCribs))
                        {
                            stats.IncStat("Home Inspection: " + result.mReason + " Existing Infraction");
                            continue;
                        }
                        break;

                    case HomeInspection.Reason.TooFewBeds:
                        if (GetValue <DoubleBedInspectionOption, bool>())
                        {
                            stats.IncStat("Home Inspection: " + result.mReason + " Disabled");
                            continue;
                        }
                        break;

                    case HomeInspection.Reason.TooFewStalls:
                        if (result.mExisting > 0)
                        {
                            stats.IncStat("Home Inspection: " + result.mReason + " At Least One");
                            continue;
                        }
                        // Never move horses to a lot that has no stalls
                        break;

                    case HomeInspection.Reason.TooFewPetBeds:
                        if (((flags & FindLotFlags.InspectPets) != FindLotFlags.InspectPets))
                        {
                            stats.IncStat("Home Inspection: " + result.mReason + " Not Checking");
                            continue;
                        }
                        else if (!GetValue <PetInspectionOption, bool>())
                        {
                            stats.IncStat("Home Inspection: " + result.mReason + " Disabled");
                            continue;
                        }
                        else if (existingResults.Contains(HomeInspection.Reason.TooFewPetBeds))
                        {
                            stats.IncStat("Home Inspection: " + result.mReason + " Existing Infraction");
                            continue;
                        }
                        break;
                    }

                    stats.AddStat("Home Inspection: " + result.mReason + " Existing", result.mExisting);
                    stats.AddStat("Home Inspection: " + result.mReason + " Required", result.mRequired);
                    failure = true;
                }

                if (failure)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #13
0
        protected bool PrivatePerform(Common.IStatGenerator stats, SimDescription mom, SimDescription dad, bool forcePitch)
        {
            VoiceVariationType voice = VoiceVariationType.A;

            if (Sim.Child)
            {
                if (RandomUtil.CoinFlip())
                {
                    voice = VoiceVariationType.B;
                }

                stats.IncStat("Voice Child Random");
            }
            else if (Sim.TeenOrAbove)
            {
                if (RandomUtil.CoinFlip())
                {
                    if (dad != null)
                    {
                        voice = dad.VoiceVariation;

                        stats.IncStat("Voice From Dad");
                    }
                    else if (mom != null)
                    {
                        voice = mom.VoiceVariation;

                        stats.IncStat("Voice From Mom");
                    }
                    else
                    {
                        voice = unchecked ((VoiceVariationType)RandomUtil.GetInt(0, 2));

                        stats.IncStat("Voice Teen Random");
                    }
                }
                else
                {
                    if (mom != null)
                    {
                        voice = mom.VoiceVariation;

                        stats.IncStat("Voice From Mom");
                    }
                    else if (dad != null)
                    {
                        voice = dad.VoiceVariation;

                        stats.IncStat("Voice From Dad");
                    }
                    else
                    {
                        voice = unchecked ((VoiceVariationType)RandomUtil.GetInt(0, 2));

                        stats.IncStat("Voice Teen Random");
                    }
                }
            }

            Sim.VoiceVariation = voice;

            if ((forcePitch) || (Sim.Baby))
            {
                if (Sim.IsMale)
                {
                    if (dad != null)
                    {
                        Sim.VoicePitchModifier = dad.VoicePitchModifier;

                        stats.IncStat("Pitch From Dad");
                    }
                    else
                    {
                        Sim.VoicePitchModifier = RandomUtil.GetFloat(0f, 0.6f);

                        stats.IncStat("Pitch Random");
                    }
                }
                else
                {
                    if (mom != null)
                    {
                        Sim.VoicePitchModifier = mom.VoicePitchModifier;

                        stats.IncStat("Pitch From Mom");
                    }
                    else
                    {
                        Sim.VoicePitchModifier = RandomUtil.GetFloat(0.4f, 1f);

                        stats.IncStat("Pitch Random");
                    }
                }

                float fMutation = RandomUtil.GetFloat(-0.1f, 0.1f);

                Sim.VoicePitchModifier += fMutation;

                if (Sim.VoicePitchModifier < 0f)
                {
                    fMutation = RandomUtil.GetFloat(0f, 0.2f);

                    Sim.VoicePitchModifier = fMutation;
                }
                else if (Sim.VoicePitchModifier > 1f)
                {
                    fMutation = RandomUtil.GetFloat(0f, 0.2f);

                    Sim.VoicePitchModifier = 1f - fMutation;
                }

                stats.AddStat("Baby Pitch", Sim.VoicePitchModifier);
            }

            return(true);
        }