Example #1
0
        private static bool CanGetPreggers(Sim sim, bool isAutonomous, ref GreyedOutTooltipCallback callback, out string reason)
        {
            using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration CanGetPreggers", Common.DebugLevel.Stats))
            {
                if (SimTypes.IsPassporter(sim.SimDescription))
                {
                    reason   = "Passport";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }

                if (isAutonomous)
                {
                    if (!sim.IsRobot && sim.SimDescription.Elder)
                    {
                        reason   = "Elder";
                        callback = Common.DebugTooltip(reason);
                        return(false);
                    }
                    else if (Households.IsFull(sim.Household, sim.IsPet, Woohooer.Settings.mMaximumHouseholdSizeForAutonomousV2[PersistedSettings.GetSpeciesIndex(sim)]))
                    {
                        reason   = "House Full";
                        callback = Common.DebugTooltip(reason);
                        return(false);
                    }
                }
                else
                {
                    if (!CommonPregnancy.SatisfiesMaximumOccupants(sim, isAutonomous, ref callback))
                    {
                        reason = "Maximum Occupants";
                        return(false);
                    }
                }

                if (!sim.IsRobot && SimTypes.IsSkinJob(sim.SimDescription))
                {
                    reason   = "Non-Robot Skin Job Fail";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }
                else if (sim.BuffManager.HasTransformBuff())
                {
                    reason   = "Transform Buff";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }
                else if (!sim.IsRobot && sim.SimDescription.IsVisuallyPregnant)
                {
                    reason   = "Already Pregnant";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }
                else if (sim.IsRobot && sim.SimDescription.IsPregnant)
                {
                    reason   = "Already Pregnant";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }

                if (sim.Household != null && sim.Household.IsTouristHousehold)
                {
                    MiniSimDescription description = MiniSimDescription.Find(sim.SimDescription.SimDescriptionId);

                    if (description == null)
                    {
                        reason   = "Too Many Sims";
                        callback = delegate
                        {
                            return(Common.LocalizeEAString(sim.IsFemale, "Gameplay/Actors/Sim/TryForBaby:TooManySims", new object[] { sim }));
                        };
                        return(false);
                    }
                }
                else if (sim.LotHome == null)
                {
                    reason   = "Too Many Sims";
                    callback = delegate
                    {
                        if (sim.Household.IsAlienHousehold)
                        {
                            return(Common.LocalizeEAString(sim.IsFemale, "Gameplay/Actors/Sim/TryForBaby:AlienNPCs", new object[] { sim }));
                        }
                        else
                        {
                            return(Common.LocalizeEAString(sim.IsFemale, "Gameplay/Actors/Sim/TryForBaby:TooManySims", new object[] { sim }));
                        }
                    };
                    return(false);
                }
                else if (sim.SimDescription.IsDueToAgeUp() || (sim.SimDescription.AgingState != null && sim.SimDescription.AgingState.IsAgingInProgress()))
                {
                    reason   = "Aging Up Fail";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }
                else if (SimTypes.IsLampGenie(sim.SimDescription))
                {
                    reason   = "Lamp Genie";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }

                if (sStoryProgressionAllowImpregnation.Valid && Woohooer.Settings.TestStoryProgression(isAutonomous))
                {
                    reason = sStoryProgressionAllowImpregnation.Invoke <string>(new object[] { sim.SimDescription, isAutonomous });

                    if (reason != null)
                    {
                        callback = Woohooer.StoryProgressionTooltip(reason, false);
                        return(false);
                    }
                }

                reason = null;

                return(true);
            }
        }