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)); } } }
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); } }