예제 #1
0
        public static void FalselyAccuseCheck(CelebrityManager This)
        {
            if (This.OwnerSim != null && !CantBeDisgraced(This) && !This.OwnerSim.IsSelectable)
            {
                Sim ownerSim = This.OwnerSim;
                if (This.Owner == null)
                {
                    return;
                }
                float num = 0f;

                List <IMiniRelationship> miniRelationships = Relationship.GetMiniRelationships(This.Owner);
                foreach (IMiniRelationship item in miniRelationships)
                {
                    switch (item.CurrentLTR)
                    {
                    case LongTermRelationshipTypes.Enemy:
                    case LongTermRelationshipTypes.OldEnemies:
                        num += 1f;
                        break;
                    }
                }
                float val = CelebrityManager.kBaseAccusationChance[This.Level - 1] + num * CelebrityManager.kPerEnemyAccusationChance[This.Level - 1];
                if (RandomUtil.RandomChance01(Math.Min(val, CelebrityManager.kMaxAccusationChance[This.Level - 1])))
                {
                    ownerSim.AddAlarm(RandomUtil.GetFloat(CelebrityManager.kFalselyAccuseMinDelay, CelebrityManager.kFalselyAccuseMaxDelay), TimeUnit.Minutes, This.TriggerFalseAccusation, "CelebrityManager: False Accusation delay alarm", AlarmType.AlwaysPersisted);
                }
            }
        }
예제 #2
0
 private void OnRouteToPartyFailed(Sim participant, float x)
 {
     if (participant.LotCurrent != Lot)
     {
         if (!participant.IsSelectable)
         {
             if (!mNumRouteFailures.ContainsKey(participant))
             {
                 mNumRouteFailures[participant] = 0x1;
             }
             else
             {
                 mNumRouteFailures[participant] += 0x1;
             }
             RouteSoon soon = new RouteSoon();
             soon.Guest = participant;
             soon.Party = this;
             participant.AddAlarm(5f, TimeUnit.Minutes, new AlarmTimerCallback(soon.Callback), "Delayed Route to Party", AlarmType.DeleteOnReset);
         }
     }
     else
     {
         OnRouteToPartySucceeded(participant, x);
     }
 }
예제 #3
0
        public void SetAnotherAlarm(Business business)
        {
            Sim         createdSim = business.SimConspiringPrank.CreatedSim;
            AlarmHandle sureShotEventAlarmHandle = business.CareerEventManager.SureShotEventAlarmHandle;

            createdSim.RemoveAlarm(sureShotEventAlarmHandle);
            float time = (float)Math.Max(0.0, (double)Math.Min(Business.kTimeToWaitForNextPrankAttempt, this.GetTimeUntilEvent(business)));

            business.CareerEventManager.SureShotEventAlarmHandle = createdSim.AddAlarm(time, TimeUnit.Hours, new AlarmTimerCallback(business.CareerEventManager.SureShotEventDelegate), "SureShotCareerEventAlarmTwo", AlarmType.AlwaysPersisted);
        }
예제 #4
0
            public void DoSymptom()
            {
                if (!mPlaguedSim.BuffManager.HasElement(BuffNames.AllergyHaze))
                {
                    return;
                }
                int symptomType = RandomUtil.GetInt(1, 2);

                if (symptomType == 1)
                {
                    mPlaguedSim.InteractionQueue.AddNext(ZoneOut.Singleton.CreateInstance(mPlaguedSim,
                                                                                          mPlaguedSim, new InteractionPriority(InteractionPriorityLevel.High), isAutonomous: true,
                                                                                          cancellableByPlayer: false));
                }
                else
                {
                    mPlaguedSim.BuffManager.AddElement(BuffNames.CottonMouth, (Origin)ResourceUtils
                                                       .HashString64("fromEWAllergies"));
                }

                mSymptomAlarm = mPlaguedSim.AddAlarm(RandomUtil.GetFloat(kMinTimeBetweenSymptoms,
                                                                         kMaxTimeBetweenSymptoms), TimeUnit.Minutes, DoSymptom, "BuffEWAllergies: Time until next symptom",
                                                     AlarmType.DeleteOnReset);
            }
예제 #5
0
            public void DoSymptom()
            {
                int symptomType;

                // Not sure how the moodlet gets removed without clearing the alarm, but it
                // appears to be happening.
                if (!mPlaguedSim.BuffManager.HasElement(BuffNames.Germy))
                {
                    return;
                }
                if (mPlaguedSim.IsSleeping)
                {
                    // if sim is sleeping 50% nothing will happen
                    // Since cough/sneeze wakes up the sim, too much is just too much
                    symptomType = RandomUtil.GetInt(1, 4);
                }
                else
                {
                    symptomType = RandomUtil.GetInt(1, 2);
                }
                if (symptomType == 1)
                {
                    mPlaguedSim.InteractionQueue.AddNext(Cough.Singleton.CreateInstance(mPlaguedSim,
                                                                                        mPlaguedSim, new InteractionPriority(InteractionPriorityLevel.High), isAutonomous: true,
                                                                                        cancellableByPlayer: false));
                }
                else if (symptomType == 2)
                {
                    mPlaguedSim.InteractionQueue.AddNext(Sneeze.Singleton.CreateInstance(mPlaguedSim,
                                                                                         mPlaguedSim, new InteractionPriority(InteractionPriorityLevel.High), isAutonomous: true,
                                                                                         cancellableByPlayer: false));
                }
                mSymptomAlarm = mPlaguedSim.AddAlarm(RandomUtil.GetFloat(kMinTimeBetweenSymptoms,
                                                                         kMaxTimeBetweenSymptoms), TimeUnit.Minutes, DoSymptom, "BuffEWGermy: Time until next symptom",
                                                     AlarmType.DeleteOnReset);
            }
예제 #6
0
        public static ListenerAction OnFindSimCommittedDisgracefulAction(Event e)
        {
            if (CelebrityUtil.sCelebrityDisgracefulActionData == null) // EA Fail if not EP Installed.
            {
                return(ListenerAction.Keep);
            }

            try
            {
                DisgracefulActionEvent disgracefulActionEvent = e as DisgracefulActionEvent;
                if (disgracefulActionEvent == null)
                {
                    return(ListenerAction.Keep);
                }

                Sim sim = disgracefulActionEvent.Actor as Sim;
                if (sim == null)
                {
                    return(ListenerAction.Keep);
                }

                SimDescription findsim = sim.SimDescription;

                if (findsim == null)
                {
                    return(ListenerAction.Keep);
                }

                if (findsim == null || !findsim.IsValid || !findsim.IsValidDescription || !findsim.IsCelebrity)
                {
                    return(ListenerAction.Keep);
                }

                Household household = findsim.Household;
                if (household != null && household == Household.ActiveHousehold)
                {
                    return(ListenerAction.Keep);
                }

                CelebrityManager celma = findsim.CelebrityManager;
                if (celma == null || CantBeDisgraced(celma))
                {
                    return(ListenerAction.Keep);
                }



                //SimDescription simDescription = sim.SimDescription;

                DisgracefulActionType disgracefulActionType = disgracefulActionEvent.DisgracefulActionType;
                CelebrityDisgracefulActionStaticData value;

                if (!CelebrityUtil.sCelebrityDisgracefulActionData.TryGetValue(disgracefulActionType, out value))
                {
                    return(ListenerAction.Keep);
                }

                if (celma.mDisgracefulActionQueue != null)
                {
                    foreach (DisgracefulActionEvent item in celma.mDisgracefulActionQueue)
                    {
                        if (item.TargetId == disgracefulActionEvent.TargetId && item.DisgracefulActionType == disgracefulActionEvent.DisgracefulActionType)
                        {
                            return(ListenerAction.Keep);
                        }
                    }
                }

                if (RandomUtil.RandomChance01(value.Chance) || RandomUtil.RandomChance01(65))
                {
                    if (celma.mDisgracefulActionQueue == null)
                    {
                        celma.mDisgracefulActionQueue = new List <DisgracefulActionEvent>();
                    }

                    celma.mDisgracefulActionQueue.Add(disgracefulActionEvent);

                    sim.AddAlarm(30, TimeUnit.Minutes, delegate
                    {
                        try
                        {
                            STriggerDisgrace(celma);
                        }
                        catch (ResetException)
                        { throw; }
                        catch { }
                    },
                                 null, AlarmType.NeverPersisted);
                }
            }
            //catch (ResetException){ throw; }
            catch { }
            return(ListenerAction.Keep);
        }
예제 #7
0
        public ListenerAction OnSimCommittedDisgracefulAction(Event e)
        {
            if (CelebrityUtil.sCelebrityDisgracefulActionData == null) // EA Fail if not Installed.
            {
                return(ListenerAction.Remove);
            }

            if (CelebrityManager_ == null)
            {
                return(ListenerAction.Remove);
            }

            if (CantBeDisgraced(CelebrityManager_))
            {
                return(ListenerAction.Keep);
            }

            DisgracefulActionEvent disgracefulActionEvent = e as DisgracefulActionEvent;

            if (disgracefulActionEvent == null)
            {
                return(ListenerAction.Keep);
            }
            Sim sim = disgracefulActionEvent.Actor as Sim;

            if (sim == null)
            {
                return(ListenerAction.Keep);
            }
            SimDescription simDescription = sim.SimDescription;

            if (simDescription == null || !simDescription.IsValid || !simDescription.IsValidDescription)
            {
                return(ListenerAction.Keep);
            }
            DisgracefulActionType disgracefulActionType = disgracefulActionEvent.DisgracefulActionType;
            CelebrityDisgracefulActionStaticData value;

            if (!CelebrityUtil.sCelebrityDisgracefulActionData.TryGetValue(disgracefulActionType, out value))
            {
                return(ListenerAction.Keep);
            }
            if (CelebrityManager_.mDisgracefulActionQueue != null)
            {
                foreach (DisgracefulActionEvent item in CelebrityManager_.mDisgracefulActionQueue)
                {
                    if (item.TargetId == disgracefulActionEvent.TargetId && item.DisgracefulActionType == disgracefulActionEvent.DisgracefulActionType)
                    {
                        return(ListenerAction.Keep);
                    }
                }
            }

            if (RandomUtil.RandomChance01(value.Chance))
            {
                if (CelebrityManager_.mDisgracefulActionQueue == null)
                {
                    CelebrityManager_.mDisgracefulActionQueue = new List <DisgracefulActionEvent>();
                }
                CelebrityManager_.mDisgracefulActionQueue.Add(disgracefulActionEvent);
                sim.AddAlarm(CelebrityManager.kDelayBeforeDisgracefulActionIsKnown, TimeUnit.Minutes, TriggerDisgrace, "CelebrityManager: Disgrace delay alarm", AlarmType.AlwaysPersisted);
            }
            return(ListenerAction.Keep);
        }
예제 #8
0
        public override bool Continue(Sim mom, bool momJustCreated)
        {
            if (mom == null)
            {
                return(false);
            }

            if (momJustCreated)
            {
                mHasRequestedWalkStyle = false;
            }

            mMom = mom;
            mDad = null;
            CheckForDad();
            mTimeMoodSampled              = SimClock.CurrentTime();
            mMom.MoodManager.MoodChanged += new MoodManager.MoodChangedCallback(MoodManager_MoodChanged);
            ActiveTopic.AddToSim(mom, "Pregnancy");

            if (momJustCreated)
            {
                PreggersAlarm = mom.AddAlarmRepeating(1f, TimeUnit.Hours, new AlarmTimerCallback(HourlyCallback), 1f, TimeUnit.Hours,
                                                      "Hourly Alien Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
            }

            mom.SimDescription.Pregnancy = this;
            int arg_C0_0 = mHourOfPregnancy;
            int arg_BF_0 = Aliens.Settings.mPregnancyShow;

            if (mHourOfPregnancy >= Aliens.Settings.mPregnancyShow)
            {
                if (mHourOfPregnancy < Aliens.Settings.mStartLabor)
                {
                    mMom.BuffManager.AddElement(BuffsAndTraits.sXenogenesis, Origin.FromPregnancy);
                }

                ActiveTopic.AddToSim(mMom, "Announce Pregnancy");
            }

            if (mHourOfPregnancy >= Aliens.Settings.mStartWalk)
            {
                ActiveTopic.AddToSim(mMom, "Pregnant", mMom.SimDescription);
                RequestPregnantWalkStyle();
            }

            if (mHourOfPregnancy >= Aliens.Settings.mStartLabor)
            {
                mMom.BuffManager.AddElement(BuffsAndTraits.sAlienBabyIsComing, Origin.FromPregnancy);

                if (mContractionBroadcast != null)
                {
                    mContractionBroadcast.Dispose();
                }

                mContractionBroadcast = new ReactionBroadcaster(mMom, kContractionBroadcasterParams,
                                                                new ReactionBroadcaster.BroadcastCallback(StartReaction), new ReactionBroadcaster.BroadcastCallback(CancelReaction));
                mMom.AddInteraction(TakeToHospitalEx.Singleton);
                InteractionInstance entry = HaveContraction.Singleton.CreateInstance(mMom, mMom,
                                                                                     new InteractionPriority(InteractionPriorityLevel.High, 10f), false, false);
                mMom.InteractionQueue.Add(entry);
                mContractionsAlarm = mMom.AddAlarmRepeating(5f, TimeUnit.Minutes, new AlarmTimerCallback(TriggerContraction), 5f, TimeUnit.Minutes,
                                                            "Trigger Contractions Alarm", AlarmType.AlwaysPersisted);
            }

            if (mHourOfPregnancy == Aliens.Settings.mPregnancyDuration)
            {
                mMom.AddAlarm(1f, TimeUnit.Minutes, new AlarmTimerCallback(HaveTheBaby), "Re-have the baby.", AlarmType.AlwaysPersisted);
            }

            SetPregoBlendShape();

            if (mMom.SimDescription.IsVisuallyPregnant)
            {
                TryToGiveLeave();
            }

            return(true);
        }
예제 #9
0
        public override bool Continue(Sim mom, bool momJustCreated)
        {
            if (mom == null)
            {
                return(false);
            }

            if (momJustCreated)
            {
                mHasRequestedWalkStyle = false;
            }

            mMom = mom;
            mDad = null;
            SimDescription simDescription;

            if (RobotDadDescriptionID != 0uL)
            {
                simDescription = SimDescription.Find(RobotDadDescriptionID);
            }
            else
            {
                simDescription = SimDescription.Find(DadDescriptionId);
            }

            if (simDescription != null && simDescription.IsMale && simDescription.TeenOrAbove)
            {
                mDad = simDescription.CreatedSim;
            }

            mTimeMoodSampled              = SimClock.CurrentTime();
            mMom.MoodManager.MoodChanged += new MoodManager.MoodChangedCallback(MoodManager_MoodChanged);
            ActiveTopic.AddToSim(mom, "Pregnancy");

            if (momJustCreated)
            {
                PreggersAlarm = mom.AddAlarmRepeating(1f, TimeUnit.Hours, new AlarmTimerCallback(HourlyCallback), 1f, TimeUnit.Hours,
                                                      "Hourly Robot Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
            }

            mom.SimDescription.Pregnancy = this;
            int arg_C0_0 = mHourOfPregnancy;

            if (mHourOfPregnancy >= 0)
            {
                if (mHourOfPregnancy < Woohooer.Settings.mRobotHoursOfPregnancy)
                {
                    mMom.BuffManager.AddElement(BuffNames.Pregnant, Origin.FromPregnancy);
                }

                ActiveTopic.AddToSim(mMom, "Announce Pregnancy");

                if (mDad != null && !mDad.HasBeenDestroyed)
                {
                    ActiveTopic.AddToSim(mDad, "Pregnant", mDad.SimDescription);
                }
            }

            if (mHourOfPregnancy >= Woohooer.Settings.mRobotHourToStartWalkingPregnant)
            {
                ActiveTopic.AddToSim(mMom, "Pregnant", mMom.SimDescription);
                RequestPregnantWalkStyle();
            }

            // Robots will not have a labor stage.

            if (mHourOfPregnancy == Woohooer.Settings.mRobotHoursOfPregnancy)
            {
                mMom.AddAlarm(1f, TimeUnit.Minutes, new AlarmTimerCallback(HaveTheBaby), "Have the baby", AlarmType.AlwaysPersisted);
            }

            TryToGiveLeave();

            return(true);
        }
예제 #10
0
        public override bool Continue(Sim mom, bool momJustCreated)
        {
            if (mom == null)
            {
                return(false);
            }

            if (momJustCreated)
            {
                mHasRequestedWalkStyle = false;
            }

            mMom                          = mom;
            mDad                          = null;
            mTimeMoodSampled              = SimClock.CurrentTime();
            mMom.MoodManager.MoodChanged += new MoodManager.MoodChangedCallback(MoodManager_MoodChanged);
            ActiveTopic.AddToSim(mom, "Pregnancy");

            if (momJustCreated)
            {
                PreggersAlarm = mom.AddAlarmRepeating(1f, TimeUnit.Hours, new AlarmTimerCallback(HourlyCallback), 1f, TimeUnit.Hours,
                                                      "Hourly Human Surrogate Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
            }

            mom.SimDescription.Pregnancy = this;
            int arg_C0_0 = mHourOfPregnancy;
            int arg_BF_0 = kHourToShowPregnantBuff;

            if (mHourOfPregnancy >= kHourToShowPregnantBuff)
            {
                if (mHourOfPregnancy < kHourToStartContractions)
                {
                    mMom.BuffManager.AddElement(BuffNames.Pregnant, Origin.FromPregnancy);
                }

                ActiveTopic.AddToSim(mMom, "Announce Pregnancy");
            }

            if (mHourOfPregnancy >= kHourToStartWalkingPregnant)
            {
                ActiveTopic.AddToSim(mMom, "Pregnant", mMom.SimDescription);
                RequestPregnantWalkStyle();
            }

            if (mHourOfPregnancy >= kHourToStartContractions)
            {
                // Add BabyIsComing moodlet here!

                if (mContractionBroadcast != null)
                {
                    mContractionBroadcast.Dispose();
                }

                mContractionBroadcast = new ReactionBroadcaster(mMom, kContractionBroadcasterParams,
                                                                new ReactionBroadcaster.BroadcastCallback(StartReaction), new ReactionBroadcaster.BroadcastCallback(CancelReaction));
                // Add TakeToHospital interaction here!
                InteractionInstance entry = HaveContraction.Singleton.CreateInstance(mMom, mMom,
                                                                                     new InteractionPriority(InteractionPriorityLevel.High, 10f), false, false);
                mMom.InteractionQueue.Add(entry);
                mContractionsAlarm = mMom.AddAlarmRepeating(5f, TimeUnit.Minutes, new AlarmTimerCallback(TriggerContraction), 5f, TimeUnit.Minutes,
                                                            "Trigger Contractions Alarm", AlarmType.AlwaysPersisted);
            }

            if (mHourOfPregnancy == kHoursOfPregnancy)
            {
                mMom.AddAlarm(1f, TimeUnit.Minutes, new AlarmTimerCallback(HaveTheBaby), "Re-have the baby", AlarmType.AlwaysPersisted);
            }

            SetPregoBlendShape();

            if (mMom.SimDescription.IsVisuallyPregnant)
            {
                TryToGiveLeave();
            }

            return(true);
        }