예제 #1
0
            public override bool Test(Sim actor, Lot target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!Abductor.Settings.mDebugging)
                {
                    return(false);
                }

                if (Household.AlienHousehold == null || Household.AlienHousehold.NumMembers == 0)
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("Alien Household Null or Empty");
                    return(false);
                }

                if (AlienUtilsEx.GetAliens() == null)
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("No Valid Aliens");
                    return(false);
                }

                if (AlienUtils.IsHouseboatAndNotDocked(target))
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("Houseboat Not Docked");
                    return(false);
                }

                if (AlienUtilsEx.GetAbductees(target) == null)
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("No Valid Abductees");
                    return(false);
                }

                return(true);
            }
예제 #2
0
        public override bool Run()
        {
            List <SimDescription> aliens = AlienUtilsEx.GetAliens();

            if (aliens == null)
            {
                Logger.Append("Debug - Trigger Alien Abduction: No Aliens");
                return(false);
            }

            List <Sim> abductees = AlienUtilsEx.GetAbductees(Target);

            if (abductees == null)
            {
                Logger.Append("Debug - Trigger Alien Abduction: No Abductees");
                return(false);
            }

            Sim            abductee = RandomUtil.GetRandomObjectFromList <Sim>(abductees);
            SimDescription alien    = RandomUtil.GetRandomObjectFromList <SimDescription>(aliens);

            if (!AlienUtilsEx.CanSimBeAbducted(abductee))
            {
                Logger.Append("Debug - Trigger Alien Abduction: Can't Abduct Sim");
                return(false);
            }

            AlienAbductionSituationEx.Create(alien, abductee, Target);

            return(true);
        }
예제 #3
0
            public override bool Test(Sim actor, Lot target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!Abductor.Settings.Debugging)
                {
                    return(false);
                }

                if (Household.AlienHousehold == null)
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("Alien household does not exist.");
                    return(false);
                }

                if (AlienUtilsEx.GetValidAliens() == null)
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("No valid abductors.");
                    return(false);
                }

                if (AlienUtils.IsHouseboatAndNotDocked(target))
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("Houseboat is not docked.");
                    return(false);
                }

                if (!AlienUtilsEx.CanASimBeAbducted(target))
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("No valid abductees.");
                    return(false);
                }

                return(true);
            }
예제 #4
0
        public override void OnAddition(BuffManager bm, BuffInstance bi, bool travelReaddition)
        {
            BuffInstanceAbductedEx instance = bi as BuffInstanceAbductedEx;

            List <SimDescription> aliens = AlienUtilsEx.GetAliens(true);

            if (aliens == null)
            {
                return;
            }

            instance.Abductee     = bm.Actor;
            instance.Alien        = RandomUtil.GetRandomObjectFromList <SimDescription>(aliens);
            instance.IsAutonomous = false;

            if (CommonPregnancy.IsSuccess(instance.Abductee, instance.Alien))
            {
                Pregnancy pregnancy = CommonPregnancy.CreatePregnancy(instance.Abductee, instance.Alien, !CommonPregnancy.AllowPlantSimPregnancy());

                if (pregnancy != null)
                {
                    instance.IsAlienPregnancy = true;
                    instance.Abductee.SimDescription.Pregnancy = pregnancy;
                    EventTracker.SendEvent(EventTypeId.kGotPregnant, instance.Abductee);
                }
            }
        }
예제 #5
0
        public override bool Run()
        {
            if (Target == null)
            {
                return(false);
            }

            List <SimDescription> aliens = AlienUtilsEx.GetValidAliens();
            Lot lot = Target.LotCurrent;

            if (aliens == null)
            {
                Common.DebugNotify("DEBUG - Abduct Sim: No valid aliens");
                return(false);
            }

            if (lot == null)
            {
                Common.DebugNotify("DEBUG - Abduct Sim: Target's current lot is null");
                return(false);
            }

            SimDescription alien = RandomUtil.GetRandomObjectFromList(aliens);

            AlienAbductionSituationEx.Create(alien, Target, lot);

            return(true);
        }
예제 #6
0
        public override bool Run()
        {
            if (Target == null)
            {
                return(false);
            }

            List <SimDescription> aliens    = AlienUtilsEx.GetValidAliens();
            List <Sim>            abductees = AlienUtilsEx.GetValidAbductees(Target);

            if (aliens == null)
            {
                Common.DebugNotify("DEBUG - Trigger Abduction: No valid aliens.");
                return(false);
            }

            if (abductees == null)
            {
                Common.DebugNotify("DEBUG - Trigger Abduction: No valid abductees.");
                return(false);
            }

            Sim            abductee = RandomUtil.GetRandomObjectFromList(abductees);
            SimDescription alien    = RandomUtil.GetRandomObjectFromList(aliens);

            AlienAbductionSituationEx.Create(alien, abductee, Target);

            return(true);
        }
예제 #7
0
        public new List <SimDescription> CreateNewbornsBeforePacking(float bonusMoodPoints, bool bAddToFamily, int householdSimMembers, int householdPetMembers)
        {
            MiniSimDescription miniDescription = null;
            SimDescription     description;

            if (mDad == null || mDad.HasBeenDestroyed)
            {
                description = SimDescription.Find(DadDescriptionId);

                if (description == null)
                {
                    miniDescription = MiniSimDescription.Find(DadDescriptionId);

                    if (miniDescription != null)
                    {
                        description = miniDescription.UnpackSim();
                        description.Genealogy.SetSimDescription(description);
                    }
                }
            }
            else
            {
                description = mDad.SimDescription;
            }

            float  averageMoodForBirth = GetAverageMoodForBirth(description, bonusMoodPoints);
            Random pregoRandom         = new Random(mRandomGenSeed);
            int    numForBirth         = GetNumForBirth(description, pregoRandom, householdSimMembers, householdPetMembers);
            Random gen = new Random(mRandomGenSeed);
            List <SimDescription> list = new List <SimDescription>();

            for (int i = 0; i < numForBirth; i++)
            {
                DetermineGenderOfBaby(gen);
                CASAgeGenderFlags gender = mGender;
                mGender = CASAgeGenderFlags.None;
                SimDescription description2 = AlienUtilsEx.MakeAlienBaby(description, mMom.SimDescription, gender, averageMoodForBirth, pregoRandom, false);
                description2.WasCasCreated = false;

                if (bAddToFamily)
                {
                    mMom.Household.Add(description2);
                    Sim sim = description2.Instantiate(mMom.Position);
                    CheckForGhostBaby(sim);
                }

                list.Add(description2);
            }

            if (miniDescription != null)
            {
                description.Dispose(true, true);
            }

            return(list);
        }
예제 #8
0
        public override bool Run()
        {
            if (Target == null)
            {
                return(false);
            }

            List <SimDescription> aliens = AlienUtilsEx.GetValidAliens();
            SimDescription        alien  = RandomUtil.GetRandomObjectFromList <SimDescription>(aliens);

            List <Sim> abductees = AlienUtilsEx.GetValidAbductees(Target);
            Sim        abductee  = RandomUtil.GetRandomObjectFromList <Sim>(abductees);

            AlienAbductionSituationEx.Create(alien, abductee, Target);

            return(true);
        }
예제 #9
0
        public override bool Run()
        {
            List <SimDescription> aliens = AlienUtilsEx.GetAliens(false);

            if (aliens == null)
            {
                Logger.Append("Debug - Induce Alien Pregnancy: No Aliens");
                return(false);
            }

            SimDescription alien = RandomUtil.GetRandomObjectFromList <SimDescription>(aliens);

            Target.SimDescription.Pregnancy = new Pregnancy(Target, alien);
            Target.BuffManager.AddElement(BuffNames.Abducted, Origin.FromPregnancy);

            return(true);
        }
예제 #10
0
        public override bool Run()
        {
            List <SimDescription> aliens = AlienUtilsEx.GetAliens();

            if (aliens == null)
            {
                Logger.Append("Debug - Trigger Alien Visit: No Aliens");
                return(false);
            }

            SimDescription alien = RandomUtil.GetRandomObjectFromList <SimDescription>(aliens);

            Lot farthestLot = LotManager.GetFarthestLot(Target);
            Sim visitor     = alien.InstantiateOffScreen(farthestLot);

            AlienSituation.Create(visitor, Target);

            return(true);
        }
예제 #11
0
            public override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!Aliens.Settings.Debugging)
                {
                    return(false);
                }

                if (Household.AlienHousehold == null)
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("Alien household is null.");
                    return(false);
                }

                if (AlienUtils.IsHouseboatAndNotDocked(target.LotCurrent))
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("Target is on an undocked houseboat.");
                    return(false);
                }

                if (AlienUtilsEx.GetValidAliens() == null)
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("No valid aliens.");
                    return(false);
                }

                if (!target.SimDescription.IsHuman)
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("Target is not human.");
                    return(false);
                }

                if (target.SimDescription.ChildOrBelow)
                {
                    greyedOutTooltipCallback = CreateTooltipCallback("Target is not teen or older.");
                    return(false);
                }

                return(true);
            }
예제 #12
0
        public override List <Sim> CreateNewborns(float bonusMoodPoints, bool interactive, bool homeBirth)
        {
            SimDescription     alien     = null;
            MiniSimDescription miniAlien = null;

            if (mDad != null && !mDad.HasBeenDestroyed)
            {
                alien = mDad.SimDescription;
            }

            if (alien == null)
            {
                alien = SimDescription.Find(DadDescriptionId);

                if (alien == null)
                {
                    miniAlien = MiniSimDescription.Find(DadDescriptionId);

                    if (miniAlien != null)
                    {
                        alien = miniAlien.UnpackSim();

                        if (alien != null)
                        {
                            Household household = Household.Create(false);

                            if (household != null)
                            {
                                household.AddTemporary(alien);
                                alien.Genealogy.SetSimDescription(alien);
                            }
                        }
                        else
                        {
                            miniAlien = null;
                        }
                    }
                }
            }

            float  averageMoodForBirth = GetAverageMoodForBirth(alien, bonusMoodPoints);
            Random pregoRandom         = new Random(mRandomGenSeed);
            int    numSimMembers       = 0;
            int    numPetMembers       = 0;

            mMom.Household.GetNumberOfSimsAndPets(true, out numSimMembers, out numPetMembers);
            int        numForBirth = GetNumForBirth(alien, pregoRandom, numSimMembers, numPetMembers);
            Random     gen         = new Random(mRandomGenSeed);
            List <Sim> list        = new List <Sim>();

            for (int i = 0; i < numForBirth; i++)
            {
                DetermineGenderOfBaby(gen);
                CASAgeGenderFlags gender = mGender;
                mGender = CASAgeGenderFlags.None;
                SimDescription babyDescription = AlienUtilsEx.MakeAlienBaby(alien, mMom.SimDescription, gender, averageMoodForBirth, pregoRandom, interactive);
                mMom.Household.Add(babyDescription);
                Sim baby = babyDescription.Instantiate(Vector3.Empty);
                baby.SetPosition(mMom.Position);

                if (homeBirth)
                {
                    TotallyHideBaby(baby);
                }

                list.Add(baby);
                CheckForGhostBaby(baby);

                if (baby.SimDescription.IsPlayableGhost)
                {
                    EventTracker.SendEvent(EventTypeId.kHadGhostBaby, mMom, baby);
                }

                if (i == 0)
                {
                    EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBaby, baby.SimDescription));
                }

                MidlifeCrisisManager.OnHadChild(mMom.SimDescription);
                EventTracker.SendEvent(EventTypeId.kNewOffspring, mMom, baby);
                //EventTracker.SendEvent(EventTypeId.kParentAdded, baby, mMom);

                if (mDad != null)
                {
                    EventTracker.SendEvent(EventTypeId.kNewOffspring, mDad, baby);
                    EventTracker.SendEvent(EventTypeId.kParentAdded, baby, mDad);
                }

                EventTracker.SendEvent(EventTypeId.kChildBornOrAdopted, null, baby);
            }

            if (miniAlien != null)
            {
                alien.Household.Destroy();
                alien.Household.RemoveTemporary(alien);
                alien.Dispose(true, true);
            }

            if (mMom.Household != null)
            {
                mMom.Household.InvalidateThumbnail();
            }

            switch (numForBirth)
            {
            case 1:
                EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBabySingle, mMom.SimDescription));
                break;

            case 2:
                EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBabyTwins, mMom.SimDescription));
                break;

            case 3:
                EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBabyTriplets, mMom.SimDescription));
                break;
            }

            return(list);
        }
예제 #13
0
        public static bool Run(CarUFO.AbductSimA ths)
        {
            if (ths.Target.InUse)
            {
                return(false);
            }

            ths.mNPCAbductor = (ths.SimToAbduct != null);

            if (!ths.mNPCAbductor)
            {
                ths.SimToAbduct = ths.GetSelectedObject() as Sim;
            }

            if (ths.SimToAbduct == null)
            {
                return(false);
            }

            ths.StandardEntry();

            if (!ths.SetupAbductee())
            {
                ths.StandardExit();
                return(false);
            }

            Animation.ForceAnimation(ths.Actor.ObjectId, true);
            Animation.ForceAnimation(ths.Target.ObjectId, true);
            ths.Target.mTakeOffPos = ths.Actor.Position;

            if (!ths.Target.RouteToUFOAndTakeOff(ths.Actor))
            {
                ths.StandardExit();
                return(false);
            }

            Camera.FocusOnGivenPosition(ths.mJig.Position, CarUFO.kAbductLerpParams, true);
            ths.BeginCommodityUpdates();
            bool flag = ths.AbductSim();

            ths.EndCommodityUpdates(true);
            Sim[] sims;

            if (flag)
            {
                EventTracker.SendEvent(EventTypeId.kAbductSimUFO, ths.Actor, ths.SimToAbduct);
                sims = new Sim[] { ths.Actor, ths.SimToAbduct };

                if (ths.mNPCAbductor)
                {
                    ths.DoTimedLoop(AlienUtils.kAbductionLength, ExitReason.None);
                }
            }
            else
            {
                sims = new Sim[] { ths.Actor };
            }

            DateAndTime previous   = SimClock.CurrentTime();
            Vector3     landRefPos = ths.GetLandingRefPos(ths.mNPCAbductor);

            while (!ths.Target.TryLandUFOAndExitSims(sims, landRefPos, true))
            {
                Simulator.Sleep(30u);

                if (SimClock.ElapsedTime(TimeUnit.Minutes, previous) > 30f)
                {
                    ths.Target.ForceExitUFODueToLandingFailure(sims);
                    break;
                }
            }

            ths.mFromInventory = (ths.mFromInventory || ths.mNPCAbductor);

            if (ths.mFromInventory)
            {
                ths.mFromInventory = ths.Actor.Inventory.TryToAdd(ths.Target);
            }

            if (!ths.mFromInventory)
            {
                ths.Target.ParkUFO(ths.Actor.LotHome, ths.Actor);
            }

            if (flag)
            {
                if (ths.mNPCAbductor)
                {
                    if (AlienUtilsEx.IsImpregnationSuccessful(ths.SimToAbduct, ths.Actor))
                    {
                        ths.SimToAbduct.SimDescription.Pregnancy = new Pregnancy(ths.SimToAbduct, ths.Actor.SimDescription);
                        ths.SimToAbduct.TraitManager.AddHiddenElement(AlienUtilsEx.sAlienPregnancy);
                    }

                    ths.SimToAbduct.BuffManager.AddElement(BuffNames.Abducted, Origin.FromAbduction);
                    ThoughtBalloonManager.BalloonData data = new ThoughtBalloonManager.BalloonData(ths.Actor.GetThumbnailKey());
                    data.BalloonType = ThoughtBalloonTypes.kThoughtBalloon;
                    data.LowAxis     = ThoughtBalloonAxis.kDislike;
                    data.Duration    = ThoughtBalloonDuration.Medium;
                    data.mPriority   = ThoughtBalloonPriority.High;
                    ths.SimToAbduct.ThoughtBalloonManager.ShowBalloon(data);
                    ths.SimToAbduct.PlayReaction(AlienUtils.kAbductionReactions[RandomUtil.GetInt(0, AlienUtils.kAbductionReactions.Length - 1)], ReactionSpeed.NowOrLater);
                    ths.SimToAbduct.ShowTNSIfSelectable(CarUFO.LocalizeString(ths.SimToAbduct.IsFemale, "NPCAbductionTNS", new object[] { ths.SimToAbduct.ObjectId }),
                                                        StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, ths.SimToAbduct.ObjectId);
                }
                else
                {
                    Sim.ForceSocial(ths.Actor, ths.SimToAbduct, "Reveal Prank", InteractionPriorityLevel.High, true);
                }

                ths.FinishLinkedInteraction(true);
            }

            ths.StandardExit();

            if (flag)
            {
                ths.WaitForSyncComplete();
            }

            return(flag);
        }