// Token: 0x06006FAE RID: 28590 RVA: 0x0026BB9C File Offset: 0x0026AB9C //[DoesntRequireTuning] public override bool Run() { try { try { if (!this.CreateGraveStone()) { return(false); } } catch (Exception exception) { NiecException.PrintMessage("CreateGraveStone " + exception.Message + NiecException.NewLine + exception.StackTrace); } try { SMCDeath = StateMachineClient.Acquire(this.Actor, "DeathSequence"); this.mSMCDeath = SMCDeath; this.mSMCDeath.SetActor("y", this.Target); this.mSMCDeath.SetActor("grave", this.mGrave); this.mSMCDeath.EnterState("y", "Enter"); } catch (Exception exception) { NiecException.PrintMessage("SMCDeath " + exception.Message + NiecException.NewLine + exception.StackTrace); } if (this.Target.SimDescription.DeathStyle == SimDescription.DeathType.Drown) { if (!this.RouteGrimReaperToEdgeOfTargetPool()) { this.Actor.RouteTurnToFace(this.Target.Position); } } else if (!this.mSituation.mIsFirstSim) { Route route = this.Actor.CreateRoute(); route.PlanToPointRadialRange(this.Target.Position, 1f, 5f, RouteDistancePreference.PreferNearestToRouteDestination, RouteOrientationPreference.TowardsObject, this.Target.LotCurrent.LotId, null); this.Actor.DoRoute(route); } else { this.mSituation.mIsFirstSim = false; } this.PlaceGraveStone(); this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.GravePlaced; this.Actor.RouteTurnToFace(this.Target.Position); PetStartleBehavior.CheckForStartle(this.Actor, StartleType.GrimReaperAppear); if (!this.mSituation.mIsFirstSim) { this.mSMCDeath.EnterState("x", "Enter"); } this.mSMCDeath.RequestState(true, "x", "CreateTombstone"); ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.DoubleBalloonData("balloon_moodlet_mourning", this.Target.GetThoughtBalloonThumbnailKey()); balloonData.BalloonType = ThoughtBalloonTypes.kSpeechBalloon; balloonData.mPriority = ThoughtBalloonPriority.High; this.Actor.ThoughtBalloonManager.ShowBalloon(balloonData); this.mSMCDeath.RequestState(true, "x", "ReaperPointAtGrave"); this.mSMCDeath.RequestState(false, "x", "ReaperFloating"); this.mGhostPosition = this.GetPositionForGhost(this.Target, this.mGrave); Lot lotCurrent = this.Target.LotCurrent; if (lotCurrent != this.Target.LotHome && lotCurrent.Household != null) { this.Target.GreetSimOnLot(lotCurrent); } base.RequestWalkStyle(this.Target, Sim.WalkStyle.GhostWalk); switch (this.Target.SimDescription.DeathStyle) { case SimDescription.DeathType.Drown: if (this.Target.BridgeOrigin != null) { this.Target.BridgeOrigin.MakeRequest(); } this.Target.PopPosture(); this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackSimToGhostEffectNoFadeOut)); this.mSMCDeath.AddOneShotScriptEventHandler(102u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose)); this.mSMCDeath.RequestState(true, "y", "PoseStarvation"); this.mSMCDeath.RequestState(true, "y", "StarvationToFloat"); this.mSMCDeath.RequestState(false, "y", "GhostFloating"); break; case SimDescription.DeathType.Starve: this.StartGhostExplosion(); this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose)); this.mSMCDeath.AddOneShotScriptEventHandler(102u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose)); this.mSMCDeath.RequestState(true, "y", "PoseStarvation"); this.mSMCDeath.RequestState(true, "y", "StarvationToFloat"); this.mSMCDeath.RequestState(false, "y", "GhostFloating"); this.StopGhostExplosion(); break; case SimDescription.DeathType.Electrocution: case SimDescription.DeathType.BluntForceTrauma: case SimDescription.DeathType.Ranting: this.StartGhostExplosion(); this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose)); this.mSMCDeath.AddOneShotScriptEventHandler(102u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose)); this.mSMCDeath.RequestState(true, "y", "PoseElectrocution"); this.mSMCDeath.RequestState(true, "y", "ElectrocutionToFloat"); this.mSMCDeath.RequestState(false, "y", "GhostFloating"); this.StopGhostExplosion(); break; case SimDescription.DeathType.Burn: case SimDescription.DeathType.MummyCurse: case SimDescription.DeathType.Meteor: case SimDescription.DeathType.Thirst: case SimDescription.DeathType.Transmuted: case SimDescription.DeathType.HauntingCurse: case SimDescription.DeathType.JellyBeanDeath: case SimDescription.DeathType.Jetpack: this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackSimToGhostEffectNoFadeOut)); this.mSMCDeath.AddOneShotScriptEventHandler(102u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose)); this.mSMCDeath.RequestState(true, "y", "PoseElectrocution"); this.mSMCDeath.RequestState(true, "y", "ElectrocutionToFloat"); this.mSMCDeath.RequestState(false, "y", "GhostFloating"); break; case SimDescription.DeathType.Freeze: this.StartGhostExplosion(); this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose)); this.mSMCDeath.AddOneShotScriptEventHandler(102u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose)); this.mSMCDeath.RequestState(true, "y", "PoseFreeze"); this.mSMCDeath.RequestState(true, "y", "FreezeToFloat"); this.mSMCDeath.RequestState(false, "y", "GhostFloating"); break; case SimDescription.DeathType.MermaidDehydrated: this.MermaidDehydratedToGhostSequence(); break; } if (this.Target.SimDescription.DeathStyle != SimDescription.DeathType.OldAge) { this.Target.SetPosition(this.mGhostPosition); } this.mGrave.GhostSetup(this.Target, false); this.Target.SetHiddenFlags(HiddenFlags.Nothing); this.Target.FadeIn(); base.RequestWalkStyle(Sim.WalkStyle.DeathWalk); string name = Localization.LocalizeString(this.Target.SimDescription.IsFemale, "Gameplay/Actors/Sim/ReapSoul:InteractionName", new object[0]); if (base.BeginSocialInteraction(new SocialInteractionB.DefinitionDeathInteraction(name, false), true, 1.25f, false)) { if (this.Target.SimDescription.DeathStyle != (SimDescription.DeathType) 69u && this.Target.Household != null && this.Target.IsInActiveHousehold) { this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.UnluckyStarted; if (this.Target.SimDescription.DeathStyle == SimDescription.DeathType.OldAge) { this.Target.Motives.SetValue(CommodityKind.VampireThirst, -50f); } this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackResurrectSimUnlucky)); this.mSMCDeath.RequestState(false, "x", "Unlucky"); this.mSMCDeath.RequestState(true, "y", "Unlucky"); this.mSMCDeath.RequestState(false, "x", "Exit"); this.mSMCDeath.RequestState(true, "y", "Exit"); this.GrimReaperPostSequenceCleanup(); this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete; return(true); } if (this.Target.SimDescription.DeathStyle == (SimDescription.DeathType) 76u && this.Target.TraitManager != null && !this.Target.TraitManager.HasElement(TraitNames.ThereAndBackAgain)) { this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.UnluckyStarted; this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackResurrectSimRanting)); this.mSMCDeath.RequestState(false, "x", "Unlucky"); this.mSMCDeath.RequestState(true, "y", "Unlucky"); this.mSMCDeath.RequestState(false, "x", "Exit"); this.mSMCDeath.RequestState(true, "y", "Exit"); this.GrimReaperPostSequenceCleanup(); this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete; return(true); } this.mDeathFlower = this.Target.Inventory.Find <DeathFlower>(); if (this.mDeathFlower != null) { this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.DeathFlowerStarted; this.Target.Inventory.RemoveByForce(this.mDeathFlower); this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackResurrectSimDeathFlower)); this.mSMCDeath.RequestState(false, "x", "DeathFlower"); this.mSMCDeath.RequestState(true, "y", "DeathFlower"); this.mDeathFlower.Destroy(); this.mDeathFlower = null; this.mSMCDeath.RequestState(false, "x", "Exit"); this.mSMCDeath.RequestState(true, "y", "Exit"); this.GrimReaperPostSequenceCleanup(); this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete; return(true); } if (this.Target.SimDescription.DeathStyle != SimDescription.DeathType.OldAge) { this.Actor.AddInteraction(GrimReaperSituation.ChessChallenge.Singleton); } this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.NormalStarted; if (RandomUtil.CoinFlip()) { this.mSMCDeath.RequestState(false, "x", "Accept"); this.mSMCDeath.RequestState(true, "y", "Accept"); Route route2 = this.Target.CreateRouteTurnToFace(this.mGrave.Position); route2.ExecutionFromNonSimTaskIsSafe = true; this.Target.DoRoute(route2); } else if (RandomUtil.CoinFlip()) { this.mSMCDeath.RequestState(false, "x", "Reject"); this.mSMCDeath.RequestState(true, "y", "Reject"); Route route3 = this.Target.CreateRouteTurnToFace(this.mGrave.Position); route3.ExecutionFromNonSimTaskIsSafe = true; this.Target.DoRoute(route3); this.mSMCDeath.RequestState(false, "x", "GhostJumpInGrave"); this.mSMCDeath.RequestState(true, "y", "GhostJumpInGrave"); } else { this.mSMCDeath.RequestState(false, "x", "GhostKickedDive"); this.mSMCDeath.RequestState(true, "y", "GhostKickedDive"); this.mSMCDeath.RequestState(false, "x", "Kicked"); this.mSMCDeath.RequestState(true, "y", "Kicked"); } this.mSMCDeath.RequestState(false, "y", "Exit"); this.mSMCDeath.RequestState(true, "x", "Exit"); } else { this.mDeathFlower = this.Target.Inventory.Find <DeathFlower>(); if (this.Target.SimDescription.DeathStyle != (SimDescription.DeathType) 69u && this.Target.Household != null && this.Target.IsInActiveHousehold) { this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.UnluckyStarted; this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackResurrectSimUnlucky)); this.mSMCDeath.RequestState(false, "x", "Unlucky"); this.mSMCDeath.RequestState(true, "y", "Unlucky"); this.mSMCDeath.RequestState(false, "x", "Exit"); this.mSMCDeath.RequestState(true, "y", "Exit"); this.GrimReaperPostSequenceCleanup(); this.Target.AddExitReason(ExitReason.HigherPriorityNext); this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete; return(true); } if (this.mDeathFlower != null) { this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.DeathFlowerStarted; this.Target.Inventory.RemoveByForce(this.mDeathFlower); this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackResurrectSimDeathFlower)); this.mSMCDeath.RequestState(false, "x", "Unlucky"); this.mSMCDeath.RequestState(true, "y", "Unlucky"); this.mDeathFlower.Destroy(); this.mDeathFlower = null; this.mSMCDeath.RequestState(false, "x", "Exit"); this.mSMCDeath.RequestState(true, "y", "Exit"); this.GrimReaperPostSequenceCleanup(); this.Target.AddExitReason(ExitReason.HigherPriorityNext); this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete; return(true); } this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.NormalStarted; this.mSMCDeath.RequestState("x", "ExitNoSocial"); this.Target.FadeOut(); this.mDeathEffect = this.mGrave.GetSimToGhostEffect(this.Target, this.mGrave.Position); this.mSMCDeath.SetEffectActor("deathEffect", this.mDeathEffect); this.mDeathEffect.Start(); } this.mSituation.CheckAndSetPetSavior(this.Target); this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.NormalStarted; this.FinalizeDeath(); this.GrimReaperPostSequenceCleanup(); this.Target.StartOneShotFunction(new Sims3.Gameplay.Function(this.ReapSoulCallback), GameObject.OneShotFunctionDisposeFlag.OnDispose); this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete; } catch (Exception exception) { NiecException.PrintMessage("Sxception " + exception.Message + NiecException.NewLine + exception.StackTrace); } return(true); }
public override bool Run() { try{ if (!Target.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.DefaultEvict, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), Shower.kTimeToWaitToEvict)) { return(false); } try{ mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe); }catch { return(false); } mSwitchOutfitHelper.Start(); if (Actor.HasTrait(TraitNames.Hydrophobic)) { Actor.PlayReaction(ReactionTypes.WhyMe, Target as GameObject, ReactionSpeed.ImmediateWithoutOverlay); } if (Actor.HasTrait(TraitNames.Daredevil)) { TraitTipsManager.ShowTraitTip(0xb82d0015b9294260L, Actor, TraitTipsManager.TraitTipCounterIndex.Daredevil, TraitTipsManager.kDaredevilCountOfShowersTaken); } if (!Actor.RouteToSlotAndCheckInUse(Target, Slot.RoutingSlot_0)) { return(false); } // mSituation=new Shower.ShowerPrivacySituation(this); //if(!mSituation.Start()){ // return(false); //} StandardEntry(); if (!Actor.RouteToSlot(Target, Slot.RoutingSlot_0)) { if (mSituation != null) { mSituation.Exit(); } StandardExit(); return(false); } if (Autonomous) { mPriority = new InteractionPriority(InteractionPriorityLevel.UserDirected); } mSwitchOutfitHelper.Wait(true); bool daredevilPerforming = Actor.DaredevilPerforming; bool flag2 = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed; EnterStateMachine("Shower", "Enter", "x"); SetActor("Shower", Target); if (mSituation != null) { mSituation.StateMachine = mCurrentStateMachine; } SetParameter("IsShowerTub", Target.IsShowerTub); SetParameter("SimShouldCloseDoor", true); SetParameter("SimShouldClothesChange", ((!daredevilPerforming && !flag2) && !Actor.OccultManager.DisallowClothesChange()) && !Actor.BuffManager.DisallowClothesChange()); bool paramValue = false; if ((Target.BoobyTrapComponent != null) && Target.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription)) { paramValue = !Actor.OccultManager.DisallowClothesChange() && !Actor.BuffManager.DisallowClothesChange(); } SimDescription description = ((Target.BoobyTrapComponent != null) && (Target.BoobyTrapComponent.TrapSetter != 0L)) ? SimDescription.Find(Target.BoobyTrapComponent.TrapSetter) : null; if (((description != null) && description.IsFairy) && Actor.BuffManager.HasElement(BuffNames.TrickedByAFairy)) { paramValue = false; } SetParameter("isBoobyTrapped", paramValue); mSwitchOutfitHelper.AddScriptEventHandler(this); AddOneShotScriptEventHandler(0x3e9, EventCallbackStartShoweringSound); if (Actor.HasTrait(TraitNames.Virtuoso) || RandomUtil.RandomChance((float)Target.TuningShower.ChanceOfSinging)) { AddOneShotScriptEventHandler(0xc8, EventCallbackStartSinging); } PetStartleBehavior.CheckForStartle(Target as GameObject, StartleType.ShowerOn); AnimateSim("Loop Shower"); Actor.BuffManager.AddElement(BuffNames.SavingWater, Origin.FromShower, ProductVersion.EP2, TraitNames.EnvironmentallyConscious); mShowerStage.ResetCompletionTime(GetShowerTime()); StartStages(); if (Actor.HasTrait(TraitNames.EnvironmentallyConscious)) { BeginCommodityUpdate(CommodityKind.Hygiene, Shower.kEnvironmentallyConsciousShowerSpeedMultiplier); } if (Actor.SimDescription.IsPlantSim) { ModifyCommodityUpdate(CommodityKind.Hygiene, Shower.kPlantSimHygieneModifier); } BeginCommodityUpdates(); if (paramValue) { ApplyBoobyTrapOutfit(); if ((description != null) && description.IsFairy) { Actor.BuffManager.AddElement(BuffNames.TrickedByAFairy, Origin.FromFairy); } } bool succeeded = (false); try{ try{ Target.SimInShower = Actor; succeeded = DoLoop(~( ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), DuringShower, null); if (HavingWooHoo && Actor.HasExitReason(ExitReason.StageComplete)) { succeeded = DoLoop(~( ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached | ExitReason.StageComplete), DuringShower, null); } }finally{ Target.SimInShower = null; } while (HavingWooHoo) { SpeedTrap.Sleep(10); } }finally{ EndCommodityUpdates(succeeded); } Shower.WaitToLeaveShower(Actor, Target); if (succeeded) { Shower.ApplyPostShowerEffects(Actor, Target); } if (paramValue) { SetParameter("isBoobyTrapped", false); AddOneShotScriptEventHandler(0xc9, EventCallbackStopSinging); AddOneShotScriptEventHandler(0x3ea, EventCallbackStopShoweringSound); if ((description != null) && description.IsFairy) { AnimateSim("TriggerFairyTrap"); } else { AnimateSim("Booby Trap Reaction"); } AddOneShotScriptEventHandler(0x3e9, EventCallbackStartShoweringSound); AnimateSim("Loop Shower"); RemoveBoobyTrapOutfit(); SpeedTrap.Sleep(60); } try{ if (flag2 && succeeded) { mSwitchOutfitHelper.Dispose(); try{ mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe); mSwitchOutfitHelper.Start(); mSwitchOutfitHelper.Wait(false); mSwitchOutfitHelper.ChangeOutfit(); }catch {} } bool flag5 = (false); if ((flag2 && succeeded) || (!flag2 && !daredevilPerforming)) { SetParameter("SimShouldClothesChange", !Actor.OccultManager.DisallowClothesChange()); mSwitchOutfitHelper.Dispose(); try{ mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, GetOutfitReason(Actor)); mSwitchOutfitHelper.Start(); mSwitchOutfitHelper.AddScriptEventHandler(this); mSwitchOutfitHelper.Wait(false); }catch {} flag5 = (true); } Target.Cleanable.DirtyInc(Actor); AddOneShotScriptEventHandler(0xc9, EventCallbackStopSinging); AddOneShotScriptEventHandler(0x3ea, EventCallbackStopShoweringSound); if (flag5 && InventingSkill.IsBeingDetonated(Target as GameObject)) { SetParameter("SimShouldClothesChange", false); mSwitchOutfitHelper.Abort(); mSwitchOutfitHelper.Dispose(); } if (Target.Repairable.UpdateBreakage(Actor)) { Target.StartBrokenFXInAnim(mCurrentStateMachine); AnimateSim("Exit Broken"); } else { AnimateSim("Exit Working"); } if ((Actor.SimDescription.IsMummy || Actor.DaredevilPerforming) || (Actor.TraitManager.HasElement(TraitNames.Slob) && RandomUtil.RandomChance01(TraitTuning.SlobTraitChanceToLeavePuddle))) { PuddleManager.AddPuddle(Actor.Position); } if (succeeded) { Actor.BuffManager.RemoveElement(BuffNames.GotFleasHuman); } }finally{ StandardExit(); } return(succeeded); }catch (ResetException exception) { Alive.WriteLog(exception.Message + "\n\n" + exception.StackTrace + "\n\n" + exception.Source); return(false); }catch (Exception exception) { Alive.WriteLog(exception.Message + "\n\n" + exception.StackTrace + "\n\n" + exception.Source); return(false); } }
public override bool Run() { if (!SafeToSync()) { return(false); } skillActor = Actor.SkillManager.GetSkill <EWPetFightingSkill>(EWPetFightingSkill.skillNameID); if (skillActor == null) { skillActor = Actor.SkillManager.AddElement(EWPetFightingSkill.skillNameID) as EWPetFightingSkill; if (skillActor == null) { return(false); } } skillTarget = Target.SkillManager.GetSkill <EWPetFightingSkill>(EWPetFightingSkill.skillNameID); if (skillTarget == null) { skillTarget = Actor.SkillManager.AddElement(EWPetFightingSkill.skillNameID) as EWPetFightingSkill; if (skillTarget == null) { return(false); } } skillActor.StartSkillGain(skillActor.getSkillGainRate(Actor)); skillTarget.StartSkillGain(skillTarget.getSkillGainRate(Target)); BeginCommodityUpdates(); Actor.RequestWalkStyle(WalkStyle.PetRun); if (!BeginSocialInteraction(new SocialInteractionB.Definition(null, GetInteractionName(), allowCarryChild: false), pairedSocial: true, doCallOver: false)) { if (Actor.IsCat) { Actor.UnrequestWalkStyle(WalkStyle.CatStalk); PouncePosture pouncePosture2 = Actor.Posture as PouncePosture; if (pouncePosture2 != null) { pouncePosture2.ExitPounce(); Actor.PopPosture(); } } else { Actor.UnrequestWalkStyle(WalkStyle.PetRun); } EndCommodityUpdates(false); return(false); } Actor.UnrequestWalkStyle(WalkStyle.PetRun); if (Actor.IsCat) { PouncePosture pouncePosture = PouncePosture.Create(Actor); pouncePosture.EnterPounce(); Actor.Posture = pouncePosture; } StandardEntry(addToUseList: false); StartSocial("Fight Pet"); ((SocialInteraction)LinkedInteractionInstance).Rejected = Rejected; mPetFightNoiseBroadcast = new ReactionBroadcaster(Actor, kPetFightLoudBroadcastParams, FightBroadcastCallback); PetStartleBehavior.CheckForStartle(Actor, StartleType.Fight); EnterStateMachine("PetFight", "Enter", "x"); SetActor("y", Target); AnimateSim("Loop Fight"); // TODO: A fight should reduce fatigue InteractionTuning tuning = InteractionObjectPair.Tuning; if (tuning != null && tuning.mTradeoff != null) { using (List <CommodityChange> .Enumerator enumerator = tuning.mTradeoff.mOutputs.GetEnumerator()) { if (enumerator.MoveNext()) { CommodityChange current = enumerator.Current; if (current.Commodity == CommodityKind.CatScratch) { LinkedInteractionInstance.BeginCommodityUpdate(current, 1f); } } } } bool success = DoTimedLoop(RandomUtil.GetFloat(kPetFightTimeMinMax[0], kPetFightTimeMinMax[1]), ExitReason.Default); EndCommodityUpdates(success); Actor.Motives.SetValue(CommodityKind.Energy, Actor.Motives.GetMotiveValue(CommodityKind.Energy - 200)); LinkedInteractionInstance.EndCommodityUpdates(success); bool actorWon = DoesActorWinFight(); if (!actorWon) { AnimateSim("Swap"); SetActor("x", Target); SetActor("y", Actor); skillTarget.wonFight(Actor, Target.LotCurrent == Target.LotHome); skillActor.lostFight(Target); skillTarget.AddPoints(200f, true, true); Actor.ShowTNSIfSelectable(Localization.LocalizeString("Echoweaver/PetFighting/EWFightPet:PetFightLose", Actor.Name), StyledNotification.NotificationStyle.kGameMessageNegative); } else { skillActor.wonFight(Target, Actor.LotCurrent == Actor.LotHome); skillTarget.lostFight(Actor); Actor.ShowTNSIfSelectable(Localization.LocalizeString("Echoweaver/PetFighting/EWFightPet:PetFightWin", Actor.Name), StyledNotification.NotificationStyle.kGameMessagePositive); } AnimateSim("Exit"); if (Actor.IsCat) { Actor.UnrequestWalkStyle(WalkStyle.CatStalk); if (Actor.Posture is PouncePosture) { Actor.PopPosture(); } } else { Actor.UnrequestWalkStyle(WalkStyle.PetRun); } EventTracker.SendEvent(new SocialEvent(EventTypeId.kSocialInteraction, Actor, Target, "Fight Pet", wasRecipient: false, wasAccepted: true, actorWon, CommodityTypes.Undefined)); EventTracker.SendEvent(new SocialEvent(EventTypeId.kSocialInteraction, Target, Actor, "Fight Pet", wasRecipient: true, wasAccepted: true, !actorWon, CommodityTypes.Undefined)); if (mPetFightNoiseBroadcast != null) { mPetFightNoiseBroadcast.EndBroadcast(); mPetFightNoiseBroadcast = null; } FinishSocial("Fight Pet", bApplySocialEffect: true); skillActor.StopSkillGain(); skillTarget.StopSkillGain(); FinishLinkedInteraction(); WaitForSyncComplete(); StandardExit(removeFromUseList: false); LikingChange(); // Check for death conditions BEFORE new wounds assigned CheckForDeath(actorWon); AssignFightWounds(); // If this is called from ChaseOffLot, then the target will flee if it loses if (!actorWon && actorRunOnLose && Actor.LotCurrent != Actor.LotHome) { Actor.PopPosture(); Actor.RequestWalkStyle(WalkStyle.PetRun); MakeSimGoHome(Actor, false); } else if (actorWon && targetRunOnLose && Target.LotCurrent != Target.LotHome) { Target.PopPosture(); if (Target.IsHuman) { Target.RequestWalkStyle(WalkStyle.MeanChasedRun); } else { Target.RequestWalkStyle(WalkStyle.PetRun); } MakeSimGoHome(Target, false); } return(success); }