protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            bool changed = false;

            foreach (Trait trait in new List <Trait>(Sim.TraitManager.List))
            {
                bool remove = false;

                if ((Sim.IsEP11Bot) && (!trait.IsHidden) && (!ActionData.IsBotSpecificTrait(trait.Guid)))
                {
                    remove = true;
                }

                if (HasValue <DisallowTraitOption, TraitNames>(Sim, trait.Guid))
                {
                    remove = true;
                }

                if (remove)
                {
                    Sim.TraitManager.RemoveElement(trait.Guid);

                    IncStat("Disallowed Trait Removed");

                    changed = true;
                }
            }

            if (changed)
            {
                GetData(Sim).InvalidateCache();
            }

            if (Sim.IsEP11Bot)
            {
                IncStat("Plumbot");
                return(true);
            }

            int required = Sim.TraitManager.NumTraitsForAge() - Sim.TraitManager.CountVisibleTraits();

            AddStat("Required", required);

            if (required <= 0)
            {
                if (GetValue <RemoveTraitsOption, bool>())
                {
                    List <Trait> traits = new List <Trait>(Sim.TraitManager.List.Count);

                    for (int i = traits.Count - 1; i >= 0; i--)
                    {
                        if (Sim.TraitManager.CountVisibleTraits() <= Sim.TraitManager.NumTraitsForAge())
                        {
                            break;
                        }

                        if ((traits[i].IsHidden) || (traits[i].IsReward))
                        {
                            continue;
                        }

                        Sim.TraitManager.RemoveElement(traits[i].Guid);
                        changed = true;

                        IncStat("Removed Excess");
                    }

                    if (changed)
                    {
                        GetData(Sim).InvalidateCache();
                    }
                    return(true);
                }
                else
                {
                    IncStat("Remove Disabled");
                    return(false);
                }
            }

            AddStat("Add", required);

            SimDescription mom = null, dad = null;

            Relationships.GetParents(Sim, out mom, out dad);

            if (mom != null)
            {
                if ((!SimTypes.IsDead(mom)) &&
                    (mom.TraitManager != null) &&
                    (!mom.TraitManager.TraitsMaxed()))
                {
                    IncStat("Hold For Parent");
                    return(false);
                }
            }

            if (dad != null)
            {
                if ((!SimTypes.IsDead(dad)) &&
                    (dad.TraitManager != null) &&
                    (!dad.TraitManager.TraitsMaxed()))
                {
                    IncStat("Hold For Parent");
                    return(false);
                }
            }

            try
            {
                Sims3.Gameplay.CAS.Genetics.AssignTraits(Sim, dad, mom, false, 0, new System.Random());
                IncStat("Success");

                GetData(Sim).InvalidateCache();
                return(true);
            }
            catch (Exception e)
            {
                Common.DebugException(Sim, e);
            }

            return(false);
        }