コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public static bool Run(RoutineMachine.TeleportBase ths)
        {
            IGameObject obj2;

            if (!ths.Actor.CaregiverCheck())
            {
                return(false);
            }
            else if ((ths.Actor.CarryingChildPosture != null) || (ths.Actor.CarryingPetPosture != null))
            {
                return(false);
            }

            bool flag = ths.PreTeleport(out obj2, out ths.mTargetLot);

            if (!flag)
            {
                return(false);
            }

            ths.OutfitHelper.Start();
            if (ths.Target.Repairable.Broken || ths.Target.Charred)
            {
                if (ths.Actor.RouteToSlotAndCheckInUse(ths.Target, Slot.RoutingSlot_0))
                {
                    ths.StandardEntry();
                    ths.EnterStateMachine("routinemachine_store", "EnterGetReady", "x", "routinemachine");
                    ths.mCurrentStateMachine.SetParameter("tired", SimClock.IsTimeBetweenTimes(RoutineMachine.TeleportBase.kSleepyTimeStart, RoutineMachine.TeleportBase.kSleepyTimeEnd));
                    ths.AnimateSim("GetInMachine");
                    ths.Target.StartPortalTeleportVisualEffects(ths.Actor);
                    ths.AnimateSim("DropThroughPortal");
                    ths.BeginCommodityUpdates();
                    ths.AnimateSim("InsideDreamscape");
                    ths.Target.Repairable.UpdateBreakage(0x64, ths.Actor);
                    if (ths.Actor.SimDescription.IsFrankenstein)
                    {
                        ths.Actor.BuffManager.AddElement(BuffNames.Energized, Origin.FromElectricity);
                    }
                    else if (ths.Actor.BuffManager.HasElement(BuffNames.SingedElectricity) || ths.Actor.TraitManager.HasElement(TraitNames.Unlucky))
                    {
                        ths.Actor.Kill(SimDescription.DeathType.Electrocution, ths.Target);
                    }
                    else
                    {
                        BuffSinged.SingeViaInteraction(ths, Origin.None);
                        ths.Actor.BuffManager.AddElement(BuffNames.SingedElectricity, Origin.None);
                    }

                    FireManager.SimShockedBy(ths.Actor, ths.Target);
                    ths.AnimateSim("ReturnFromDreamscape");
                    ths.AnimateSim("ExitDreamscape");
                    ths.EndCommodityUpdates(false);
                    ths.StandardExit();
                }
                flag = false;
            }

            if (flag && ths.Actor.RouteToSlotAndCheckInUse(ths.Target, Slot.RoutingSlot_0))
            {
                OutfitCategories categories2;
                bool             flag2 = false;

                // Custom
                if (Shooless.Settings.GetPrivacy(ths.Target))
                {
                    ths.mSituation = new RoutineMachine.ShowerPrivacySituation(ths);
                    if (!ths.mSituation.Start())
                    {
                        return(false);
                    }
                }

                if (!ths.Actor.RouteToSlotAndCheckInUse(ths.Target, Slot.RoutingSlot_0))
                {
                    if (ths.mSituation != null)
                    {
                        ths.mSituation.Exit();
                        ths.mSituation = null;
                    }
                    return(false);
                }

                bool paramValue = false;
                ths.CancellableByPlayer = false;
                ths.StandardEntry();
                ths.EnterStateMachine("routinemachine_store", "EnterGetReady", "x", "routinemachine");
                ths.mCurrentStateMachine.SetParameter("tired", SimClock.IsTimeBetweenTimes(RoutineMachine.TeleportBase.kSleepyTimeStart, RoutineMachine.TeleportBase.kSleepyTimeEnd));

                if (ths.mSituation != null)
                {
                    ths.mSituation.StateMachine = ths.mCurrentStateMachine;
                }

                ths.AnimateSim("GetInMachine");

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Hunger) && (ths.Actor.Motives.GetValue(CommodityKind.Hunger) < ths.Actor.Motives.GetMax(CommodityKind.Hunger))) && (ths.Actor.Motives.GetValue(CommodityKind.Hunger) < RoutineMachine.TeleportBase.kThresholdHunger))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }
                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.AnimateSim("SatisfyHunger");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Hunger, RoutineMachine.TeleportBase.kChangeHungerTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyHungerDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                }

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Bladder) && (ths.Actor.Motives.GetValue(CommodityKind.Bladder) < ths.Actor.Motives.GetMax(CommodityKind.Bladder))) && (ths.Actor.Motives.GetValue(CommodityKind.Bladder) < RoutineMachine.TeleportBase.kThresholdBladder))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }
                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.Actor.EnableCensor(Sim.CensorType.LowerBody);
                    ths.AnimateSim("SatisfyBladder");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Bladder, RoutineMachine.TeleportBase.kChangeBladderTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyBladderDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                }

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Hygiene) && (ths.Actor.Motives.GetValue(CommodityKind.Hygiene) < ths.Actor.Motives.GetMax(CommodityKind.Hygiene))) && (ths.Actor.Motives.GetValue(CommodityKind.Hygiene) < RoutineMachine.TeleportBase.kThresholdHygiene))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }

                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.AddSynchronousOneShotScriptEventHandler(0x3e9, ths.ShowerStartEvent);
                    ths.AddSynchronousOneShotScriptEventHandler(0x3ea, ths.ShowerEndEvent);
                    OutfitCategories naked = OutfitCategories.Naked;
                    if (ths.Actor.TraitManager.HasElement(TraitNames.NeverNude))
                    {
                        naked = OutfitCategories.Swimwear;
                    }
                    else
                    {
                        ths.Actor.EnableCensor(Sim.CensorType.FullBody);
                    }

                    using (Sim.SwitchOutfitHelper helper = new Sim.SwitchOutfitHelper(ths.Actor, Sim.ClothesChangeReason.GoingToBathe, naked, false))
                    {
                        helper.Start();
                        helper.Wait(false);
                        helper.ChangeOutfit();
                    }

                    flag2 = true;
                    ths.AnimateSim("SatisfyHygenie");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Hygiene, RoutineMachine.TeleportBase.kChangeHygieneTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyHygieneDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                    BuffManager buffManager = ths.Actor.BuffManager;
                    buffManager.RemoveElement(BuffNames.Singed);
                    buffManager.RemoveElement(BuffNames.SingedElectricity);
                    buffManager.RemoveElement(BuffNames.GarlicBreath);
                    if (ths.Actor.SimDescription.IsMummy)
                    {
                        buffManager.AddElement(BuffNames.Soaked, Origin.FromShower);
                    }
                    if (ths.Actor.HasTrait(TraitNames.Hydrophobic))
                    {
                        ths.Actor.PlayReaction(ReactionTypes.Cry, ths.Target, ReactionSpeed.AfterInteraction);
                    }
                }

                if (ths.Actor.GetOutfitForClothingChange(ths.NewClothesStyle, out categories2) || flag2)
                {
                    ths.mCurrentStateMachine.SetParameter("inAirIdle", paramValue);
                    ths.AnimateSim("PrepareToChangeClothes");
                    using (Sim.SwitchOutfitHelper helper2 = new Sim.SwitchOutfitHelper(ths.Actor, Sim.ClothesChangeReason.Force, categories2))
                    {
                        helper2.Start();
                        helper2.Wait(false);
                        helper2.ChangeOutfit();
                    }
                }

                ths.Actor.AutoEnableCensor();
                ths.AddSynchronousOneShotScriptEventHandler(0x64, ths.TeleportOutEvent);
                ths.AnimateSim("DropThroughPortal");
                ths.Target.StopSpeakerEffects();
                if (ths.mSituation != null)
                {
                    ths.mSituation.Exit();
                    ths.mSituation = null;
                }

                if (ths.Actor.Motives.GetValue(CommodityKind.Energy) < RoutineMachine.TeleportBase.kMinEnergyToTeleport)
                {
                    ths.Target.StartDreamscapeEffects();
                    ths.Target.Repairable.UpdateBreakage(0x64, ths.Actor);
                    ths.RunDreamscape();
                    ths.Target.StopDreamscapeEffects();
                }

                flag = ths.DoTeleport(obj2);
                ths.AnimateSim("ExitGetReady");
                ths.EnterStateMachine("routinemachine_store", "EnterBeTeleported", "x", "routinemachine");
                ths.AddSynchronousOneShotScriptEventHandler(0x64, ths.TeleportBackEvent);
                ths.AnimateSim("BeTeleported");
                ths.AnimateSim("ExitBeTeleported");
                ths.StandardExit();
            }

            ths.Target.StopPortalReturnVisualEffects();
            if (ths.mSituation != null)
            {
                ths.mSituation.Exit();
            }
            return(flag);
        }
コード例 #3
0
        public override bool Run()
        {
            try
            {
                Definition interactionDefinition = InteractionDefinition as Definition;

                mIsJoin = interactionDefinition.IsJoin;
                if (!Actor.RoutingComponent.RouteToObjectRadialRange(Target, WeatherStone.kSummonWeatherRouteDistance[0], WeatherStone.kSummonWeatherRouteDistance[1], AlwaysRoute ? new Route.RouteOption[] { Route.RouteOption.DoNotEmitDegenerateRoutesForRadialRangeGoals } : null))
                {
                    return(false);
                }

                if ((interactionDefinition.mType == WeatherStone.SummonWeatherType.HuntersStorm) && !Actor.BuffManager.HasElement(BuffNames.Werewolf))
                {
                    InteractionInstance instance = OccultWerewolf.TransformationToWerewolf.Singleton.CreateInstance(Actor, Actor, GetPriority(), Autonomous, CancellableByPlayer);
                    if (instance != null)
                    {
                        if (instance.RunInteraction())
                        {
                            Actor.ClearExitReasons();
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }

                if (!Target.TryStartSummoningWeather(Actor, interactionDefinition.mType, mIsJoin))
                {
                    if (mIsJoin || !Target.TryStartSummoningWeather(Actor, interactionDefinition.mType, true))
                    {
                        Sim createdSim = null;
                        if (Target.mSummoningSimDescriptionId != 0L)
                        {
                            createdSim = SimDescription.GetCreatedSim(Target.mSummoningSimDescriptionId);
                        }
                        Actor.PlayRouteFailure(createdSim);
                        return(false);
                    }
                    mIsJoin = true;
                }

                StandardEntry();
                EnterStateMachine("SummonWeather", "Enter", "x");
                if (Target.mSummonWeatherType == WeatherStone.SummonWeatherType.BewitchingRain)
                {
                    StartLightningEffects();
                }

                AnimateSim(interactionDefinition.mType.ToString());
                BeginCommodityUpdates();
                if (mIsJoin)
                {
                    mSummonWeatherTimeRemaining = WeatherStone.kSummonWeatherDetermineOutcomeTime[1] + 10f;
                }
                else
                {
                    mSummonWeatherTimeRemaining = RandomUtil.GetFloat(WeatherStone.kSummonWeatherDetermineOutcomeTime[0], WeatherStone.kSummonWeatherDetermineOutcomeTime[1]);
                }

                bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), SummonLoop, mCurrentStateMachine);
                EndCommodityUpdates(succeeded);
                StandardExit();
                switch (Target.CurrentWeatherStoneState)
                {
                case WeatherStone.WeatherStoneState.AfterSuccessfulSummon:
                    AnimateSim("Success");
                    BuffNames buffNameFromSummonWeatherType = WeatherStone.GetBuffNameFromSummonWeatherType(Target.mSummonWeatherType);
                    if (buffNameFromSummonWeatherType != BuffNames.Undefined)
                    {
                        Actor.BuffManager.AddElement(buffNameFromSummonWeatherType, Origin.FromWeatherStone);
                    }
                    if (!mIsJoin)
                    {
                        Target.StopElectrifiedEffect();
                    }
                    break;

                case WeatherStone.WeatherStoneState.AfterFailureSummon:
                    if (!Target.mUseExtremeFailure)
                    {
                        AnimateSim("FailureNormal");
                    }
                    else
                    {
                        BuffSinged.SingeViaInteraction(this, Origin.FromLightning);
                        AnimateSim("FailureExtreme");
                    }

                    if (!HasOtherSimsSummoning(Actor))
                    {
                        Target.AnimateChangeWeatherStoneState(false, WeatherStone.WeatherStoneState.Resting);
                    }
                    break;

                default:
                    if (!mIsJoin)
                    {
                        Target.OnSummoningStoppedEarly();
                    }
                    AnimateSim("FailureNormal");
                    break;
                }

                AnimateSim("Exit");
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }