Esempio n. 1
0
            protected bool Matches(Relationship relation)
            {
                if (relation != null)
                {
                    if ((Value & AlertLevel.Friends) == AlertLevel.Friends)
                    {
                        if (relation.AreFriends())
                        {
                            return(true);
                        }
                    }

                    if ((Value & AlertLevel.Enemies) == AlertLevel.Enemies)
                    {
                        if (relation.AreEnemies())
                        {
                            return(true);
                        }
                    }

                    if ((Value & AlertLevel.Romantic) == AlertLevel.Romantic)
                    {
                        if (relation.AreRomantic())
                        {
                            return(true);
                        }
                    }
                }

                return(false);
            }
Esempio n. 2
0
        public static bool Satisfies(Sim actor, Sim target)
        {
            switch (NRaas.Woohooer.Settings.mPartneringInteractionLevel)
            {
            case MyLoveBuffLevel.AnyRomantic:
                Relationship relation = Relationship.Get(actor, target, false);
                if (relation == null)
                {
                    return(false);
                }

                if (relation.AreRomantic())
                {
                    return(true);
                }

                return(actor.Partner == target.SimDescription);

            case MyLoveBuffLevel.Partner:
                return(actor.Partner == target.SimDescription);

            case MyLoveBuffLevel.Spouse:
                return(actor.Genealogy.Spouse == target.Genealogy);
            }

            return(false);
        }
        public static bool Satisfies(Sim actor, Sim target, bool resultOnDefault)
        {
            switch (NRaas.Woohooer.Settings.mWoohooInteractionLevelV2[PersistedSettings.GetSpeciesIndex(actor)])
            {
            case MyLoveBuffLevel.AnyRomantic:
                Relationship relation = Relationship.Get(actor, target, false);
                if (relation == null)
                {
                    return(false);
                }

                if (relation.AreRomantic())
                {
                    return(true);
                }

                return(actor.Partner == target.SimDescription);

            case MyLoveBuffLevel.Partner:
                return(actor.Partner == target.SimDescription);

            case MyLoveBuffLevel.Spouse:
                return(actor.Genealogy.Spouse == target.Genealogy);
            }

            return(resultOnDefault);
        }
        public void storeAndIncreaseRelationship(Sim buyer, Relationship relationship)
        {
            Sim seller = SimInRole();

            if (!mRelationsToRestore.ContainsKey(buyer) && seller != null)
            {
                RelationData data = new RelationData();
                data.buyerLostAFriend  = HasMoodlet(buyer, BuffNames.LostAFriend, Origin.FromSocialization);
                data.sellerLostAFriend = HasMoodlet(seller, BuffNames.LostAFriend, Origin.FromSocialization);
                data.liking            = relationship.CurrentLTRLiking;

                if (relationship.AreRomantic())
                {
                    data.areRomantic = true;
                }
                else
                {
                    relationship.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Romantic);
                }

                if (relationship.AreFriends())
                {
                    data.areFriends = true;
                }
                else
                {
                    relationship.LTR.SetLiking(100f);
                }

                mRelationsToRestore.Add(buyer, data);
            }
        }
Esempio n. 5
0
        protected override bool TargetAllow(SimDescription sim)
        {
            Relationship relationship = ManagerSim.GetRelationship(Sim, Target);

            if (relationship == null)
            {
                IncStat("Bad Relation");
                return(false);
            }
            else if (relationship.AreRomantic())
            {
                IncStat("Already Romantic");
                return(false);
            }
            else if (Sim.Partner == Target)
            {
                IncStat("Partnered");
                return(false);
            }

            LongTermRelationship LTR = relationship.LTR;

            if (LTR == null)
            {
                IncStat("Bad LTR");
                return(false);
            }
            else if (LTR.Liking <= Sims3.Gameplay.Actors.Sim.kRomanceUseLikingGate)
            {
                IncStat("Too Low");
                return(false);
            }

            return(base.TargetAllow(sim));
        }
Esempio n. 6
0
        private static bool WillSimComeToParty(SimDescription guest, Sim host, float fMaxLTR, bool bHostIsLegendary)
        {
            if (bHostIsLegendary || host.HasTrait(TraitNames.PartyAnimal))
            {
                return(true);
            }

            Relationship relationshipToParty = null;

            try
            {
                relationshipToParty = HostedSituation.GetRelationshipToHostedSituation(host.SimDescription, guest);
            }
            catch
            { }

            if (relationshipToParty == null)
            {
                return(false);
            }
            if (relationshipToParty.AreFriends() || relationshipToParty.AreRomantic())
            {
                return(true);
            }
            float num = MathUtils.Clamp(relationshipToParty.LTR.Liking, HouseParty.kLTRMinToInvite, fMaxLTR);

            return(RandomUtil.InterpolatedChance(HouseParty.kLTRMinToInvite, fMaxLTR, (float)HouseParty.kChanceToComeAtMinLTR, (float)HouseParty.kChanceToComeAtMaxLTR, num));
        }
Esempio n. 7
0
        public override bool IsHit(DualSimScoringParameters parameters)
        {
            Relationship simRelationship = Relationship.Get(parameters.Actor, parameters.Other, false);

            if (simRelationship == null)
            {
                return(false);
            }
            else if (!simRelationship.AreRomantic())
            {
                return(false);
            }

            float simLiking = simRelationship.LTR.Liking;

            List <Relationship> relationships = new List <Relationship>(Relationship.GetRelationships(parameters.Other));

            foreach (Relationship relationship in relationships)
            {
                if (!relationship.AreRomantic())
                {
                    continue;
                }

                if (relationship.LTR.Liking > simLiking)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 8
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            // Doing so stops the Allow() from stopping the engagement
            SetValue <ArrangedMarriageOption, ulong>(Sim, 0);
            SetValue <ArrangedMarriageOption, ulong>(Target, 0);

            if ((Sim.IsMarried) || (Target.IsMarried))
            {
                IncStat("Married Flagged");
                return(false);
            }

            Relationship relationship = Relationship.Get(Sim, Target, true);

            if (relationship != null)
            {
                relationship.MakeAcquaintances();

                if (!relationship.AreRomantic())
                {
                    // Bump to Romantic Interest
                    Romances.BumpToHigherState(this, Sim, Target);
                }
            }

            Add(frame, new PartneringScenario(Sim, Target, false, true), ScenarioResult.Start);
            return(base.PrivateUpdate(frame));
        }
Esempio n. 9
0
        public static bool AreRomantic(SimDescription a, SimDescription b)
        {
            Relationship relation = ManagerSim.GetRelationship(a, b);

            if (relation == null)
            {
                return(false);
            }

            return(relation.AreRomantic());
        }
            public override bool Test(Sim actor, Sim target, bool autonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    if (!Woohooer.Settings.mUnlockTeenActions)
                    {
                        if ((target.SimDescription != null) && target.SimDescription.TeenOrBelow)
                        {
                            return(false);
                        }
                    }

                    if (((actor == target) || (actor == null)) || (((target == null) || (target.SimDescription == null)) || target.SimDescription.ChildOrBelow))
                    {
                        return(false);
                    }
                    if (!target.CanBeSocializedWith || ((target.SimDescription.DeathStyle != SimDescription.DeathType.None) && !target.SimDescription.IsPlayableGhost))
                    {
                        return(false);
                    }
                    if (!actor.Posture.AllowsNormalSocials())
                    {
                        return(false);
                    }
                    if (!target.Posture.AllowsNormalSocials())
                    {
                        return(false);
                    }

                    Relationship relationship = Relationship.Get(actor, target, false);
                    return((relationship != null) && relationship.AreRomantic());
                }
                catch (ResetException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    Common.Exception(actor, target, e);
                    return(false);
                }
            }
Esempio n. 11
0
        protected override bool TargetAllow(SimDescription sim)
        {
            if ((Sim.Partner == Target) && (Sim.IsMarried))
            {
                IncStat("Married");
                return(false);
            }

            Relationship relationship = ManagerSim.GetRelationship(Sim, Target);

            if (relationship == null)
            {
                return(false);
            }

            LongTermRelationship LTR = relationship.LTR;

            if (LTR == null)
            {
                return(false);
            }

            if (LTR.Liking <= Sims3.Gameplay.Actors.Sim.kRomanceUseLikingGate)
            {
                IncStat("Romance Gated");
                return(false);
            }
            else if (LTR.Liking <= Sims3.Gameplay.Actors.Sim.kWooHooUseLikingGate)
            {
                IncStat("WooHoo Gated");
                return(false);
            }
            else if (!relationship.AreRomantic())
            {
                IncStat("Not Romantic");
                return(false);
            }

            return(base.TargetAllow(sim));
        }
Esempio n. 12
0
        protected override bool TargetAllow(SimDescription sim)
        {
            Relationship relationship = ManagerSim.GetRelationship(Sim, Target);

            if (relationship == null)
            {
                IncStat("Bad Relation");
                return(false);
            }
            else if (!relationship.AreRomantic())
            {
                IncStat("Not Romantic");
                return(false);
            }

            LongTermRelationship LTR = relationship.LTR;

            if (LTR == null)
            {
                IncStat("Bad LTR");
                return(false);
            }
            else if (LTR.Liking <= Sims3.Gameplay.Actors.Sim.kRomanceUseLikingGate)
            {
                IncStat("Too Low");
                return(false);
            }

            if (mAffairStory == ManagerRomance.AffairStory.None)
            {
                if (!Romances.AllowAffair(this, Sim, Target, Managers.Manager.AllowCheck.None))
                {
                    IncStat("Affair Denied");
                    return(false);
                }
            }

            return(base.TargetAllow(sim));
        }
Esempio n. 13
0
        public static bool CanGoOnDate(SimDescription a, SimDescription b)
        {
            Relationship relationship = Relationship.Get(a, b, false);

            if (relationship == null)
            {
                return(false);
            }

            if (!relationship.AreRomantic() && ((relationship.STC == null) || !relationship.STC.IsRomantic))
            {
                return(false);
            }

            string reason;
            GreyedOutTooltipCallback callback = null;

            if (!CommonSocials.CanGetRomantic(a, b, true, false, true, ref callback, out reason))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 14
0
        protected static Sim ShouldHaveMyLove(Sim sim)
        {
            if (sim.LotCurrent == null)
            {
                return(null);
            }

            if (sim.LotCurrent.IsWorldLot)
            {
                return(null);
            }

            if (Woohooer.Settings.mMyLoveBuffLevel == Options.Romance.MyLoveBuffLevel.Default)
            {
                return(null);
            }

            Sim found = null;

            foreach (Sim other in sim.LotCurrent.GetAllActors())
            {
                if (other == sim)
                {
                    continue;
                }

                if (other.RoomId != sim.RoomId)
                {
                    continue;
                }

                Relationship relation = Relationship.Get(sim, other, false);
                if (relation == null)
                {
                    continue;
                }

                if ((relation.AreRomantic()) && (relation.LTR.Liking > BuffMyLove.LikingValueForBuff))
                {
                    if ((relation.MarriedInGame) && (SimClock.ElapsedTime(TimeUnit.Days, relation.LTR.WhenStateStarted) < BuffMyLove.DaysSinceLTRChangeForBuff))
                    {
                        return(null);
                    }

                    switch (Woohooer.Settings.mMyLoveBuffLevel)
                    {
                    case Options.Romance.MyLoveBuffLevel.Partner:
                        if (sim.Partner != other.SimDescription)
                        {
                            continue;
                        }
                        break;

                    case Options.Romance.MyLoveBuffLevel.Spouse:
                        if (sim.Partner != other.SimDescription)
                        {
                            continue;
                        }

                        if (!sim.IsMarried)
                        {
                            continue;
                        }
                        break;
                    }

                    found = other;
                    break;
                }
            }

            return(found);
        }
Esempio n. 15
0
        public static bool IsSafeFromJealousy(Sim actor, Sim target, bool woohoo)
        {
            if (actor.TraitManager == null)
            {
                return(false);
            }

            if (actor.HasTrait(TraitNames.NoJealousy))
            {
                return(true);
            }

            if (!Woohooer.Settings.UsingTraitScoring)
            {
                return(true);
            }

            if (actor.LotCurrent == null)
            {
                return(true);
            }

            bool found = false;

            foreach (Sim sim in actor.LotCurrent.GetAllActors())
            {
                if (sim == null)
                {
                    continue;
                }

                if (sim == target)
                {
                    continue;
                }

                if (!woohoo)
                {
                    if (sim.RoomId != actor.RoomId)
                    {
                        continue;
                    }
                }

                Relationship relation = Relationship.Get(sim, actor, false);
                if (relation == null)
                {
                    continue;
                }

                if (relation.AreRomantic())
                {
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                return(true);
            }

            return(!TestScoringNormal(actor, target, "Sneakiness", false));
        }
Esempio n. 16
0
        protected static void OnSocialEvent(Event e)
        {
            using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration TeenAdultControl:OnSocialEvent"))
            {
                SocialEvent socialEvent = e as SocialEvent;
                if ((socialEvent != null) && (socialEvent.WasAccepted))
                {
                    Common.StringBuilder msg = new Common.StringBuilder("TeenAdult:OnSocialEvent");

                    Sim actor  = socialEvent.Actor as Sim;
                    Sim target = socialEvent.TargetObject as Sim;

                    if ((actor == null) || (target == null))
                    {
                        return;
                    }

                    if ((!actor.SimDescription.Teen) || (actor.SimDescription.Teen == target.SimDescription.Teen))
                    {
                        return;
                    }

                    msg += Common.NewLine + actor.FullName;
                    msg += Common.NewLine + target.FullName;
                    msg += Common.NewLine + socialEvent.SocialName;

                    Relationship relation = Relationship.Get(actor, target, false);
                    if (relation == null)
                    {
                        return;
                    }

                    LongTermRelationshipTypes newState = LongTermRelationshipTypes.Undefined;

                    switch (socialEvent.SocialName)
                    {
                    case "Propose Going Steady":
                        if ((actor.Partner != target.SimDescription) || (target.Partner != actor.SimDescription))
                        {
                            Relationships.SetPartner(actor.SimDescription, target.SimDescription);

                            newState = LongTermRelationshipTypes.Partner;
                        }
                        break;

                    case "Propose Marriage":
                        newState = LongTermRelationshipTypes.Fiancee;
                        break;

                    case "Have Private Wedding":
                    case "Get Married Using Wedding Arch":
                        newState = LongTermRelationshipTypes.Spouse;
                        break;

                    case "Lets Just Be Friends":
                    case "Break Up":
                        newState = LongTermRelationshipTypes.Ex;

                        SetPreviousState(actor.SimDescription, target.SimDescription, newState);
                        SetPreviousState(target.SimDescription, actor.SimDescription, newState);
                        break;

                    case "Divorce":
                        newState = LongTermRelationshipTypes.ExSpouse;

                        SetPreviousState(actor.SimDescription, target.SimDescription, newState);
                        SetPreviousState(target.SimDescription, actor.SimDescription, newState);
                        break;

                    default:
                        if (!relation.AreRomantic())
                        {
                            List <SocialRuleRHS> list = SocialRuleRHS.Get(socialEvent.SocialName);
                            if (list != null)
                            {
                                bool romantic = false;

                                foreach (SocialRuleRHS rhs in list)
                                {
                                    if ((rhs.InteractionBitsAdded & LongTermRelationship.InteractionBits.Romantic) == LongTermRelationship.InteractionBits.Romantic)
                                    {
                                        romantic = true;
                                        break;
                                    }
                                }

                                if (romantic)
                                {
                                    msg += Common.NewLine + "A";

                                    newState = LongTermRelationshipTypes.RomanticInterest;
                                }
                            }
                        }
                        else
                        {
                            msg += Common.NewLine + "C";

                            newState = relation.CurrentLTR;
                        }
                        break;
                    }

                    msg += Common.NewLine + newState;

                    if (newState != LongTermRelationshipTypes.Undefined)
                    {
                        Perform(relation, newState);
                    }

                    //Common.DebugStackLog(msg);
                }
            }
        }
Esempio n. 17
0
        protected override bool Sort(List <Household> houses)
        {
            Dictionary <Household, int> candidates = new Dictionary <Household, int>();

            AddStat("Potentials", houses.Count);

            SimDescription oldestSim = Sim;

            foreach (SimDescription sim in Movers)
            {
                if ((oldestSim == null) || (SimTypes.IsOlderThan(sim, oldestSim)))
                {
                    oldestSim = sim;
                }
            }

            foreach (Household house in houses)
            {
                bool olderFound = false;

                foreach (SimDescription other in HouseholdsEx.All(house))
                {
                    if (Deaths.IsDying(other))
                    {
                        continue;
                    }

                    if (SimTypes.IsOlderThan(other, oldestSim))
                    {
                        olderFound = true;
                    }

                    int count = 0;

                    if (Flirts.IsCloselyRelated(Sim, other))
                    {
                        if (Sim.Genealogy.Parents.Contains(other.Genealogy))
                        {
                            count += 10;
                        }
                        else
                        {
                            count++;
                        }
                    }
                    else if (OnlyFamilyMoveIn)
                    {
                        continue;
                    }

                    bool checkRel = false;
                    if (other.YoungAdultOrAbove)
                    {
                        checkRel = true;
                    }
                    else if ((Households.AllowSoloMove(Sim)) && (other.TeenOrAbove))
                    {
                        checkRel = true;
                    }

                    if (checkRel)
                    {
                        int rel = 0;

                        Relationship relation = Relationship.Get(Sim, other, false);
                        if (relation != null)
                        {
                            rel = (int)(relation.LTR.Liking / 25);

                            if ((relation.AreRomantic()) && (rel > 0))
                            {
                                rel += 5;
                            }

                            count += rel;
                        }

                        if (Households.AllowSoloMove(Sim))
                        {
                            if (rel < 3)
                            {
                                continue;
                            }
                        }
                    }

                    if (Sim.Partner == other)
                    {
                        count += 10;
                    }

                    if (!candidates.ContainsKey(house))
                    {
                        candidates.Add(house, count);
                    }
                    else
                    {
                        candidates[house] += count;
                    }
                }

                if (!olderFound)
                {
                    candidates.Remove(house);
                }
            }

            houses.Clear();
            if (candidates.Count > 0)
            {
                ScoringList <Household> scoring = new ScoringList <Household>();
                foreach (KeyValuePair <Household, int> candidate in candidates)
                {
                    AddScoring("", candidate.Value);

                    scoring.Add(candidate.Key, candidate.Value);
                }

                houses.AddRange(scoring.GetBestByMinScore(1));
            }
            else
            {
                IncStat("No Candidates");
            }

            return(true);
        }
Esempio n. 18
0
        public static void Apply(Sim actor, Sim target, bool risky)
        {
            if (!Woohooer.Settings.mApplyBuffs)
            {
                return;
            }

            bool useTraitScoring = Woohooer.Settings.UsingTraitScoring;

            if ((actor == null) || (target == null))
            {
                return;
            }

            Relationship relation = Relationship.Get(actor, target, false);

            if (relation == null)
            {
                return;
            }

            bool witnessed = false;

            if (useTraitScoring)
            {
                string reason;

                foreach (Sim sim in actor.LotCurrent.GetAllActors())
                {
                    if (!sim.IsHuman)
                    {
                        continue;
                    }

                    if ((sim == actor) || (sim == target))
                    {
                        continue;
                    }

                    if (sim.RoomId != actor.RoomId)
                    {
                        continue;
                    }

                    if ((!CommonSocials.CanGetRomantic(sim.SimDescription, actor.SimDescription, out reason)) && (!CommonSocials.CanGetRomantic(sim.SimDescription, target.SimDescription, out reason)))
                    {
                        continue;
                    }

                    if (ScoringLookup.GetScore("LikeWatching", sim.SimDescription) > 0)
                    {
                        sim.BuffManager.AddElement(sVoyeur, sWoohooOrigin);

                        witnessed = true;
                    }
                    else
                    {
                        sim.BuffManager.AddElement(BuffNames.Embarrassed, sWoohooOrigin);
                    }
                }
            }

            Sim[] sims = new Sim[] { actor, target };

            foreach (Sim sim in sims)
            {
                if (!sim.IsHuman)
                {
                    continue;
                }

                if (useTraitScoring)
                {
                    if (KamaSimtra.GetSkillLevel(sim.SimDescription) < 4)
                    {
                        if (ScoringLookup.GetScore("WorryAboutWoohoo", sim.SimDescription) > 0)
                        {
                            sim.BuffManager.AddElement(sWorryAboutWoohoo, sWoohooOrigin);
                        }
                    }
                }

                if (witnessed)
                {
                    sim.BuffManager.AddElement(sWitnessed, sWoohooOrigin);
                }

                if (useTraitScoring)
                {
                    if ((risky) && (!Woohooer.Settings.ReplaceWithRisky))
                    {
                        int score = ScoringLookup.GetScore("LikeRisky", sim.SimDescription);
                        if (score > 0)
                        {
                            sim.BuffManager.RemoveElement(sDislikeRisky);
                            sim.BuffManager.AddElement(sLikeRisky, sWoohooOrigin);
                        }
                        else if (score < 0)
                        {
                            sim.BuffManager.RemoveElement(sLikeRisky);
                            sim.BuffManager.AddElement(sDislikeRisky, sWoohooOrigin);
                        }
                    }
                }

                if (actor.Partner == target.SimDescription)
                {
                    sim.BuffManager.AddElement(sLikePartner, sWoohooOrigin);
                }
                else if (sim.Partner != null)
                {
                    if (useTraitScoring)
                    {
                        int score = ScoringLookup.GetScore("Monogamous", sim.SimDescription);
                        if (score > 0)
                        {
                            sim.BuffManager.RemoveElement(sLikeAdultery);
                            sim.BuffManager.AddElement(sDislikeAdultery, sWoohooOrigin);
                        }
                        else if (score < 0)
                        {
                            sim.BuffManager.RemoveElement(sDislikeAdultery);
                            sim.BuffManager.AddElement(sLikeAdultery, sWoohooOrigin);
                        }
                    }
                }

                if ((useTraitScoring) && (!relation.AreRomantic()))
                {
                    if (relation.LTR.Liking > 75)
                    {
                        int score = ScoringLookup.GetScore("LikeFriendWithBenefits", sim.SimDescription);
                        if (score > 0)
                        {
                            sim.BuffManager.RemoveElement(sDislikeFriendWithBenefits);
                            sim.BuffManager.AddElement(sLikeFriendWithBenefits, sWoohooOrigin);
                        }
                        else if (score < 0)
                        {
                            sim.BuffManager.RemoveElement(sLikeFriendWithBenefits);
                            sim.BuffManager.AddElement(sDislikeFriendWithBenefits, sWoohooOrigin);
                        }
                    }
                    else
                    {
                        int score = ScoringLookup.GetScore("LikeOneNightStand", sim.SimDescription);
                        if (score > 0)
                        {
                            sim.BuffManager.RemoveElement(sDislikeOneNightStand);
                            sim.BuffManager.AddElement(sLikeOneNightStand, sWoohooOrigin);
                        }
                        else if (score < 0)
                        {
                            sim.BuffManager.RemoveElement(sLikeOneNightStand);
                            sim.BuffManager.AddElement(sDislikeOneNightStand, sWoohooOrigin);
                        }
                    }
                }
            }
        }
Esempio n. 19
0
        protected override bool TargetAllow(SimDescription sim)
        {
            Relationship relation = ManagerSim.GetRelationship(Sim, Target);

            if (relation == null)
            {
                return(false);
            }

            if ((!mForce) && (relation.LTR.Liking <= Sims3.Gameplay.Actors.Sim.kRomanceUseLikingGate))
            {
                IncStat("Under Gate");
                return(false);
            }
            else if ((!AllowAffair) && (ManagerRomance.IsAffair(Sim, Target)))
            {
                IncStat("Affair");
                return(false);
            }

            if (Sim.Partner == Target)
            {
                IncStat("Already Partner");
                return(false);
            }
            else if (!Romances.Allow(this, Sim, Target))
            {
                return(false);
            }

            if (!mForce)
            {
                if (relation.LTR.Liking < GetValue <PartnerLikingGateOption, int>())
                {
                    AddStat("No Like", relation.LTR.Liking);
                    return(false);
                }
                else if (!relation.AreRomantic())
                {
                    IncStat("Not Romantic");
                    return(false);
                }
                else if (GetElapsedTime <DayOfLastPartnerOption>(Sim) < GetValue <MinTimeFromBreakupToPartnerOption, int>())
                {
                    AddStat("Too Early", GetElapsedTime <DayOfLastPartnerOption>(Sim));
                    return(false);
                }
                else if (GetElapsedTime <DayOfLastPartnerOption>(Target) < GetValue <MinTimeFromBreakupToPartnerOption, int>())
                {
                    AddStat("Too Early", GetElapsedTime <DayOfLastPartnerOption>(Target));
                    return(false);
                }
                else if ((AddScoring("SettleDown", Target, Sim) <= 0) &&
                         (AddScoring("SettleDown", Sim, Target) <= 0))
                {
                    IncStat("Score Fail");
                    return(false);
                }
            }

            return(base.TargetAllow(sim));
        }
Esempio n. 20
0
            /*
             * [Tunable]
             * [TunableComment("Range: Fun/Stress motive amount.  Description:  Amount of stress that a Sim gets when seeing another Sim die.")]
             * public static float kWitnessDeathStressPenalty = -50f;
             *
             * [Tunable]
             * [TunableComment("Range: Float multiplier.  Description:  Multiplier on additional stress when a family member of loved one sees a Sim die.")]
             * public static float kWitnessDeathRelationshipMultiplier = 1.5f;
             *
             * [TunableComment("Range: Fun/Stress motive amount.  Description:  Amount of fun that a Sim gets when seeing an enemy Sim die.")]
             * [Tunable]
             * public static float kWitnessEnemyDeathFunGain = 50f;
             *
             */



            public override bool Run()
            {
                SwimmingInPool swimmingInPool = Actor.Posture as SwimmingInPool;

                if (swimmingInPool != null && !swimmingInPool.ContainerPool.RouteToEdge(Actor))
                {
                    return(false);
                }
                SwimmingInPool swimmingInPool2 = Target.Posture as SwimmingInPool;

                if (swimmingInPool2 != null)
                {
                    if (!swimmingInPool2.ContainerPool.RouteToEdge(Actor))
                    {
                        return(false);
                    }
                    Actor.RouteTurnToFace(Target.Position);
                }

                else if (!GlobalFunctions.ObjectsWithinRadiusOfEachOther(Actor, Target, 2f))
                {
                    if (Actor == null || Target == null || Target.LotCurrent == null)
                    {
                        return(false);
                    }

                    Route route = Actor.CreateRoute();
                    if (route == null)
                    {
                        return(false);
                    }

                    RequestWalkStyle(Sim.WalkStyle.Run);

                    route.PlanToPointRadialRange(Target.Position, 2f, 6f, RouteDistancePreference.PreferNearestToRouteDestination, RouteOrientationPreference.TowardsObject, Target.LotCurrent.LotId, new int[1]
                    {
                        Target.RoomId
                    });

                    if (Actor == null || !Actor.DoRoute(route))
                    {
                        return(false);
                    }
                    UnrequestWalkStyle(Sim.WalkStyle.Run);
                }
                else
                {
                    Actor.RouteTurnToFace(Target.Position);
                }
                if (Simulator.CheckYieldingContext(false))
                {
                    Simulator.Sleep(20);
                }
                if (Target.SimDescription == null || !Target.SimDescription.IsValidDescription)
                {
                    return(true);
                }
                NFinalizeDeath.CheckYieldingContext();
                StateMachineClient stateMachineClient = StateMachineClient.Acquire(Actor, "DeathReactions");

                stateMachineClient.SetActor("x", Actor);
                stateMachineClient.EnterState("x", "Enter");
                BeginCommodityUpdates();
                bool flag  = false;
                bool flag2 = false;

                //bool flag3 = false;

                LTRData.RelationshipClassification relationshipClassification = LTRData.RelationshipClassification.Low;
                Relationship relationship = Relationship.Get(Actor, Target, false);

                if (relationship != null)
                {
                    relationshipClassification = LTRData.Get(relationship.LTR.CurrentLTR).RelationshipClass;
                }

                if (Actor == null || Target == null || Actor.Genealogy == null || Target.Genealogy == null)
                {
                    return(true);
                }

                if (relationshipClassification == LTRData.RelationshipClassification.High || Actor.Genealogy.IsBloodRelated(Target.Genealogy))
                {
                    if (relationship != null && relationship.AreRomantic() && relationship.LTR.IsPositive)
                    {
                        flag2 = true;
                    }
                    else
                    {
                        flag = true;
                    }
                    //flag3 = true;
                }
                NFinalizeDeath.CheckYieldingContext();
                switch (Actor.SimDescription.Species)
                {
                case CASAgeGenderFlags.None:
                case CASAgeGenderFlags.Human:
                    if (!Actor.IsInActiveHousehold)
                    {
                        stateMachineClient.RequestState("x", "Shocked");
                        NFinalizeDeath.CheckYieldingContext();
                        if (RandomUtil.RandomChance(25))
                        {
                            stateMachineClient.RequestState("x", "Evil");
                        }
                        else
                        {
                            stateMachineClient.RequestState("x", "LovedOneLoop");
                        }
                        flag  = true;
                        flag2 = true;
                        //flag3 = true;
                    }
                    else
                    {
                        stateMachineClient.RequestState("x", "Shocked");
                        NFinalizeDeath.CheckYieldingContext();
                        Actor.Motives.ChangeValue(CommodityKind.Fun, kWitnessDeathStressPenalty);
                        stateMachineClient.RequestState("x", "BasicLoop");
                        flag  = false;
                        flag2 = false;
                        //flag3 = false;
                    }

                    break;

                case CASAgeGenderFlags.Dog:
                case CASAgeGenderFlags.LittleDog:
                    stateMachineClient.RequestState("x", "Dog");
                    break;

                case CASAgeGenderFlags.Cat:
                    stateMachineClient.RequestState("x", "Cat");
                    break;

                case CASAgeGenderFlags.Horse:
                    stateMachineClient.RequestState("x", "Horse");
                    break;
                }
                EventTracker.SendEvent(EventTypeId.kSawSimDie, Actor, Target);
                DoLoop(ExitReason.Default, __LoopDel, stateMachineClient);
                EndCommodityUpdates(true);
                if (Actor.IsInActiveHousehold)
                {
                    if (Actor.BuffManager == null)
                    {
                        return(false);
                    }

                    if (flag2 && Target.SimDescription.DeathStyle != 0)
                    {
                        Actor.BuffManager.AddElement(BuffNames.HeartBroken, Origin.FromWitnessingDeath);
                        BuffHeartBroken.BuffInstanceHeartBroken buffInstanceHeartBroken = Actor.BuffManager.GetElement(BuffNames.HeartBroken) as BuffHeartBroken.BuffInstanceHeartBroken;
                        if (buffInstanceHeartBroken != null)
                        {
                            buffInstanceHeartBroken.MissedSim = Target.SimDescription;
                        }
                    }
                    else if (flag && Target.SimDescription.DeathStyle != 0)
                    {
                        Actor.BuffManager.AddElement(BuffNames.Mourning, Urnstone.CalculateMourningMoodStrength(Actor, Target.SimDescription), Origin.FromWitnessingDeath);
                        BuffMourning.BuffInstanceMourning buffInstanceMourning = Actor.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning;
                        if (buffInstanceMourning != null)
                        {
                            buffInstanceMourning.MissedSim = Target.SimDescription;
                        }
                    }
                }
                else
                {
                    if (Actor.BuffManager == null)
                    {
                        return(false);
                    }
                    if (flag2)
                    {
                        Actor.BuffManager.AddElement(BuffNames.HeartBroken, Origin.FromWitnessingDeath);
                        BuffHeartBroken.BuffInstanceHeartBroken buffInstanceHeartBroken = Actor.BuffManager.GetElement(BuffNames.HeartBroken) as BuffHeartBroken.BuffInstanceHeartBroken;
                        if (buffInstanceHeartBroken != null)
                        {
                            buffInstanceHeartBroken.MissedSim = Target.SimDescription;
                        }
                    }
                    else if (flag)
                    {
                        Actor.BuffManager.AddElement(BuffNames.Mourning, Urnstone.CalculateMourningMoodStrength(Actor, Target.SimDescription), Origin.FromWitnessingDeath);
                        BuffMourning.BuffInstanceMourning buffInstanceMourning = Actor.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning;
                        if (buffInstanceMourning != null)
                        {
                            buffInstanceMourning.MissedSim = Target.SimDescription;
                        }
                    }
                }
                NFinalizeDeath.CheckYieldingContext();
                stateMachineClient.RequestState("x", "Exit");
                stateMachineClient.Dispose();
                //if (!NFinalizeDeath.IsAllActiveHousehold_SimObject(Actor) &&
                //        !NFinalizeDeath.IsAllActiveHousehold_SimObject(Target) &&
                //        !(Actor.SimDescription.Service is GrimReaper) &&
                //        !(Target.SimDescription.Service is GrimReaper) &&
                //        RandomUtil.RandomChance(70)
                //)
                //return NFinalizeDeath.ForceNHSReapSoul(Target, Actor);

                return(true);
            }