Exemple #1
0
        public static bool CheckCheating(Sim observer, Sim actor, Sim target, JealousyLevel jealousyLevel)
        {
            if (CommonSocials.IsPolyamorous(actor.SimDescription, target.SimDescription, observer.SimDescription))
            {
                return(false);
            }

            if (target.HasTrait(TraitNames.NoJealousy))
            {
                return(false);
            }

            if (!actor.HasTrait(TraitNames.NoJealousy) && (jealousyLevel != JealousyLevel.None))
            {
                foreach (Situation situation in actor.Autonomy.SituationComponent.Situations)
                {
                    if (situation.DoesSituationRuleOutJealousy(observer, actor, target, jealousyLevel))
                    {
                        return(false);
                    }
                }

                Relationship relationship = Relationship.Get(observer, actor, false);
                if (relationship != null)
                {
                    if (!LTRData.Get(relationship.LTR.CurrentLTR).IsRomantic)
                    {
                        if ((actor.Partner != null) && (actor.Partner != target.SimDescription))
                        {
                            bool         flag          = observer.Genealogy.IsBloodRelated(actor.Partner.Genealogy);
                            Relationship relationship2 = Relationship.Get(observer.SimDescription, actor.Partner, false);
                            if (relationship2 != null)
                            {
                                LTRData data2 = LTRData.Get(relationship2.LTR.CurrentLTR);
                                flag |= data2.IsFriendly;
                            }

                            if (flag)
                            {
                                SocialComponent.OnSomeoneICareAboutWasCheatedOn(observer, actor.Partner, actor.SimDescription, target.SimDescription, jealousyLevel);
                                return(true);
                            }
                        }
                    }
                    else
                    {
                        // Custom
                        switch (jealousyLevel)
                        {
                        case JealousyLevel.Medium:
                        case JealousyLevel.High:
                            GreyedOutTooltipCallback greyedOutTooltipCallback = null;
                            if (CommonSocials.TestAllowBreakup(actor, true, ref greyedOutTooltipCallback))
                            {
                                RomanceVisibilityState.PushAccuseSimOfBetrayal(observer, actor);
                            }
                            return(true);
                        }

                        LongTermRelationshipTypes longTermRelationship = Relationship.GetLongTermRelationship(observer, actor);
                        SocialComponent.PlayReactionAndUpdateRelationshipOnJealousy(observer, actor.SimDescription, target.SimDescription, jealousyLevel);
                        LongTermRelationshipTypes currentLTR = Relationship.GetLongTermRelationship(observer, actor);
                        SocialComponent.SetSocialFeedback(CommodityTypes.Insulting, observer, false, 0x0, longTermRelationship, currentLTR);
                        return(true);
                    }
                }
            }
            return(false);
        }