public override InteractionDefinition GetInteraction(Sim actor, Sim target, CommonWoohoo.WoohooStyle style)
        {
            switch (style)
            {
                case CommonWoohoo.WoohooStyle.Safe:
                    return new HotAirBalloonWoohoo.SafeHotAirBalloonDefinition(target);
                case CommonWoohoo.WoohooStyle.Risky:
                    return new HotAirBalloonWoohoo.RiskyHotAirBalloonDefinition(target);
                case CommonWoohoo.WoohooStyle.TryForBaby:
                    return new HotAirBalloonWoohoo.TryForBabyHotAirBalloonDefinition(target);
            }

            return null;
        }
        public static WoohooLocationControl GetControl(CommonWoohoo.WoohooLocation location)
        {
            if (sControls == null)
            {
                sControls = new Dictionary<CommonWoohoo.WoohooLocation, WoohooLocationControl>();

                foreach (WoohooLocationControl control in Common.DerivativeSearch.Find<WoohooLocationControl>())
                {
                    sControls.Add(control.Location, control);
                }
            }

            WoohooLocationControl result;
            if (sControls.TryGetValue(location, out result))
            {
                return result;
            }
            else
            {
                return null;
            }
        }
Example #3
0
 public override InteractionDefinition GetInteraction(Sim actor, Sim target, CommonWoohoo.WoohooStyle style)
 {
     return null;
 }
Example #4
0
        public static Pregnancy Impregnate(Sim actor, Sim target, bool isAutonomous, CommonWoohoo.WoohooStyle style)
        {
            PregnancyChoice choice = Woohooer.Settings.mTryForBabyPregnancyChoice;
            bool playChimes = true;

            if (Woohooer.Settings.ReplaceWithRisky || style == CommonWoohoo.WoohooStyle.Risky)
            {
                choice = Woohooer.Settings.mRiskyPregnancyChoice;
                playChimes = false;
            }            

            if (actor.SimDescription.Gender == target.SimDescription.Gender)
            {
                switch (choice)
                {
                    case PregnancyChoice.Initiator:
                        return StartPregnancy(actor, target, isAutonomous, playChimes);
                    case PregnancyChoice.Target:
                        return StartPregnancy(target, actor, isAutonomous, playChimes);
                    default:
                        Sim a = actor;
                        Sim b = target;

                        switch(choice)
                        {
                            case PregnancyChoice.Random:
                                if (RandomUtil.CoinFlip())
                                {
                                    b = actor;
                                    a = target;
                                }
                                break;
                            case PregnancyChoice.TargetThenInitiator:
                                b = actor;
                                a = target;
                                break;
                        }

                        Pregnancy pregnancy = StartPregnancy(a, b, isAutonomous, playChimes);
                        if (pregnancy != null)
                        {
                            return pregnancy;
                        }
                        else
                        {
                            return StartPregnancy(b, a, isAutonomous, playChimes);
                        }
                }
            }
            else
            {
                if (actor.IsFemale)
                {
                    return StartPregnancy(actor, target, isAutonomous, playChimes);
                }
                else
                {
                    return StartPregnancy(target, actor, isAutonomous, playChimes);
                }
            }
        }
Example #5
0
        public static float OnGetChanceOfSuccess(Sim a, Sim b, CommonWoohoo.WoohooStyle style)
        {
            float chance = 0;

            bool useFertility = true;

            int speciesIndex = PersistedSettings.GetSpeciesIndex(a);

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

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

                    useFertility = Woohooer.Settings.mTryForBabyFertility[speciesIndex];
                    break;
            }

            if (chance <= 0)
            {
                Common.DebugNotify("Pregnancy: No Chance");
                return 0;
            }

            if (useFertility)
            {
                if (a.IsHuman)
                {
                    if ((a.BuffManager != null) && a.BuffManager.HasTransformBuff()) 
                    {
                        return 0;
                    }

                    if ((b.BuffManager == null) && b.BuffManager.HasTransformBuff())
                    {
                        return 0;
                    }

                    if ((a.TraitManager.HasElement(TraitNames.FertilityTreatment)) || ((a.BuffManager != null) && a.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)))
                    {
                        chance += TraitTuning.kFertilityBabyMakingChanceIncrease;
                    }

                    if ((b.TraitManager.HasElement(TraitNames.FertilityTreatment)) || ((b.BuffManager != null) && b.BuffManager.HasElement(BuffNames.ATwinkleInTheEye)))
                    {
                        chance += TraitTuning.kFertilityBabyMakingChanceIncrease;
                    }
                }
                else
                {
                    if (a.TraitManager.HasElement(TraitNames.FertilityTreatmentPet))
                    {
                        chance += TraitTuning.kFertilityLitterMakingChanceIncrease;
                    }

                    if (b.TraitManager.HasElement(TraitNames.FertilityTreatmentPet))
                    {
                        chance += TraitTuning.kFertilityLitterMakingChanceIncrease;
                    }
                }

                if (a.TraitManager.HasElement(TraitNames.WishedForLargeFamily))
                {
                    chance += 100f;
                    a.BuffManager.RemoveElement(BuffNames.WishForLargeFamily);
                }

                if (b.TraitManager.HasElement(TraitNames.WishedForLargeFamily))
                {
                    chance += 100f;
                    b.BuffManager.RemoveElement(BuffNames.WishForLargeFamily);
                }

                if ((a.BuffManager != null) && a.BuffManager.HasElement(BuffNames.MagicInTheAir))
                {
                    chance += BuffMagicInTheAir.kBabyMakingChanceIncrease * 100f;
                }

                if ((b.BuffManager != null) && b.BuffManager.HasElement(BuffNames.MagicInTheAir))
                {
                    chance += BuffMagicInTheAir.kBabyMakingChanceIncrease * 100f;
                }

                if ((GameUtils.IsInstalled(ProductVersion.EP7)) && (SimClock.IsNightTime()) && (SimClock.IsFullMoon()))
                {
                    chance += Pregnancy.kFullMoonImprovedBabyChance * 100f;
                }
            }

            return chance;
        }
Example #6
0
        public static bool IsSuccess(Sim simA, Sim simB, bool isAutonomous, CommonWoohoo.WoohooStyle style)
        {
            if (Woohooer.Settings.ReplaceWithRisky)
            {
                if (style == CommonWoohoo.WoohooStyle.Safe)
                {
                    style = CommonWoohoo.WoohooStyle.Risky;
                }
            }

            string reason;
            GreyedOutTooltipCallback callBack = null;
            if (!CanTryForBaby(simA, simB, isAutonomous, style, ref callBack, out reason))
            {
                if (callBack != null)
                {
                    Common.DebugNotify("Pregnancy: " + callBack(), simA, simB);
                }
                return false;
            }

            float chance = sGetChanceOfSuccess(simA, simB, style);

            if (!RandomUtil.RandomChance(chance))
            {
                Common.DebugNotify("Pregnancy: Chance Fail " + chance, simA, simB);
                return false;
            }

            Common.DebugNotify("Pregnancy: Chance Success " + chance, simA, simB);
            return true;
        }
Example #7
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;
            }
        }
 public abstract InteractionDefinition GetInteraction(Sim actor, Sim target, CommonWoohoo.WoohooStyle style);