Esempio n. 1
0
        public static bool CanTryForBaby(Sim actor, Sim target, bool autonomous, CommonWoohoo.WoohooStyle style, ref GreyedOutTooltipCallback callback, out string reason)
        {
            using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration CanTryForBaby", Common.DebugLevel.Stats))
            {
                int  chance       = 0;
                bool teenCanTry   = false;
                int  speciesIndex = PersistedSettings.GetSpeciesIndex(actor);

                switch (style)
                {
                case CommonWoohoo.WoohooStyle.Risky:
                case CommonWoohoo.WoohooStyle.TryForBaby:
                    if (actor.SimDescription.Teen || target.SimDescription.Teen)
                    {
                        chance = Woohooer.Settings.mTryForBabyTeenBabyMadeChance;
                    }
                    else
                    {
                        chance = Woohooer.Settings.mTryForBabyMadeChanceV2[speciesIndex];
                    }

                    teenCanTry = Woohooer.Settings.mTeenTryForBabyAutonomous;
                    break;
                }

                if (chance <= 0)
                {
                    reason   = "Chance Fail";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }

                if (!CommonSocials.CanGetRomantic(actor, target, autonomous, true, true, ref callback, out reason))
                {
                    return(false);
                }

                if (autonomous || Woohooer.Settings.TestStoryProgression(autonomous))
                {
                    if (sStoryProgressionAllowPregnancy.Valid && Woohooer.Settings.TestStoryProgression(autonomous))
                    {
                        if (actor.SimDescription.Gender == target.SimDescription.Gender)
                        {
                            reason   = "Surrogate: Same Sex Fail";
                            callback = Common.DebugTooltip(reason);
                            return(false);
                        }
                        else
                        {
                            SimDescription male, female;

                            if (actor.IsFemale)
                            {
                                female = actor.SimDescription;
                                male   = target.SimDescription;
                            }
                            else
                            {
                                male   = actor.SimDescription;
                                female = target.SimDescription;
                            }

                            reason = sStoryProgressionAllowPregnancy.Invoke <string>(new object[] { female, male, autonomous });

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

                if (actor.SimDescription.Gender == target.SimDescription.Gender)
                {
                    reason   = "Surrogate: Same Sex Fail";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }
                else
                {
                    if (actor.IsFemale && !CanGetPreggers(actor, autonomous, ref callback, out reason))
                    {
                        return(false);
                    }
                    else if (!CanGetPreggers(target, autonomous, ref callback, out reason))
                    {
                        return(false);
                    }
                }

                if (autonomous || Woohooer.Settings.mTestAllConditionsForUserDirected[speciesIndex])
                {
                    if (HasBlockingBuff(actor))
                    {
                        reason   = "Actor Buff Block";
                        callback = delegate { return(Common.Localize("TryForBaby:BuffBlock")); };
                        return(false);
                    }

                    if (HasBlockingBuff(target))
                    {
                        reason   = "Target Buff Block";
                        callback = delegate { return(Common.Localize("TryForBaby:BuffBlock")); };
                        return(false);
                    }

                    if (autonomous)
                    {
                        if (actor.SimDescription.IsPregnant || target.SimDescription.IsPregnant)
                        {
                            reason   = "Pregnant";
                            callback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                            return(false);
                        }
                    }
                    else
                    {
                        if ((actor.IsRobot && actor.SimDescription.IsPregnant) || actor.SimDescription.IsVisuallyPregnant)
                        {
                            reason   = "Pregnant";
                            callback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                            return(false);
                        }

                        if ((target.IsRobot && target.SimDescription.IsPregnant) || target.SimDescription.IsVisuallyPregnant)
                        {
                            if (actor.SimDescription.IsVisuallyPregnant || target.SimDescription.IsVisuallyPregnant)
                            {
                                reason   = "Pregnant";
                                callback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                                return(false);
                            }
                        }
                    }
                }

                if (actor.IsFemale && !actor.IsRobot && actor.SimDescription.Elder)
                {
                    reason   = "Elder";
                    callback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                    return(false);
                }

                if (target.IsFemale && !target.IsRobot && target.SimDescription.Elder)
                {
                    reason   = "Elder";
                    callback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                    return(false);
                }

                if (actor.SimDescription.Teen || target.SimDescription.Teen)
                {
                    if (!teenCanTry && autonomous)
                    {
                        reason   = "Teenagers";
                        callback = delegate { return(Common.LocalizeEAString("NRaas.Woohooer:Teenagers")); };
                        return(false);
                    }
                }

                if ((!actor.IsRobot && SimTypes.IsSkinJob(actor.SimDescription)) || (!target.IsRobot && SimTypes.IsSkinJob(target.SimDescription)))
                {
                    reason   = "Skin Job";
                    callback = delegate { return(Common.Localize("TryForBaby:SkinJob")); };
                    return(false);
                }

                return(true);
            }
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        public static bool CanTryForBaby(Sim a, Sim target, bool autonomous, CommonWoohoo.WoohooStyle style, ref GreyedOutTooltipCallback greyedOutTooltipCallback, out string reason)
        {
            using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration CanTryForBaby", Common.DebugLevel.Stats))
            {
                int  chance     = 0;
                bool teenCanTry = false;

                int speciesIndex = PersistedSettings.GetSpeciesIndex(a);

                PregnancyChoice pregnancyChoice = PregnancyChoice.Either;

                switch (style)
                {
                case CommonWoohoo.WoohooStyle.Risky:
                    if ((a.SimDescription.Teen) || (target.SimDescription.Teen))
                    {
                        chance = Woohooer.Settings.mRiskyTeenBabyMadeChance;
                    }
                    else
                    {
                        chance = Woohooer.Settings.mRiskyBabyMadeChanceV2[speciesIndex];
                    }

                    teenCanTry      = Woohooer.Settings.mTeenRiskyAutonomous;
                    pregnancyChoice = Woohooer.Settings.mRiskyPregnancyChoice;
                    break;

                case CommonWoohoo.WoohooStyle.TryForBaby:
                    if ((a.SimDescription.Teen) || (target.SimDescription.Teen))
                    {
                        chance = Woohooer.Settings.mTryForBabyTeenBabyMadeChance;
                    }
                    else
                    {
                        chance = Woohooer.Settings.mTryForBabyMadeChanceV2[speciesIndex];
                    }

                    teenCanTry      = Woohooer.Settings.mTeenTryForBabyAutonomous;
                    pregnancyChoice = Woohooer.Settings.mTryForBabyPregnancyChoice;
                    break;
                }

                if (chance <= 0)
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("Chance Fail");
                    reason = "Chance Fail";
                    return(false);
                }

                if (!CommonSocials.CanGetRomantic(a, target, autonomous, true, true, ref greyedOutTooltipCallback, out reason))
                {
                    return(false);
                }

                if (autonomous)
                {
                    if ((sStoryProgressionAllowPregnancy.Valid) && (Woohooer.Settings.TestStoryProgression(autonomous)))
                    {
                        reason = sStoryProgressionAllowPregnancy.Invoke <string>(new object[] { a.SimDescription, target.SimDescription, autonomous });
                        if (reason != null)
                        {
                            greyedOutTooltipCallback = Woohooer.StoryProgressionTooltip(reason, false);
                            return(false);
                        }
                    }
                }

                if (a.SimDescription.Gender == target.SimDescription.Gender)
                {
                    if (!Woohooer.Settings.mAllowSameSexTryForBabyV2[speciesIndex])
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Same Sex Fail");
                        reason = "Same Sex Fail";
                        return(false);
                    }

                    if ((!CanGetPreggers(a, autonomous, ref greyedOutTooltipCallback, out reason)) && (!CanGetPreggers(target, autonomous, ref greyedOutTooltipCallback, out reason)))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (a.IsFemale)
                    {
                        if (!CanGetPreggers(a, autonomous, ref greyedOutTooltipCallback, out reason))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (!CanGetPreggers(target, autonomous, ref greyedOutTooltipCallback, out reason))
                        {
                            return(false);
                        }
                    }
                }

                if ((autonomous) || (Woohooer.Settings.mTestAllConditionsForUserDirected[speciesIndex]))
                {
                    if (HasBlockingBuff(a))
                    {
                        greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:BuffBlock")); };
                        reason = "BuffBlock";
                        return(false);
                    }

                    if (HasBlockingBuff(target))
                    {
                        greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:BuffBlock")); };
                        reason = "BuffBlock";
                        return(false);
                    }

                    if ((a.SimDescription.Gender != target.SimDescription.Gender) || (pregnancyChoice != PregnancyChoice.Either))
                    {
                        if (autonomous)
                        {
                            if (a.SimDescription.IsPregnant)
                            {
                                greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                                reason = "Pregnant";
                                return(false);
                            }

                            if (target.SimDescription.IsPregnant)
                            {
                                greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                                reason = "Pregnant";
                                return(false);
                            }
                        }
                        else
                        {
                            if (a.SimDescription.IsVisuallyPregnant)
                            {
                                greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                                reason = "Pregnant";
                                return(false);
                            }

                            if (target.SimDescription.IsVisuallyPregnant)
                            {
                                greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Pregnant")); };
                                reason = "Pregnant";
                                return(false);
                            }
                        }
                    }

                    if ((a.SimDescription.IsMale) && (target.SimDescription.IsMale))
                    {
                        if (!Woohooer.Settings.mAutonomousMaleMaleTryForBabyV2[speciesIndex])
                        {
                            greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:SameSexDenied")); };
                            reason = "SameSexDenied";
                            return(false);
                        }

                        if (a.SimDescription.Elder)
                        {
                            greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                            reason = "Elder";
                            return(false);
                        }

                        if (target.SimDescription.Elder)
                        {
                            greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                            return(false);
                        }
                    }

                    if ((a.SimDescription.IsFemale) && (target.SimDescription.IsFemale))
                    {
                        if (!Woohooer.Settings.mAutonomousFemaleFemaleTryForBabyV2[speciesIndex])
                        {
                            greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:SameSexDenied")); };
                            reason = "SameSexDenied";
                            return(false);
                        }
                    }

                    if ((a.SimDescription.Elder) && (a.SimDescription.IsFemale))
                    {
                        greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                        reason = "Elder";
                        return(false);
                    }

                    if ((target.SimDescription.Elder) && (target.SimDescription.IsFemale))
                    {
                        greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:Elder")); };
                        reason = "Elder";
                        return(false);
                    }

                    if ((a.SimDescription.Teen) || (target.SimDescription.Teen))
                    {
                        if ((!teenCanTry) && (autonomous))
                        {
                            greyedOutTooltipCallback = delegate
                            {
                                return(Common.LocalizeEAString("NRaas.Woohooer:Teenagers"));
                            };
                            reason = "Teenagers";
                            return(false);
                        }
                    }

                    if ((SimTypes.IsSkinJob(a.SimDescription)) || (SimTypes.IsSkinJob(target.SimDescription)))
                    {
                        greyedOutTooltipCallback = delegate { return(Common.Localize("TryForBaby:SkinJob")); };
                        reason = "SkinJob";
                        return(false);
                    }
                }

                return(true);
            }
        }