Beispiel #1
0
            public override bool Test(Sim a, Computer target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!SimClock.IsNightTime())
                {
                    greyedOutTooltipCallback = Common.DebugTooltip("Not Night Time");
                    return(false);
                }

                if (isAutonomous)
                {
                    if (!mRandom)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Not Random");
                        return(false);
                    }

                    if (!Woohooer.Settings.mAutonomousComputer)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("No Autonomous");
                        return(false);
                    }

                    if (ScoringLookup.GetScore("LikeProfessional", a.SimDescription) < 0)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Score Fail");
                        return(false);
                    }

                    if (!CommonWoohoo.SatisfiesCooldown(a, RandomUtil.GetRandomObjectFromList <Sim>(LotManager.Actors), isAutonomous, ref greyedOutTooltipCallback))
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Cooldown Fail");
                        return(false);
                    }

                    if (!CommonWoohoo.HasWoohooableObject(a.LotHome, a, RandomUtil.GetRandomObjectFromList <Sim>(LotManager.Actors)))
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("No Woohooable Objects Fail");
                        return(false);
                    }

                    if (GetPotentials(a).Count == 0)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("No Choices");
                        return(false);
                    }
                }
                else
                {
                    if (!KamaSimtra.Settings.mShowRegisterInteraction)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("User Hidden");
                        return(false);
                    }
                }

                return(true);
            }
Beispiel #2
0
        protected override bool IsFail(SimDescription sim, SimDescription target)
        {
            if (string.IsNullOrEmpty(mSneakinessScoring))
            {
                IncStat("No Sneakiness Scoring");
                return(false);
            }

            return(AddScoring("Target Sneak", ScoringLookup.GetScore(mSneakinessScoring, target)) > AddScoring("Sim Sneak", ScoringLookup.GetScore(mSneakinessScoring, sim)));
        }
Beispiel #3
0
        protected bool ScoreChildMove(IScoringGenerator stats, string tag, SimDescription child, List <SimDescription> movingSims)
        {
            if (child.Genealogy.Parents.Count == 0)
            {
                stats.IncStat(tag + " ChildMove: No Parents");
                return(false);
            }

            int  firstScore  = 0;
            bool firstMoving = false;

            SimDescription mom = null, dad = null;

            Relationships.GetParents(child, out mom, out dad);

            if (mom != null)
            {
                firstMoving = movingSims.Contains(mom);

                if ((firstMoving) || (mom.Household == child.Household))
                {
                    firstScore = stats.AddScoring(tag + " ChildMove", ScoringLookup.GetScore("ParentChild", child, mom));
                }
                else
                {
                    return(true);
                }
            }

            int  secondScore  = 0;
            bool secondMoving = false;

            if (dad != null)
            {
                secondMoving = movingSims.Contains(dad);

                if ((secondMoving) || (dad.Household == child.Household))
                {
                    secondScore = stats.AddScoring(tag + " ChildMove", ScoringLookup.GetScore("ParentChild", child, dad));
                }
                else
                {
                    return(true);
                }
            }

            if (firstScore > secondScore)
            {
                return(firstMoving);
            }
            else
            {
                return(secondMoving);
            }
        }
Beispiel #4
0
            public int AddScoring(string scoring, SimDescription sim, SimDescription other)
            {
                int score = ScoringLookup.GetScore(scoring, sim, other);

                if (!Common.kDebugging)
                {
                    return(score);
                }

                return(AddScoring(mName + " " + scoring, score));
            }
Beispiel #5
0
            public int AddScoring(string scoring, int option, ScoringLookup.OptionType type, SimDescription sim, SimDescription other, Common.DebugLevel minLevel)
            {
                int score = ScoringLookup.GetScore(scoring, option, type, sim, other);

                if (!Common.kDebugging)
                {
                    return(score);
                }

                return(AddScoring(mName + " " + scoring, score, minLevel));
            }
Beispiel #6
0
            public int AddScoring(string scoring, int option, ScoringLookup.OptionType type, SimDescription sim)
            {
                int score = ScoringLookup.GetScore(scoring, option, type, sim);

                if (!Common.kDebugging)
                {
                    return(score);
                }

                return(AddScoring(mName + " " + scoring, score));
            }
Beispiel #7
0
 public virtual void Symptomize(Sim sim, DiseaseVector vector)
 {
     if ((string.IsNullOrEmpty(mSymptomScoring)) ||
         (ScoringLookup.GetScore(mSymptomScoring, sim.SimDescription) >= mSymptomScoringMinimum))
     {
         foreach (SymptomChance chance in mSymptoms)
         {
             chance.Perform(sim, vector);
         }
     }
 }
Beispiel #8
0
            public int AddScoring(string scoring, SimDescription sim, Common.DebugLevel minLevel)
            {
                int score = ScoringLookup.GetScore(scoring, sim);

                if (!Common.kDebugging)
                {
                    return(score);
                }

                return(AddScoring(mName + " " + scoring, score, minLevel));
            }
Beispiel #9
0
        protected override bool IsSuccess(SimDescription sim, DiseaseVector vector)
        {
            int minimum = mMinimum;

            if (minimum == int.MinValue)
            {
                minimum = vector.NetStrength;
            }

            minimum += vector.GetCounter(mMinMutation);

            return(ScoringLookup.GetScore(mScoring, sim) > minimum);
        }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame))
            {
                return(false);
            }

            Romances.AddWoohooerNotches(Sim, Target, false, true);

            Add(frame, new ExpectedMarriageScenario(Sim, Target), ScenarioResult.Start);
            Add(frame, new SuccessScenario(), ScenarioResult.Start);

            mNumberOfKidsBetween = NumberOfKidsBetween(Sim, Target);

            AddStat("Preferred Baby Count", (ScoringLookup.GetScore("PreferredBabyCount", Sim) + ScoringLookup.GetScore("PreferredBabyCount", Target)) / 2);

            return(true);
        }
Beispiel #11
0
            public override bool Test(Sim a, Computer target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (isAutonomous)
                {
                    if (!mRandom)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Not Random");
                        return(false);
                    }

                    if (!Woohooer.Settings.mAutonomousComputer)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("No Autonomous");
                        return(false);
                    }

                    if (ScoringLookup.GetScore("LikeCyberWoohoo", a.SimDescription) < 0)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Score Fail");
                        return(false);
                    }

                    List <Sim> unknown = new List <Sim>();
                    List <Sim> known   = new List <Sim>();
                    GetPotentials(a, target, isAutonomous, false, unknown, known);

                    if ((unknown.Count + known.Count) == 0)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("No Choices");
                        return(false);
                    }
                }
                else
                {
                    if (!KamaSimtra.Settings.mShowCyberWoohooInteraction)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("User Hidden");
                        return(false);
                    }
                }

                return(base.Test(a, target, isAutonomous, ref greyedOutTooltipCallback));
            }
Beispiel #12
0
            public bool CanInfect(SimDescription sim, SimDescription source)
            {
                if (SimTypes.IsDead(sim))
                {
                    return(false);
                }

                if (sim.HasTrait(TraitNames.Simmunity))
                {
                    return(false);
                }

                if ((SimTypes.IsOccult(sim, Sims3.UI.Hud.OccultTypes.ImaginaryFriend)) ||
                    (SimTypes.IsOccult(sim, Sims3.UI.Hud.OccultTypes.Genie)))
                {
                    if (SimTypes.IsService(sim))
                    {
                        return(false);
                    }
                }

                return(ScoringLookup.GetScore(mInfectionScoring, sim, source) >= mInfectionMinimum);
            }
Beispiel #13
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!mSuccess.TestBeforehand(Manager, Sim, Target))
            {
                IncStat("Success TestBeforehand Fail");
                return(false);
            }

            if (!mFailure.TestBeforehand(Manager, Sim, Target))
            {
                IncStat("Failure TestBeforehand Fail");
                return(false);
            }

            if (!RandomUtil.RandomChance(mChance))
            {
                IncStat("Chance Fail");
                return(false);
            }

            SimPersonality clan = Personalities.GetPersonality(TargetFilter.Clan);

            if (clan == null)
            {
                clan = Manager as SimPersonality;
            }

            if (clan == null)
            {
                IncStat("Clan Missing");
                return(false);
            }

            mFail = ((!string.IsNullOrEmpty(mAcceptanceScoring)) && (AddScoring("Acceptance", ScoringLookup.GetScore(mAcceptanceScoring, Target, Sim)) <= 0));

            if (!mFail)
            {
                if (!clan.RemoveFromClan(Target))
                {
                    return(false);
                }

                mSuccess.Perform(this, frame, "Success", Sim, Target);
            }
            else
            {
                mFailure.Perform(this, frame, "Failure", Sim, Target);
            }
            return(true);
        }
Beispiel #14
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            int totalAllowed = sData.GetDataForLevel(Sim);
            if (totalAllowed <= 0) return false;

            Career career = Sim.Occupation as Career;
            List<SimDescription> contenders = GetContenders(career);

            if (contenders.Count >= totalAllowed)
            {
                AddStat("Contenders", contenders.Count);
                AddStat("Allowed", totalAllowed);

                int score = AddScoring("New Sim", ScoringLookup.GetScore ("Ambition", Sim));

                List<SimDescription> losers = new List<SimDescription>();

                bool allowActive = GetValue<AllowActiveOption, bool>();

                foreach (SimDescription contender in contenders)
                {
                    if (!SimTypes.IsSelectable(Sim))
                    {
                        if ((!allowActive) && (SimTypes.IsSelectable(contender)))
                        {
                            IncStat("Active Denied");
                            continue;
                        }
                    }

                    bool checkOther = false;

                    int contenderScore = AddScoring("Contender", ScoringLookup.GetScore ("Ambition", contender));
                    if (contenderScore < score)
                    {
                        if ((SimTypes.IsSelectable(Sim)) && (SimTypes.IsSelectable(contender)))
                        {
                            IncStat("Both Selectable");
                            checkOther = true;
                        }
                    }
                    else if (contenderScore == score)
                    {
                        IncStat("Equal Score");
                        checkOther = true;
                    }
                    else
                    {
                        continue;
                    }

                    if (checkOther)
                    {
                        int contenderRelation = GetBossRelationship(contender).CompareTo(GetBossRelationship(Sim));

                        if (contenderRelation > 0)
                        {
                            IncStat("Boss Relation");
                            continue;
                        }
                        else if ((contenderRelation == 0) && (contender.Occupation.PayPerHourOrStipend > career.PayPerHourOrStipend))
                        {
                            IncStat("Pay Worse");
                            continue;
                        }
                    }

                    losers.Add(contender);
                }

                if (losers.Count == 0)
                {
                    if ((!allowActive) && (SimTypes.IsSelectable(Sim)))
                    {
                        losers.AddRange(contenders);
                    }
                    else
                    {
                        losers.Add(Sim);
                    }
                }

                if (losers.Count == 0) return false;

                mLoser = RandomUtil.GetRandomObjectFromList(losers);

                mLoser.Occupation.DemoteSim();

                Career loserCareer = mLoser.Occupation as Career;
                if (loserCareer != null)
                {
                    loserCareer.GiveRaise(false);
                }
                return true;
            }

            return false;
        }
Beispiel #15
0
        public bool BumpToLowerState(Common.IStatGenerator stats, SimDescription a, SimDescription b, bool story)
        {
            if (a.Partner == b)
            {
                if ((!AllowBreakup(this, a, Managers.Manager.AllowCheck.None)) || (!AllowBreakup(this, b, Managers.Manager.AllowCheck.None)))
                {
                    IncStat("BumpDown: Breakup: User Denied");
                    stats.IncStat("BumpDown: Breakup: User Denied");
                    return(false);
                }

                SetElapsedTime <DayOfLastPartnerOption>(a);
                SetElapsedTime <DayOfLastPartnerOption>(b);

                try
                {
                    a.Partner = null;
                }
                catch (Exception e)
                {
                    Common.DebugException(a, e);
                }

                try
                {
                    b.Partner = null;
                }
                catch (Exception e)
                {
                    Common.DebugException(b, e);
                }

                if ((a.CreatedSim != null) && (a.CreatedSim.BuffManager != null))
                {
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.NewlyEngaged);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstKiss);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstRomance);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.JustMarried);
                    a.CreatedSim.BuffManager.RemoveElement(BuffNames.WeddingDay);
                }

                if ((b.CreatedSim != null) && (b.CreatedSim.BuffManager != null))
                {
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.NewlyEngaged);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstKiss);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstRomance);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.JustMarried);
                    b.CreatedSim.BuffManager.RemoveElement(BuffNames.WeddingDay);
                }

                if (story)
                {
                    Stories.PrintStory(this, "Breakup", new object[] { a, b }, null);
                }
            }

            Relationship relation = ManagerSim.GetRelationship(a, b);

            if (relation != null)
            {
                LongTermRelationshipTypes currentState = relation.LTR.CurrentLTR;

                LongTermRelationshipTypes nextState = ChangeRelationship.NextNegativeRomanceState(currentState, relation.IsPetToPetRelationship);
                if (nextState != LongTermRelationshipTypes.Undefined)
                {
                    float liking = relation.LTR.Liking;

                    AddStat("BumpDown: Pre", liking);
                    stats.AddStat("BumpDown: Pre", liking);

                    ForceChangeState(relation, nextState);

                    int score = AddScoring("BumpDown: Hate Loss", ScoringLookup.GetScore("HateRomanceLoss", b));
                    if ((SimTypes.IsSelectable(a)) || (SimTypes.IsSelectable(b)) || (stats.AddScoring("BumpDown: Hate Loss", score) <= 0))
                    {
                        if (liking > relation.LTR.Liking)
                        {
                            try
                            {
                                relation.LTR.SetLiking(liking);
                            }
                            catch (Exception e)
                            {
                                Common.DebugException(a, b, e);

                                IncStat("BumpDown: Reset Liking Fail");
                                stats.IncStat("BumpDown: Reset Liking Fail");
                            }
                        }
                    }

                    AddStat("BumpDown: Post", relation.LTR.Liking);
                    stats.AddStat("BumpDown: Post", relation.LTR.Liking);

                    IncStat("BumpDown " + relation.LTR.CurrentLTR);
                    stats.IncStat("BumpDown " + relation.LTR.CurrentLTR);
                }
            }
            return(true);
        }
Beispiel #16
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!mSuccess.TestBeforehand(Manager, Sim, Target))
            {
                IncStat("Success TestBeforehand Fail");
                return(false);
            }

            if (!mFailure.TestBeforehand(Manager, Sim, Target))
            {
                IncStat("Failure TestBeforehand Fail");
                return(false);
            }

            mFail = false;
            if (!string.IsNullOrEmpty(mSneakinessScoring))
            {
                foreach (SimDescription member in CommonSpace.Helpers.Households.All(Target.Household))
                {
                    if (AddScoring("Target Sneak", ScoringLookup.GetScore(mSneakinessScoring, member)) > AddScoring("Sim Sneak", ScoringLookup.GetScore(mSneakinessScoring, Sim)))
                    {
                        mFail = true;
                        break;
                    }
                }
            }

            if (!base.PrivateUpdate(frame))
            {
                return(false);
            }

            if (mFail)
            {
                if (!Situations.PushVisit(this, Sim, Target.LotHome))
                {
                    IncStat("Push Fail");
                    return(false);
                }

                mFailure.Perform(this, frame, "Failure", Sim, Target);
                return(true);
            }
            else
            {
                List <Origin> types = new List <Origin>(sTypes);

                while (types.Count > 0)
                {
                    Origin type = RandomUtil.GetRandomObjectFromList(types);
                    types.Remove(type);

                    IncStat("Try " + type);

                    GameObject boobyTrap = null;

                    switch (type)
                    {
                    case Origin.FromPrankDoorbellDitch:
                        if (!mAllowDoorPranks)
                        {
                            continue;
                        }

                        if (Situations.PushInteraction(this, Sim, Target.LotHome, Door.PrankDoorbellDitch.Singleton))
                        {
                            return(true);
                        }
                        break;

                    case Origin.FromPrankFlamingBag:
                        if (!mAllowDoorPranks)
                        {
                            continue;
                        }

                        if (Situations.PushInteraction(this, Sim, Target.LotHome, Door.PrankFlamingBag.Singleton))
                        {
                            return(true);
                        }
                        break;

                    case Origin.FromPrankThrowingEggs:
                        if (!mAllowDoorPranks)
                        {
                            continue;
                        }

                        if (Situations.PushInteraction(this, Sim, Target.LotHome, Door.PrankThrowingEggs.Singleton))
                        {
                            return(true);
                        }
                        break;

                    case Origin.FromPrankToilet:
                        Toilet[] toilets = Target.LotHome.GetObjects <Toilet>();
                        if (toilets.Length > 0)
                        {
                            boobyTrap = RandomUtil.GetRandomObjectFromList(toilets);
                        }
                        break;

                    case Origin.FromPrankSink:
                        Sink[] sinks = Target.LotHome.GetObjects <Sink>();
                        if (sinks.Length > 0)
                        {
                            boobyTrap = RandomUtil.GetRandomObjectFromList(sinks);
                        }
                        break;

                    case Origin.FromPrankShower:
                        Shower[] showers = Target.LotHome.GetObjects <Shower>();
                        if (showers.Length > 0)
                        {
                            boobyTrap = RandomUtil.GetRandomObjectFromList(showers);
                        }
                        break;

                    case Origin.FromPrankWhoopeeCushion:
                        ChairDining[] chairs = Target.LotHome.GetObjects <ChairDining>();
                        if (chairs.Length > 0)
                        {
                            boobyTrap = RandomUtil.GetRandomObjectFromList(chairs);
                        }
                        break;

                    case Origin.FromPrankComputer:
                        Computer[] computers = Target.LotHome.GetObjects <Computer>();
                        if (computers.Length > 0)
                        {
                            if (Situations.PushInteraction(this, Sim, RandomUtil.GetRandomObjectFromList(computers), Computer.SetBoobyTrap.Singleton))
                            {
                                mSuccess.Perform(this, frame, "Success", Sim, Target);
                                return(true);
                            }
                        }
                        break;
                    }

                    if (boobyTrap != null)
                    {
                        if (Situations.PushInteraction(this, Sim, boobyTrap, SetBoobyTrap.Singleton))
                        {
                            mSuccess.Perform(this, frame, "Success", Sim, Target);
                            return(true);
                        }
                    }
                }

                IncStat("No Choices");
                return(false);
            }
        }
Beispiel #17
0
        public override bool Run()
        {
            string msg = "Run" + Common.NewLine;

            try
            {
                StandardEntry();
                if (!Target.StartComputing(this, SurfaceHeight.Table, true))
                {
                    StandardExit();
                    return(false);
                }

                timeTillLearn = RandomUtil.RandomFloatGaussianDistribution(Target.ComputerTuning.ChatLearnSomethingFrequencyStart, Target.ComputerTuning.ChatLearnSomethingFrequencyEnd);
                Target.StartVideo(Computer.VideoType.Chat);
                if (CheckForCancelAndCleanup())
                {
                    Target.StopComputing(this, Computer.StopComputingAction.TurnOff, false);
                    return(false);
                }

                bool ignoreGender = RandomUtil.RandomChance(KamaSimtra.Settings.mCyberWoohooChanceOfMisunderstanding);

                simToChat = GetSelectedObject() as Sim;
                if (simToChat == null)
                {
                    //msg += Common.NewLine + "CyberWoohoo";

                    List <Sim> unknown = new List <Sim>();
                    List <Sim> known   = new List <Sim>();
                    GetPotentials(Actor, Target, Autonomous, ignoreGender, unknown, known);

                    //Common.DebugStackLog(msg);

                    if ((unknown.Count > 0x0) && Actor.IsSelectable)
                    {
                        simToChat = RandomUtil.GetRandomObjectFromList(unknown);
                    }
                    else if (known.Count > 0x0)
                    {
                        simToChat = RandomUtil.GetRandomObjectFromList(known);
                    }
                }

                bool succeeded = false;
                if (simToChat == null)
                {
                    Actor.ShowTNSIfSelectable(Common.Localize("CyberWoohoo:NoOne", Actor.IsFemale), StyledNotification.NotificationStyle.kSimTalking);
                }
                else
                {
                    Common.DebugNotify("CyberWoohoo: " + simToChat.FullName, Actor);

                    BeginCommodityUpdates();
                    AnimateSim("GenericTyping");
                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), LoopDel, null);
                    EndCommodityUpdates(succeeded);

                    if (Woohooer.Settings.mApplyBuffs)
                    {
                        if (mClimaxChances <= 2)
                        {
                            Actor.BuffManager.AddElement(KamaSimtra.sPremature, WoohooBuffs.sWoohooOrigin);
                        }

                        int score = ScoringLookup.GetScore("LikeCyberWoohoo", Actor.SimDescription) + KamaSimtra.Settings.mCyberWoohooBaseChanceScoring;
                        if (score > 0)
                        {
                            Actor.BuffManager.RemoveElement(KamaSimtra.sDislikeCyberWoohoo);
                            Actor.BuffManager.AddElement(KamaSimtra.sLikeCyberWoohoo, WoohooBuffs.sWoohooOrigin);
                        }
                        else if (score < 0)
                        {
                            Actor.BuffManager.RemoveElement(KamaSimtra.sLikeCyberWoohoo);
                            Actor.BuffManager.AddElement(KamaSimtra.sDislikeCyberWoohoo, WoohooBuffs.sWoohooOrigin);
                        }
                    }
                }

                Target.StopComputing(this, Computer.StopComputingAction.TurnOff, false);
                StandardExit();
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, msg, e);
                return(false);
            }
        }
Beispiel #18
0
            protected override void OnPerform()
            {
                if (mHouse == Household.ActiveHousehold)
                {
                    return;
                }

                List <SimDescription> babies         = new List <SimDescription>();
                List <SimDescription> teens          = new List <SimDescription>();
                List <SimDescription> adults         = new List <SimDescription>();
                List <SimDescription> teensAndAdults = new List <SimDescription>();

                foreach (SimDescription sim in Households.All(mHouse))
                {
                    if ((sim.IsPet) || (sim.ToddlerOrBelow))
                    {
                        babies.Add(sim);
                    }
                    else if (sim.YoungAdultOrAbove)
                    {
                        adults.Add(sim);
                        teensAndAdults.Add(sim);
                    }
                    else if (sim.Teen)
                    {
                        teens.Add(sim);
                        teensAndAdults.Add(sim);
                    }
                }

                if (adults.Count == 0)
                {
                    adults = teens;
                }

                bool purchaseInoculation = false;

                foreach (SimDescription sim in adults)
                {
                    if (ScoringLookup.GetScore("NRaasVectorPurchaseInoculation", sim) > 0)
                    {
                        purchaseInoculation = true;
                        break;
                    }
                }

                if (purchaseInoculation)
                {
                    List <DiseaseVector> potentials = new List <DiseaseVector>();

                    foreach (SimDescription sim in babies)
                    {
                        GetInoculates(sim, potentials, false);
                    }

                    while (potentials.Count > 0)
                    {
                        DiseaseVector potential = RandomUtil.GetRandomObjectFromList(potentials);
                        potentials.Remove(potential);

                        DiseaseVector inoculate = null;

                        List <SimDescription> potentialDonors = new List <SimDescription>();

                        foreach (SimDescription sim in teensAndAdults)
                        {
                            DiseaseVector vector = Vector.Settings.GetVector(sim, potential.Guid);
                            if (vector == null)
                            {
                                continue;
                            }

                            if (!vector.IsInoculationUpToDate)
                            {
                                potentialDonors.Add(sim);
                            }

                            if (!vector.IsInoculated)
                            {
                                continue;
                            }

                            inoculate = vector;
                            break;
                        }

                        if (inoculate == null)
                        {
                            if (mHouse.FamilyFunds < potential.InoculationCost)
                            {
                                continue;
                            }

                            inoculate = new DiseaseVector(potential.Data, Vector.Settings.GetCurrentStrain(potential.Data));
                            inoculate.Inoculate(potential.Data.InoculationStrain, true);

                            if (potentialDonors.Count > 0)
                            {
                                SimDescription donor = RandomUtil.GetRandomObjectFromList(potentialDonors);
                                VectorControl.Inoculate(donor, inoculate, true, false);
                            }

                            mHouse.ModifyFamilyFunds(-potential.InoculationCost);

                            Common.DebugNotify("Donor Inoculate: " + mHouse.Name + Common.NewLine + "Cost: " + potential.InoculationCost + Common.NewLine + potential.GetUnlocalizedDescription());
                        }
                        else
                        {
                            Common.DebugNotify("Existing Inoculate: " + mHouse.Name + Common.NewLine + "Cost: " + potential.InoculationCost + Common.NewLine + potential.GetUnlocalizedDescription());
                        }

                        if (inoculate != null)
                        {
                            foreach (SimDescription child in babies)
                            {
                                VectorControl.Inoculate(child, inoculate, false, false);
                            }

                            return;
                        }
                    }

                    potentials.Clear();

                    foreach (SimDescription sim in Households.All(mHouse))
                    {
                        // Babies were handled earlier
                        if (sim.ToddlerOrBelow)
                        {
                            continue;
                        }

                        GetInoculates(sim, potentials, true);
                    }

                    while (potentials.Count > 0)
                    {
                        DiseaseVector potential = RandomUtil.GetRandomObjectFromList(potentials);
                        potentials.Remove(potential);

                        if (mHouse.FamilyFunds < potential.InoculationCost)
                        {
                            continue;
                        }

                        potential.Inoculate(potential.Data.InoculationStrain, true);

                        mHouse.ModifyFamilyFunds(-potential.InoculationCost);

                        if (Common.kDebugging)
                        {
                            Common.DebugNotify("Inoculate: " + mHouse.Name + Common.NewLine + "Cost: " + potential.InoculationCost + Common.NewLine + potential.GetUnlocalizedDescription());
                        }

                        return;
                    }
                }

                List <SimDescription> choices = new List <SimDescription>(adults);

                while (choices.Count > 0)
                {
                    SimDescription choice = RandomUtil.GetRandomObjectFromList(choices);
                    choices.Remove(choice);

                    if (ScoringLookup.GetScore("NRaasVectorPurchaseResistance", choice) > 0)
                    {
                        List <DiseaseVector> potentials = new List <DiseaseVector>();

                        GetResisters(choice, potentials);

                        if (potentials.Count > 0)
                        {
                            DiseaseVector potential = RandomUtil.GetRandomObjectFromList(potentials);

                            mHouse.ModifyFamilyFunds(-potential.ResistanceCost);

                            potential.AlterResistance(Vector.Settings.mResistanceBoost);

                            potential.SetToIdentified();

                            if (Common.kDebugging)
                            {
                                Common.DebugNotify("Boost: " + mHouse.Name + Common.NewLine + "Cost: " + potential.ResistanceCost + Common.NewLine + potential.GetUnlocalizedDescription());
                            }
                        }
                    }

                    /*
                     * if (ScoringLookup.GetScore("NRaasVectorPurchaseProtection", choice) > 0)
                     * {
                     *  purchaseProtection = true;
                     * }
                     */
                }
            }
Beispiel #19
0
 public int AddScoring(string scoring, SimDescription scoreAgainst, SimDescription other, Common.DebugLevel minLevel)
 {
     return(AddScoring(scoring, ScoringLookup.GetScore(scoring, scoreAgainst, other), minLevel));
 }
Beispiel #20
0
        protected override bool Allow(SimDescription sim)
        {
            if (!base.Allow(sim))
            {
                return(false);
            }

            if (sim.Elder)
            {
                if (!ManagerPregnancy.TestNearElderLimit(this, sim, GetValue <NearDeathLimitOption, int>()))
                {
                    IncStat("Near Death Denied");
                    return(false);
                }
                else if (ExpectedPregnancyBaseScenario.GetNumLiveChildren(sim) > 0)
                {
                    IncStat("Has Children");
                    return(false);
                }
                else if (AddScoring("PreferredBabyCount", sim) <= 0)
                {
                    IncStat("Score Fail");
                    return(false);
                }
                else if (sim.Partner != null)
                {
                    if (Pregnancies.Allow(this, sim, sim.Partner, Managers.Manager.AllowCheck.Active))
                    {
                        IncStat("Partner Too Young");
                        return(false);
                    }
                    else if (!GetValue <AllowAdoptionOption, bool>(sim.Partner))
                    {
                        IncStat("Partner Adoption Denied");
                        return(false);
                    }
                    else if (AddScoring("Partner", ScoringLookup.GetScore("PreferredBabyCount", sim.Partner)) <= 0)
                    {
                        IncStat("Partner Score Fail");
                        return(false);
                    }
                }

                foreach (SimDescription other in HouseholdsEx.Humans(sim.Household))
                {
                    if (other.ChildOrBelow)
                    {
                        IncStat("Child in Home");
                        return(false);
                    }
                }
            }
            else if ((sim.Partner != null) && (sim.Gender == sim.Partner.Gender))
            {
                // If the sims can have children normally, then don't allow adoption
                if (Pregnancies.Allow(this, sim, sim.Partner, Managers.Manager.AllowCheck.Active))
                {
                    return(false);
                }
                else if (!GetValue <AllowAdoptionOption, bool>(sim.Partner))
                {
                    IncStat("Partner Adoption Denied");
                    return(false);
                }
                else if (!ExpectedPregnancyBaseScenario.TestPreferredBaby(this, sim, 0))
                {
                    IncStat("Preferred Fail");
                    return(false);
                }
                else if (!Pregnancies.TestCooldown(this, sim))
                {
                    IncStat("Cooldown Fail");
                    return(false);
                }
            }
            else
            {
                IncStat("Too Young");
                return(false);
            }

            return(true);
        }
Beispiel #21
0
        public bool Perform(Scenario scenario, ScenarioFrame frame, SimDescription sim, SimDescription target, SuccessUpdateDelegate successUpdate, out bool fail)
        {
            fail = false;

            if (!mSuccess.TestBeforehand(scenario.Manager, sim, target))
            {
                scenario.IncStat("Success TestBeforehand Fail");
                return(false);
            }

            if (!mFailure.TestBeforehand(scenario.Manager, sim, target))
            {
                scenario.IncStat("Failure TestBeforehand Fail");
                return(false);
            }

            if (!mExtremeFailure.TestBeforehand(scenario.Manager, sim, target))
            {
                scenario.IncStat("ExtremeFailure TestBeforehand Fail");
                return(false);
            }

            int score = 0;

            if (!string.IsNullOrEmpty(mFightScoring))
            {
                score  = scenario.AddScoring("Fight Sim", ScoringLookup.GetScore(mFightScoring, sim));
                score -= scenario.AddScoring("Fight Target", ScoringLookup.GetScore(mFightScoring, target));
            }

            if (score < 0)
            {
                if ((target.CreatedSim != null) && (target.OccultManager.HasOccultType(OccultTypes.Werewolf)))
                {
                    target.CreatedSim.BuffManager.AddElement(BuffNames.TopDog, Origin.FromWinningFight);
                }

                fail = true;

                if ((sim == scenario.Personalities.GetClanLeader(scenario.Manager)) && (RandomUtil.RandomChance(-score)))
                {
                    mExtremeFailure.Perform(scenario, frame, "ExtremeFailure", sim, target);
                }

                if (mAllowGoToJail)
                {
                    int bail = mBail;
                    if (bail == 0)
                    {
                        bail = scenario.Manager.GetValue <GotArrestedScenario.BailOption, int>() * 2;
                    }

                    scenario.Manager.AddAlarm(new GoToJailScenario(sim, bail));
                }
                else if (mActorAllowInjury)
                {
                    scenario.Manager.AddAlarm(new GoToHospitalScenario(sim, target, "InjuredFight", SimDescription.DeathType.OldAge));
                }

                mFailure.Perform(scenario, frame, "Failure", sim, target);
                return(true);
            }
            else if ((successUpdate == null) || (successUpdate(frame)))
            {
                if ((sim.CreatedSim != null) && (sim.OccultManager.HasOccultType(OccultTypes.Werewolf)))
                {
                    sim.CreatedSim.BuffManager.AddElement(BuffNames.TopDog, Origin.FromWinningFight);
                }

                if (mTargetAllowInjury)
                {
                    scenario.Manager.AddAlarm(new GoToHospitalScenario(target, sim, "InjuredFight", mDeathType, mChanceOfDeath.Value));
                }

                scenario.Add(frame, new PropagateWonFightScenario(sim, target), ScenarioResult.Start);
                scenario.Add(frame, new PropagateClanDelightScenario(sim, scenario.Manager, Origin.FromTheft), ScenarioResult.Start);

                mSuccess.Perform(scenario, frame, "Success", sim, target);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #22
0
        protected static void GetPotentials(Sim actor, Computer target, bool autonomous, bool ignoreGender, List <Sim> unknown, List <Sim> known)
        {
            foreach (Sim sim in LotManager.Actors)
            {
                if (sim == null)
                {
                    continue;
                }

                if (actor.Household == sim.Household)
                {
                    continue;
                }

                //msg += Common.NewLine + sim.FullName;

                string reason;
                GreyedOutTooltipCallback callback = null;
                if (!CommonSocials.CanGetRomantic(sim, actor, autonomous, true, true, ref callback, out reason))
                {
                    //msg += Common.NewLine + " " + callback();
                    continue;
                }

                if (!ignoreGender)
                {
                    if (!CommonSocials.CheckAutonomousGenderPreference(sim.SimDescription, actor.SimDescription))
                    {
                        //msg += Common.NewLine + " Not Gender Preference";
                        continue;
                    }
                }

                if (!target.CanSimBeChattedWith(actor, sim))
                {
                    //msg += Common.NewLine + " Not CanBeChatted";
                    continue;
                }

                if (unknown != null)
                {
                    int score = ScoringLookup.GetScore("LikeCyberWoohoo", sim.SimDescription) + KamaSimtra.Settings.mCyberWoohooBaseChanceScoring;
                    if (score < 0)
                    {
                        //msg += Common.NewLine + " Score Fail " + score;
                        continue;
                    }
                }

                if (Relationship.Get(actor, sim, false) == null)
                {
                    if (unknown != null)
                    {
                        unknown.Add(sim);
                    }
                }
                else
                {
                    known.Add(sim);
                }
            }
        }
Beispiel #23
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);
                        }
                    }
                }
            }
        }
Beispiel #24
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!mSuccess.TestBeforehand(Manager, Sim, Target))
            {
                IncStat("Success TestBeforehand Fail");
                return(false);
            }

            if (!mFailure.TestBeforehand(Manager, Sim, Target))
            {
                IncStat("Failure TestBeforehand Fail");
                return(false);
            }

            mFail = ((!string.IsNullOrEmpty(mAcceptanceScoring)) && (AddScoring("Acceptance", ScoringLookup.GetScore(mAcceptanceScoring, Target, Sim)) <= 0));

            if (!mFail)
            {
                if (!base.PrivateUpdate(frame))
                {
                    return(false);
                }

                Add(frame, new PropagateClanDelightScenario(Sim, Manager, Origin.FromSocialization), ScenarioResult.Start);

                mSuccess.Perform(this, frame, "Success", Sim, Target);
                return(true);
            }
            else
            {
                mFailure.Perform(this, frame, "Failure", Sim, Target);
                return(false);
            }
        }
Beispiel #25
0
        public override bool Run()
        {
            try
            {
                ProxyDefinition definition = InteractionDefinition as ProxyDefinition;

                if (mIsMaster)
                {
                    Actor.SynchronizationRole   = Sim.SyncRole.Initiator;
                    Actor.SynchronizationTarget = WooHooee;
                }
                else
                {
                    Actor.SynchronizationRole   = Sim.SyncRole.Receiver;
                    Actor.SynchronizationTarget = WooHooer;
                }

                bool success = false;
                try
                {
                    if (mIsMaster && !Actor.HasExitReason())
                    {
                        ElevatorWooHoo entry = definition.ProxyClone(WooHooer).CreateInstance(Target, WooHooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as ElevatorWooHoo;
                        entry.LinkedInteractionInstance = this;
                        entry.WooHooer = WooHooer;
                        entry.WooHooee = WooHooee;

                        if (!WooHooee.InteractionQueue.AddNext(entry))
                        {
                            return(false);
                        }
                    }

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

                    Actor.LoopIdle();
                    Actor.SynchronizationLevel = Sim.SyncLevel.NotStarted;
                    if (!Actor.WaitForSynchronizationLevelWithSim(Actor.SynchronizationTarget, Sim.SyncLevel.NotStarted, ElevatorDoors.kWooHooSyncTime))
                    {
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }

                    if (!Target.RouteToElevator(Actor))
                    {
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }

                    Target.InteriorObj.AddElevatorColumnToUseList(Actor);
                    Actor.RouteTurnToFace(Target.Position);
                    Actor.LoopIdle();
                    Actor.SynchronizationLevel = Sim.SyncLevel.Started;
                    if (!Actor.WaitForSynchronizationLevelWithSim(Actor.SynchronizationTarget, Sim.SyncLevel.Started, ElevatorDoors.kWooHooSyncTime))
                    {
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }

                    if (!Target.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.CutToHeadOfLine, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), ElevatorDoors.kWooHooSyncTime))
                    {
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }

                    IsDoneRouting       = true;
                    CancellableByPlayer = false;
                    Slot slotName = Slot.RoutingSlot_0;
                    if (!mIsMaster)
                    {
                        slotName = Slot.RoutingSlot_1;
                    }
                    Actor.SimRoutingComponent.DisallowBeingPushed      = true;
                    Actor.SimRoutingComponent.ShouldIgnoreAllObstacles = true;
                    if (!Actor.RouteToSlot(Target.InteriorObj, slotName))
                    {
                        WanderOut();
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }
                    Target.SimLine.RemoveFromQueue(Actor);
                    Actor.LoopIdle();
                    Actor.SynchronizationLevel = Sim.SyncLevel.Routed;
                    if (!Actor.WaitForSynchronizationLevelWithSim(Actor.SynchronizationTarget, Sim.SyncLevel.Routed, ElevatorDoors.kWooHooSyncTime))
                    {
                        WanderOut();
                        FinishLinkedInteraction(mIsMaster);
                        return(false);
                    }
                    IsInsideElevator = true;
                    StandardEntry(false);
                    Actor.LoopIdle();
                    Actor.SimDescription.Contactable = false;
                    if (!StartSync(mIsMaster))
                    {
                        WanderOut();
                        StandardExit(false);
                        return(false);
                    }

                    success = true;
                }
                finally
                {
                    if (!success)
                    {
                        definition.Definition.Restart(mIsMaster, WooHooer, WooHooee, Autonomous, Target);
                    }
                }

                BeginCommodityUpdates();

                try
                {
                    if (mIsMaster)
                    {
                        AcquireStateMachine("Elevator");
                        SetActorAndEnter("x", Actor, "Enter");
                        SetActorAndEnter("y", WooHooee, "Enter");
                        SetActor("elevatorExterior", Target);

                        success = true;

                        if (Woohooer.Settings.UsingTraitScoring)
                        {
                            if (ScoringLookup.GetScore("ElevatorSuccess", Actor.SimDescription) < 0)
                            {
                                success = false;
                            }
                            else if (ScoringLookup.GetScore("ElevatorSuccess", WooHooee.SimDescription) < 0)
                            {
                                success = false;
                            }
                        }

                        if (success)
                        {
                            isWooHooing = true;
                            RockGemMetalBase.HandleNearbyWoohoo(Target, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                            AddOneShotScriptEventHandler(0x6e, WooHooTurnOnCensorBars);
                            AddOneShotScriptEventHandler(0x6f, WooHooTurnOffCensorBars);
                            mJealousyAlarm = AlarmManager.Global.AddAlarm(4f, TimeUnit.Minutes, StartJealousyBroadcaster, "StartJealousyBroadcaster", AlarmType.DeleteOnReset, Target);
                            AnimateJoinSims("WooHooAccept");

                            CommonWoohoo.RunPostWoohoo(Actor, WooHooee, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                            CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitElevator, WooHooer, WooHooee);

                            if (CommonPregnancy.IsSuccess(WooHooer, WooHooee, Autonomous, definition.GetStyle(this)))
                            {
                                CommonPregnancy.Impregnate(WooHooer, WooHooee, Autonomous, definition.GetStyle(this));
                            }

                            RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
                            isWooHooing = false;
                        }
                        else
                        {
                            ElevatorDoors.WooHoo linkedInteractionInstance = LinkedInteractionInstance as ElevatorDoors.WooHoo;
                            if (linkedInteractionInstance != null)
                            {
                                linkedInteractionInstance.IsFail = true;
                            }
                            AddOneShotScriptEventHandler(0x65, new SacsEventHandler(WooHooRejectCallback));
                            AnimateJoinSims("WooHooReject");
                            SpeedTrap.Sleep((uint)SimClock.ConvertToTicks(RandomUtil.RandomFloatGaussianDistribution(ElevatorDoors.kWooHooFailWaitTime[0x0], ElevatorDoors.kWooHooFailWaitTime[0x1]), TimeUnit.Minutes));
                            if (WooHooer.LotHome != Target.LotCurrent)
                            {
                                WooHooer.BuffManager.AddElement(BuffNames.WalkOfShame, Origin.FromRejectedWooHooOffHome);
                            }
                            Relationship.Get(WooHooee, WooHooer, true).LTR.UpdateLiking(ElevatorDoors.kWooHooRejectRelHit);
                        }
                        AnimateNoYield("y", "Exit");
                        AnimateSim("Exit");
                    }
                    Actor.SynchronizationLevel = Sim.SyncLevel.Committed;
                    Actor.WaitForSynchronizationLevelWithSim(Actor.SynchronizationTarget, Sim.SyncLevel.Committed, ElevatorDoors.kWooHooSyncTime);
                    if (IsFail && !mIsMaster)
                    {
                        Actor.SetPosition(Target.InteriorObj.GetPositionOfSlot(Slot.RoutingSlot_0));
                        SpeedTrap.Sleep((uint)SimClock.ConvertToTicks(RandomUtil.RandomFloatGaussianDistribution(ElevatorDoors.kWooHooFailKickerOutWaitTime[0x0], ElevatorDoors.kWooHooFailKickerOutWaitTime[0x1]), TimeUnit.Minutes));
                    }
                    Target.RouteToElevator(Actor);
                    Actor.SynchronizationLevel = Sim.SyncLevel.Completed;
                    Actor.WaitForSynchronizationLevelWithSim(Actor.SynchronizationTarget, Sim.SyncLevel.Completed, ElevatorDoors.kWooHooSyncTime);
                    FinishLinkedInteraction(mIsMaster);
                    WaitForSyncComplete();
                }
                finally
                {
                    EndCommodityUpdates(true);
                }

                StandardExit(false);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Beispiel #26
0
 public int AddScoring(string scoring, SimDescription sim)
 {
     return(AddScoring(scoring, ScoringLookup.GetScore(scoring, sim)));
 }
Beispiel #27
0
        public override void Perform(Sim sim, DiseaseVector vector)
        {
            if (SimTypes.IsDead(sim.SimDescription))
            {
                return;
            }

            if (!mAllowActive)
            {
                if (SimTypes.IsSelectable(sim.SimDescription))
                {
                    return;
                }
            }

            bool found = false;

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

                if (ScoringLookup.GetScore(mScoring, other.SimDescription) >= mMinimum)
                {
                    found = true;
                    break;
                }
            }

            if (found)
            {
                return;
            }

            List <Lot> lots = new List <Lot>(LotManager.sLots.Values);

            while (lots.Count > 0)
            {
                Lot lot = RandomUtil.GetRandomObjectFromList(lots);
                lots.Remove(lot);

                if (lot.IsWorldLot)
                {
                    continue;
                }

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

                foreach (Sim other in lot.GetSims())
                {
                    if (ScoringLookup.GetScore(mScoring, other.SimDescription) >= mMinimum)
                    {
                        InteractionDefinition definition = null;

                        if (lot.IsCommunityLot)
                        {
                            definition = VisitCommunityLot.Singleton;
                        }
                        else
                        {
                            if (sim.IsGreetedOnLot(lot))
                            {
                                definition = GoToLot.Singleton;
                            }
                            else
                            {
                                definition = VisitLot.Singleton;
                            }
                        }

                        InteractionInstance instance = definition.CreateInstance(lot, sim, new InteractionPriority(InteractionPriorityLevel.Autonomous), true, true);
                        sim.InteractionQueue.Add(instance);

                        return;
                    }
                }
            }
        }
Beispiel #28
0
        protected bool Infect(SimDescription sim, SimDescription source, VectorControl.Virulence type, Event e, bool force)
        {
            DiseaseVector existing = Vector.Settings.GetVector(sim, Guid);

            if (!force)
            {
                if (!IsContagious)
                {
                    ScoringLog.sLog.IncStat(UnlocalizedName + " " + type + ": Not Contagious");
                    return(false);
                }

                float chance = GetInfectionRate(type);
                if (chance == 0)
                {
                    ScoringLog.sLog.IncStat(UnlocalizedName + " " + type + ": Not Infectious");
                    return(false);
                }
                else
                {
                    if (type == VectorControl.Virulence.Woohoo)
                    {
                        if ((!IsProtected) && (!SimTypes.IsSelectable(sim)))
                        {
                            int rating = Vector.Settings.mHighProtectionRating;
                            int cost   = Data.HighProtectionCost;
                            if ((cost == 0) || (sim.FamilyFunds < cost))
                            {
                                rating = Vector.Settings.mLowProtectionRating;
                                cost   = Data.LowProtectionCost;
                            }

                            if (cost <= sim.FamilyFunds)
                            {
                                if (ScoringLookup.GetScore("NRaasVectorPurchaseProtection", sim, source) > 0)
                                {
                                    sim.ModifyFunds(-cost);

                                    SetProtection(rating, Vector.Settings.mProtectionDuration);

                                    chance = GetInfectionRate(type);

                                    ScoringLog.sLog.IncStat(UnlocalizedName + " " + type + ": Protection Purchased");

                                    if (Common.kDebugging)
                                    {
                                        Common.DebugNotify(UnlocalizedName + Common.NewLine + sim.FullName + Common.NewLine + "Protection Bought");
                                    }
                                }
                            }
                        }

                        if (sWoohooerIsRiskyOrTryForBaby.Valid)
                        {
                            if (!sWoohooerIsRiskyOrTryForBaby.Invoke <bool>(new object[] { e }))
                            {
                                chance /= 10;
                            }
                        }
                    }

                    ScoringLog.sLog.AddStat(UnlocalizedName + " " + type + ": Infection Rate", chance);

                    if (!RandomUtil.RandomChance01(chance))
                    {
                        ScoringLog.sLog.IncStat(UnlocalizedName + " " + type + ": Infection Failure");
                        return(false);
                    }

                    switch (type)
                    {
                    case VectorControl.Virulence.Outdoors:
                    case VectorControl.Virulence.Room:
                        break;

                    default:
                        AlterRelationship(sim, source, ((existing != null) && (existing.HadFirstSign)));
                        break;
                    }
                }
            }

            if (!mNonPersistableData.CanInfect(sim, source))
            {
                ScoringLog.sLog.IncStat(UnlocalizedName + " " + type + ": Infection Denied");
                return(false);
            }

            if (existing != null)
            {
                return(existing.Reconcile(type, mStrain, (source != null) ? source.SimDescriptionId : 0));
            }
            else
            {
                mStrain = Vector.Settings.GetNewStrain(Data, mStrain);

                if (source != null)
                {
                    mInfector = source.SimDescriptionId;
                }

                Vector.Settings.AddVector(sim, Clone(sim));

                ScoringLog.sLog.IncStat(UnlocalizedName + " " + type + ": New Infection");
                return(true);
            }
        }
Beispiel #29
0
 public int AddScoring(string scoring, SimDescription sim, Common.DebugLevel minLevel)
 {
     return(AddScoring(scoring, ScoringLookup.GetScore(scoring, sim)));
 }
Beispiel #30
0
 public int AddScoring(string scoring, int option, ScoringLookup.OptionType type, SimDescription scoreAgainst, Common.DebugLevel minLevel)
 {
     return(AddScoring(scoring, ScoringLookup.GetScore(scoring, option, type, scoreAgainst), minLevel));
 }