Пример #1
0
        public static bool TestScoringAbsolute(Sim actor, Sim target, string scoringName, bool checkAffair)
        {
            int score = GetScoring(actor, target, scoringName, checkAffair, true);

            ScoringLookup.AddStat("Test Absolute " + scoringName, score);

            return(score > 0);
        }
Пример #2
0
        public static bool TestScoringNormal(Sim actor, Sim target, string scoringName, bool checkAffair)
        {
            int score = GetScoring(actor, target, scoringName, checkAffair, false);

            ScoringLookup.AddStat("Test Normal " + scoringName, score);

            return(score > 0);
        }
Пример #3
0
        protected int PrivateScore(ScoringDelegate func, SP parameters, ICollection <IScoring <T, SP> > scoringList, string suffix)
        {
            int totalScore = 0;

            foreach (U scoring in scoringList)
            {
                int score = func(scoring, parameters);

                ScoringLookup.AddStat("Combined " + scoring.ToString() + suffix, score);

                if (score <= -1000)
                {
                    return(score);
                }

                totalScore += score;
            }

            return(totalScore);
        }
Пример #4
0
        protected static void OnRecalulateDesire()
        {
            try
            {
                List <Sim> sims = new List <Sim>();
                foreach (Sim sim in LotManager.Actors)
                {
                    try
                    {
                        if (sim.InteractionQueue == null)
                        {
                            continue;
                        }

                        if (sim.InteractionQueue.GetCurrentInteraction() is SocialInteraction)
                        {
                            continue;
                        }

                        if (sim.Autonomy == null)
                        {
                            continue;
                        }

                        if (sim.Autonomy.SituationComponent == null)
                        {
                            continue;
                        }

                        if (sim.Autonomy.SituationComponent.mSituations == null)
                        {
                            continue;
                        }

                        if (sim.Autonomy.SituationComponent.mSituations.Count > 0)
                        {
                            ScoringLookup.IncStat("STC Desire In Situation");
                            continue;
                        }

                        sims.Add(sim);
                    }
                    catch (Exception e)
                    {
                        Common.Exception(sim, e);
                    }
                }

                foreach (Sim sim in sims)
                {
                    try
                    {
                        SocialComponent social = sim.SocialComponent;
                        if (social == null)
                        {
                            continue;
                        }

                        social.mShortTermDesireToSocializeWith.Clear();

                        if (!Woohooer.Settings.UsingTraitScoring)
                        {
                            continue;
                        }

                        if (sim.Autonomy.Actor == null)
                        {
                            continue;
                        }

                        if (!sim.Autonomy.ShouldRunLocalAutonomy)
                        {
                            continue;
                        }

                        if (sim.LotCurrent == null)
                        {
                            continue;
                        }

                        if (sim.LotCurrent.IsWorldLot)
                        {
                            continue;
                        }

                        SpeedTrap.Sleep();

                        if (!WoohooScoring.TestScoringNormal(sim, null, "InterestInRomance", true))
                        {
                            ScoringLookup.IncStat("STC Desire Fail");
                            continue;
                        }

                        ScoringLookup.IncStat("STC Desire Success");

                        List <Sim> others = new List <Sim>(sim.LotCurrent.GetAllActors());
                        foreach (Sim other in others)
                        {
                            if (sim == other)
                            {
                                continue;
                            }

                            string reason;
                            GreyedOutTooltipCallback callback = null;
                            if (!CommonSocials.CanGetRomantic(sim, other, true, false, true, ref callback, out reason))
                            {
                                continue;
                            }

                            int std = (int)(RelationshipEx.GetAttractionScore(sim.SimDescription, other.SimDescription, false) * 2);

                            ScoringLookup.AddStat("Desire " + sim.FullName, std);

                            social.AddShortTermDesireToSocializeWith(other, std);

                            SpeedTrap.Sleep();
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(sim, e);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("STCDesire:OnRecalculateDesire", e);
            }
        }