public override bool InRabbitHole() { BeginCommodityUpdates(); bool flag = DoTimedLoop(kSimMinutesForRaid); EndCommodityUpdates(flag); int samplesStolen = 0; if (flag) { for (int i = 0; i < mMaxSamples; i++) { if (RandomUtil.RandomChance(mChance)) { ScientificSample.DnaSampleSubject subject = new ScientificSample.DnaSampleSubject(RandomUtil.GetRandomObjectFromList(mDonors)); ScientificSample.CreateAndAddToInventory(Actor, subject); samplesStolen++; } } } mSuccessful = samplesStolen > 0; return(flag); }
// For 2 robots private static Pregnancy ImpregnateRobot(Sim mother, Sim father, ScientificSample dnaF, ScientificSample dnaM, bool isAutonomous, CommonWoohoo.WoohooStyle style) { ScientificSample.DnaSampleSubject femaleSubject = dnaF.Subject as ScientificSample.DnaSampleSubject; ScientificSample.DnaSampleSubject maleSubject = dnaM.Subject as ScientificSample.DnaSampleSubject; if (femaleSubject != null) { if (maleSubject != null) { return(StartPregnancy(mother, father, femaleSubject.Subject, maleSubject.Subject, isAutonomous, true)); } else { if (father.IsRobot) { Common.DebugNotify("Surrogate Pregnancy: Male DNA Null", father); return(null); } else { return(StartPregnancy(mother, father, femaleSubject.Subject, null, isAutonomous, true)); } } } else { Common.DebugNotify("Surrogate Pregnancy: Female DNA Null", mother); return(null); } }
public static void DonateDNA(Sim actor, Sim target) { if (!actor.IsRobot && !target.IsRobot) { Common.DebugNotify("CommonSurrogate.DonateDNA" + Common.NewLine + " - Fail: Participants are Robots"); return; } if (actor.IsRobot && target.IsRobot) { Common.DebugNotify("CommonSurrogate.DonateDNA" + Common.NewLine + " - Fail: Participants are Humans"); return; } if (actor.SimDescription.Gender != target.SimDescription.Gender) { Common.DebugNotify("CommonSurrogate.DonateDNA" + Common.NewLine + " - Fail: Participants are not Same Sex"); return; } ScientificSample.DnaSampleSubject subject; if (!actor.IsRobot) { subject = new ScientificSample.DnaSampleSubject(actor.SimDescription); ScientificSample.CreateAndAddToInventory(target, subject); } else { subject = new ScientificSample.DnaSampleSubject(target.SimDescription); ScientificSample.CreateAndAddToInventory(actor, subject); } }
// For 1 robot and 1 human private static Pregnancy ImpregnateHuman(Sim mother, Sim father, ScientificSample dna, bool isAutonomous, CommonWoohoo.WoohooStyle style) { ScientificSample.DnaSampleSubject dnaSubject = dna.Subject as ScientificSample.DnaSampleSubject; if (dnaSubject != null) { return(StartPregnancy(mother, father, dnaSubject.Subject, isAutonomous, true)); } else { Common.DebugNotify("Surrogate Pregnancy: Male DNA Null", father); return(null); } }
private static List <ScientificSample> GetDNASamples(Sim robot, CASAgeGenderFlags gender) { if (robot.Inventory == null) { return(null); } List <InventoryStack> stacks = new List <InventoryStack>(); foreach (InventoryStack current in robot.Inventory.InventoryItems.Values) { if (current != null && new SelectionDelegate(IsObjectSample)(current.List[0].Object)) { ScientificSample scientificSample = current.List[0].Object as ScientificSample; if (scientificSample.ScientificSampleType == ScientificSample.SampleType.Dna) { stacks.Add(current); } } } List <ScientificSample> results = new List <ScientificSample>(); foreach (InventoryStack current2 in stacks) { foreach (InventoryItem current3 in current2.List) { ScientificSample scientificSample2 = current3.Object as ScientificSample; if (scientificSample2 != null) { ScientificSample.DnaSampleSubject subject = scientificSample2.Subject as ScientificSample.DnaSampleSubject; if (subject != null && subject.Subject.IsHuman && subject.Subject.Gender == gender) { results.Add(scientificSample2); } } } } return(results); }
public override bool RunFromInventory() { if (this.mResearchStation == null) { IResearchStation[] objects = Sims3.Gameplay.Queries.GetObjects <IResearchStation>(base.Actor.LotCurrent); List <IResearchStation> list = base.Actor.LotCurrent.GetObjects <IResearchStation>(p => !p.Repairable.Broken); if (objects.Length < 1) { base.Actor.AddExitReason(ExitReason.FailedToStart); return(false); } if (list.Count < 1) { base.Actor.AddExitReason(ExitReason.FailedToStart); return(false); } this.mResearchStation = objects[0]; } if (!base.Actor.RouteToSlotAndCheckInUse(this.mResearchStation, Slot.RoutingSlot_0)) { return(false); } GameObject mResearchStation = this.mResearchStation as GameObject; if (mResearchStation != null) { mResearchStation.EnableFootprintAndPushSims(ScientificSample.kScienceStationFootprintHash, base.Actor); } this.mVialsToUse = new List <ScientificSample>(); base.Target.SetGeometryState(ScientificSample.kGeoStateInUse); base.Target.CreateClonesForInteraction(this.mVialsToUse, base.Actor); base.StandardEntry(); base.BeginCommodityUpdates(); if (base.Actor.TraitManager.HasElement(TraitNames.AntiTV)) { base.Actor.BuffManager.AddElementPaused(BuffNames.AntiTV, Origin.FromScienceEquipment); } base.EnterStateMachine("ScienceStation", "EnterScienceStation", "x"); base.AddOneShotScriptEventHandler(0x65, new SacsEventHandler(this.OnPlaceTargetOnTray)); base.AddOneShotScriptEventHandler(0x66, new SacsEventHandler(this.OnRemoveTargetOnTray)); base.AddOneShotScriptEventHandler(0x6f, new SacsEventHandler(this.OnStartStationLaser)); base.AddOneShotScriptEventHandler(0xde, new SacsEventHandler(this.OnStopStationLaser)); base.AddOneShotScriptEventHandler(0x20c, new SacsEventHandler(this.OnCloneSpawn)); base.SetActor("researchStation", this.mResearchStation); base.Actor.Inventory.TryToRemove(base.Target); base.AnimateSim("PerformExperiment"); bool succeeded = this.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached | ExitReason.Canceled), new InteractionInstance.InsideLoopFunction(this.LoopDel), base.mCurrentStateMachine); if (base.Target.ScientificSampleType == ScientificSample.SampleType.Dna) { // custom this.DetermineHumanOutcomeEx(succeeded); } else { this.DetermineObjectOutcome(succeeded); } base.EndCommodityUpdates(succeeded); base.StandardExit(); if (this.mCloneSim != null) { if (this.mCloneSim.Household != base.Actor.Household) { this.mCloneSim.SimDescription.FirstName = StringInputDialog.Show(Localization.LocalizeString("Gameplay/Objects/RabbitHoles/ScienceLab:NameCloneTitle", new object[0]), Localization.LocalizeString("Gameplay/Objects/RabbitHoles/ScienceLab:NameCloneDesc", new object[0]), string.Empty, CASBasics.GetMaxNameLength(), StringInputDialog.Validation.SimNameText); CarryingChildPosture posture = base.Actor.Posture as CarryingChildPosture; if (posture != null) { base.Actor.InteractionQueue.AddNext(PutDownChild.Singleton.CreateInstance(posture.Child, base.Actor, new InteractionPriority(InteractionPriorityLevel.High), base.Autonomous, false)); } SocialWorkerChildAbuse.Instance.MakeServiceRequest(base.Actor.LotCurrent, true, this.mCloneSim.ObjectId, true); } else { this.mCloneSim.SimDescription.FirstName = StringInputDialog.Show(Localization.LocalizeString("Gameplay/Objects/RabbitHoles/ScienceLab:NameCloneTitle", new object[0]), Localization.LocalizeString("Gameplay/Objects/RabbitHoles/ScienceLab:NameCloneDesc", new object[0]), string.Empty, CASBasics.GetMaxNameLength(), StringInputDialog.Validation.SimNameText); ScientificSample.DnaSampleSubject subject = base.Target.Subject as ScientificSample.DnaSampleSubject; if (subject != null) { this.mCloneSim.SimDescription.LastName = subject.Subject.LastName; } else { this.mCloneSim.SimDescription.LastName = base.Actor.LastName; } } ChildUtils.FinishObjectInteractionWithChild(this, this.mCloneSim); } return(succeeded); }
public void DetermineHumanOutcomeEx(bool succeeded) { this.DeleteVialsInCentrifuge(); ScientificSample.DnaSampleSubject subject = base.Target.Subject as ScientificSample.DnaSampleSubject; bool flag = false; ScienceSkill element = (ScienceSkill)base.Actor.SkillManager.GetElement(SkillNames.Science); if (succeeded) { bool flag3; bool flag2 = RandomUtil.RandomChance01(kSuccessChance); if (flag2) { flag3 = RandomUtil.RandomChance01(kEpicSuccessChance); } else { flag3 = RandomUtil.RandomChance01(kEpicFailureChance); } if (((subject == null) /*|| !base.Actor.Household.CanAddSpeciesToHousehold(CASAgeGenderFlags.None | CASAgeGenderFlags.Human)*/) || GameUtils.IsUniversityWorld()) { flag2 = false; flag3 = true; } if (flag2) { string name = string.Empty; if (flag3) { this.CreateBaby(); SetupPerfectCloneChildTraits(this.mCloneSim.SimDescription, this.mCloneSim, subject.Subject); name = "SimCloneEpicSuccess"; } else { this.CreateBaby(); SetupCloneTraitsFromArray(this.mCloneSim.SimDescription, this.mCloneSim, subject.Subject, kGoodCloneTraitNames); name = "SimCloneSuccess"; } if (element != null) { element.AddObjectsCreated(); } flag = true; base.Actor.ShowTNSIfSelectable(LocalizeString(base.Actor.IsFemale, name, new object[] { base.Actor, subject.Subject }), StyledNotification.NotificationStyle.kGameMessagePositive); EventTracker.SendEvent(new SimDescriptionTargetEvent(EventTypeId.kClonedSim, base.Actor, subject.Subject)); } else if (flag3) { if (this.mCloneSim != null) { this.mCloneSim.Destroy(); this.mCloneSim = null; this.mReplacementObject = null; } base.Actor.BuffManager.AddElement(BuffNames.MinorSetback, Origin.FromFailedExperiment); BuffSinged.SingeViaInteraction(this, Origin.FromFailedExperiment); base.AnimateSim("ExperimentRareEpicFail"); base.Actor.ShowTNSIfSelectable(LocalizeString(base.Actor.IsFemale, "SimCloneEpicFail", new object[] { base.Actor, subject.Subject }), StyledNotification.NotificationStyle.kGameMessageNegative); if (element != null) { element.AddEpicFail(); } } else { this.CreateBaby(); SetupCloneTraitsFromArray(this.mCloneSim.SimDescription, this.mCloneSim, subject.Subject, kBadCloneTraitNames); flag = true; VisualEffect.FireOneShotEffect("ep9ScienceCloneBaby_main", this.mResearchStation, unchecked ((Slot)(-1474234202)), VisualEffect.TransitionType.HardTransition); base.Actor.ShowTNSIfSelectable(LocalizeString(base.Actor.IsFemale, "SimCloneFail", new object[] { base.Actor, subject.Subject }), StyledNotification.NotificationStyle.kGameMessageNegative); EventTracker.SendEvent(new SimDescriptionTargetEvent(EventTypeId.kClonedSim, base.Actor, subject.Subject)); if (element != null) { element.AddObjectsCreated(); } } } else { if (this.mCloneSim != null) { this.mCloneSim.Destroy(); this.mCloneSim = null; this.mReplacementObject = null; } base.Actor.BuffManager.AddElement(BuffNames.Mourning, unchecked ((Origin)(-8359806666160896151L))); BuffSinged.SingeViaInteraction(this, Origin.FromFailedExperiment); base.AnimateSim("ExperimentRareEpicFail"); base.Actor.ShowTNSIfSelectable(LocalizeString(base.Actor.IsFemale, "SimCloneEpicFail", new object[] { base.Actor, subject.Subject }), StyledNotification.NotificationStyle.kGameMessageNegative); if (element != null) { element.AddEpicFail(); } } if (flag) { base.SetActorAndEnter("y", this.mCloneSim, "NewBabyCloneEnter"); base.AnimateJoinSims("CloneBabySuccessExit"); ChildUtils.CarryChild(base.Actor, this.mCloneSim, false); this.mReplacementObject = null; this.mCloneSim.EnableInteractions(InteractionsDisabledType.All); } }