Exemplo n.º 1
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (Target == mLoser)
            {
                ManagerSim.AddBuff(Manager, Target, BuffNames.Sore, Origin.FromLosingFight);
            }
            else
            {
                if (Target == Sim)
                {
                    ManagerSim.AddBuff(Target, BuffNames.Winner, Origin.FromWinningFight);
                }
                else
                {
                    base.PrivateUpdate(frame);
                }

                if (ManagerSim.HasTrait(Target, TraitNames.Evil))
                {
                    ManagerSim.AddBuff(Target, BuffNames.FiendishlyDelighted, Origin);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        protected override bool CommonAllow(SimDescription sim)
        {
            if (sim.IsEngaged)
            {
                IncStat("Already Engaged");
                return(false);
            }

            if (mTestScoring)
            {
                Relationship relation = ManagerSim.GetRelationship(Sim, Target);
                if (relation == null)
                {
                    return(false);
                }

                if (relation.LTR.Liking < GetValue <CooldownMarriageScenario.LikingGateOption, int>())
                {
                    AddStat("No Like", relation.LTR.Liking);
                    return(false);
                }
                else if (AddScoring("Engagement Cooldown", GetElapsedTime <DayOfLastPartnerOption>(sim) - GetValue <MinTimeFromPartnerToEngagementOption, int>()) < 0)
                {
                    AddStat("Too Early", GetElapsedTime <DayOfLastPartnerOption>(sim));
                    return(false);
                }
            }

            return(base.CommonAllow(sim));
        }
Exemplo n.º 3
0
        protected override bool TargetAllow(SimDescription target)
        {
            if (target.ChildOrBelow)
            {
                IncStat("Too Young");
                return(false);
            }
            else if ((target.Teen) && (!Sim.Teen))
            {
                IncStat("Too Young");
                return(false);
            }
            else if (Sim.Gender != target.Gender)
            {
                IncStat("Wrong Gender");
                return(false);
            }
            else if (ManagerSim.GetLTR(Sim, target) < 50)
            {
                IncStat("Low LTR");
                return(false);
            }

            return(base.TargetAllow(target));
        }
Exemplo n.º 4
0
        protected override bool TargetAllow(SimDescription sim)
        {
            if (Sim.Household == sim.Household)
            {
                IncStat("Same House");
                return(false);
            }
            else if (!Situations.Allow(this, sim))
            {
                IncStat("Situations Denied");
                return(false);
            }

            Relationship relation = ManagerSim.GetRelationship(Sim, sim);

            if (relation == null)
            {
                IncStat("Bad Relation");
                return(false);
            }

            if ((!relation.LTR.HasInteractionBit(LongTermRelationship.InteractionBits.BreakUp)) &&
                (!relation.LTR.HasInteractionBit(LongTermRelationship.InteractionBits.Divorce)))
            {
                IncStat("Not Breakup");
                return(false);
            }

            return(base.TargetAllow(sim));
        }
Exemplo n.º 5
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            ManagerSim.ForceRecount();
            return(true);
        }
Exemplo n.º 6
0
        protected override bool TargetAllow(SimDescription sim)
        {
            if (sim.ChildOrBelow)
            {
                IncStat("Too Young");
                return(false);
            }
            else if ((sim.Teen) && (!Sim.Teen))
            {
                IncStat("Too Young");
                return(false);
            }
            else if (Sim.Gender != Target.Gender)
            {
                IncStat("Wrong Gender");
                return(false);
            }
            else if (Sim.Partner == Target)
            {
                IncStat("Partner");
                return(false);
            }
            else if ((ManagerSim.GetLTR(Sim, Target) < 50) &&
                     (ManagerSim.GetLTR(Sim.Partner, Target) < 50))
            {
                IncStat("Low LTR");
                return(false);
            }

            return(base.TargetAllow(sim));
        }
Exemplo n.º 7
0
            protected override bool Push()
            {
                SimDescription injured = Target;
                SimDescription killer  = Sim;

                if (mFail)
                {
                    killer = null;

                    if (mParentScenario.AllowGoToJail)
                    {
                        Manager.AddAlarm(new GoToJailScenario(Sim, Bail));

                        injured = null;
                    }
                    else
                    {
                        injured = Sim;
                    }
                }

                if ((mParentScenario.AllowInjury) && (injured != null) && (injured.CreatedSim != null) && (injured.CreatedSim.LotCurrent == mVictim.LotCurrent))
                {
                    if (!ManagerSim.HasTrait(injured, TraitNames.ImmuneToFire))
                    {
                        ManagerSim.AddBuff(Manager, injured, BuffNames.Singed, Origin.FromFire);

                        Manager.AddAlarm(new GoToHospitalScenario(injured, killer, "InjuredArson", SimDescription.DeathType.Burn));
                    }
                }

                return(true);
            }
Exemplo n.º 8
0
        public bool MoveSim(SimDescription sim, Household moveTo)
        {
            if (sim.Household == moveTo)
            {
                return(true);
            }

            if (sim.Household != null)
            {
                if (sim.CreatedSim != null)
                {
                    try
                    {
                        if ((sim.CreatedSim.Autonomy != null) && (sim.CreatedSim.Autonomy.Motives == null))
                        {
                            sim.CreatedSim.Autonomy.RecreateAllMotives();

                            IncStat("Motives Recreated");
                        }

                        if (sim.CreatedSim.LotCurrent == null)
                        {
                            sim.CreatedSim.InternalOnSetLotCurrent(null);
                        }
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(sim, e);

                        Sims.Reset(sim);
                    }
                }

                Household oldHouse = sim.Household;

                ProcessAbandonHouse(oldHouse, moveTo);

                sim.Household.Remove(sim);

                foreach (SimDescription member in HouseholdsEx.All(oldHouse))
                {
                    GetData(member).InvalidateCache();
                }
            }

            moveTo.Add(sim);

            foreach (SimDescription member in HouseholdsEx.All(moveTo))
            {
                GetData(member).InvalidateCache();
            }

            ManagerSim.ForceRecount();

            SetValue <InspectedOption, bool>(moveTo, false);

            Sims.Instantiate(sim, moveTo.LotHome, true);

            return(sim.Household == moveTo);
        }
Exemplo n.º 9
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            bool singedOutfit = false;

            try
            {
                if (Sim.CreatedSim.CurrentOutfitCategory == OutfitCategories.Singed)
                {
                    singedOutfit = true;
                }
            }
            catch (Exception e)
            {
                Common.DebugException(Sim, e);

                IncStat("Exception");
            }

            if (Sim.CreatedSim != null)
            {
                Sim.CreatedSim.BuffManager.RemoveElement(BuffNames.Singed);
                Sim.CreatedSim.BuffManager.RemoveElement(BuffNames.SingedElectricity);
            }

            if (singedOutfit)
            {
                ManagerSim.ChangeOutfit(Manager, Sim, OutfitCategories.Everyday);

                ManagerCareer.PerformStylistHelp(this, frame);
            }
            return(true);
        }
Exemplo n.º 10
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            int bail = 0;

            ManagerSim.AddBuff(this, Sim, BuffNames.Nauseous, Origin.FromJailFood);

            Pair <string, int> value;

            if (sRepository.TryGetValue(Sim.SimDescriptionId, out value))
            {
                mStoryName = value.First;
                bail       = value.Second;

                sRepository.Remove(Sim.SimDescriptionId);
            }

            if (Sim.Occupation != null)
            {
                if (AddScoring("JailDemotion", GetValue <DemoteChanceOption, int>(), ScoringLookup.OptionType.Chance, Sim) > 0)
                {
                    Sim.Occupation.DemoteSim();
                }
            }

            bail += GetValue <BailOption, int>();
            if (bail > 0)
            {
                Money.AdjustFunds(Sim, "CourtFees", -bail);
            }

            return(true);
        }
Exemplo n.º 11
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));
        }
Exemplo n.º 12
0
        protected override bool TargetAllow(SimDescription target)
        {
            if ((!IsFriendly) && (Sim.ToddlerOrBelow))
            {
                IncStat("Too Young");
                return(false);
            }
            else if ((IsRomantic) && (Sim.TeenOrAbove != target.TeenOrAbove))
            {
                IncStat("Wrong Age");
                return(false);
            }
            else if ((IsFriendly) && (TestRelationship) && (ManagerSim.GetLTR(Sim, Target) >= 100))
            {
                IncStat("Max Liking");
                return(false);
            }
            else if (Delta < 0)
            {
                if (target.ToddlerOrBelow)
                {
                    IncStat("Too Young");
                    return(false);
                }
                else if ((TestRelationship) && (ManagerSim.GetLTR(Sim, Target) <= -100))
                {
                    IncStat("Min Liking");
                    return(false);
                }
                else if (!Friends.AllowEnemy(this, Sim, Target, Managers.Manager.AllowCheck.None))
                {
                    return(false);
                }
                else if ((!GetValue <AllowEnemyFamilyOption, bool>()) &&
                         ((Sim.Partner == Target) || (Relationships.IsCloselyRelated(Sim, Target, false))))
                {
                    IncStat("Closely Related Denied");
                    return(false);
                }
            }
            else if (Delta > 0)
            {
                if ((TestRelationship) && (target.CreatedSim != null) && (SnubManager.IsSnubbing(target.CreatedSim, target)))
                {
                    IncStat("Snubbing");
                    return(false);
                }
                else if (!Friends.AllowFriend(this, Sim, Target, Managers.Manager.AllowCheck.None))
                {
                    return(false);
                }
                else if ((IsRomantic) && (!Flirts.Allow(this, Sim, Target)))
                {
                    return(false);
                }
            }

            return(base.TargetAllow(target));
        }
Exemplo n.º 13
0
        protected override ICollection <SimDescription> GetSims()
        {
            List <SimDescription> sims = new List <SimDescription>(Careers.Employed);

            ManagerSim.Union(sims, Careers.SchoolChildren);

            return(sims);
        }
Exemplo n.º 14
0
        protected override void PrivatePerform(SimDescription sim, SimData data, ScenarioFrame frame)
        {
            PregnancySimData other = data.Get <PregnancySimData>();

            if (sim.IsPregnant)
            {
                if ((other.mLastCheckPregnancy != 0) && (other.mLastCheckPregnancy < SimClock.ElapsedCalendarDays()))
                {
                    if (!AllowProgression(sim))
                    {
                        // Delay pregnancy indefinitely
                        sim.Pregnancy.mHourOfPregnancy = other.mPregnancyHour;

                        IncStat("Pregnancy Suspended");
                    }
                    else
                    {
                        if (other.mPregnancyHour == sim.Pregnancy.mHourOfPregnancy)
                        {
                            IncStat(sim.FirstName + " " + sim.LastName + ": Stuck Pregnancy", Common.DebugLevel.High);

                            if (!SimTypes.IsSelectable(sim))
                            {
                                Sims.Reset(sim);

                                if ((sim.CreatedSim != null) && (sim.LotHome != null))
                                {
                                    SimDescription dad = ManagerSim.Find(sim.Pregnancy.DadDescriptionId);
                                    if (dad != null)
                                    {
                                        Sims.Instantiate(dad, sim.LotHome, false);
                                    }

                                    if (sim.Pregnancy.PreggersAlarm != AlarmHandle.kInvalidHandle)
                                    {
                                        AlarmManager.Global.RemoveAlarm(sim.Pregnancy.PreggersAlarm);
                                        sim.Pregnancy.PreggersAlarm = AlarmHandle.kInvalidHandle;
                                    }
                                    sim.Pregnancy.Continue(sim.CreatedSim, true);

                                    IncStat("Pregnancy Reset");
                                }
                            }
                        }
                    }
                }

                other.mPregnancyHour      = sim.Pregnancy.mHourOfPregnancy;
                other.mLastCheckPregnancy = SimClock.ElapsedCalendarDays();
            }
            else
            {
                other.mPregnancyHour      = 0;
                other.mLastCheckPregnancy = 0;
            }
        }
Exemplo n.º 15
0
        protected override bool TargetAllow(SimDescription sim)
        {
            if (ManagerSim.GetLTR(Sim, Target) <= 0)
            {
                IncStat("Min Liking");
                return(false);
            }

            return(base.TargetAllow(sim));
        }
Exemplo n.º 16
0
        protected override bool TargetAllow(SimDescription sim)
        {
            if ((!Relationships.IsCloselyRelated(mDeadSim, Target, false)) || (ManagerSim.GetLTR(mDeadSim, Target) < 50))
            {
                IncStat("Low LTR");
                return(false);
            }

            return(base.TargetAllow(sim));
        }
Exemplo n.º 17
0
        protected override bool TargetAllow(SimDescription sim)
        {
            if (ManagerSim.GetLTR(Sim, Target) > Sims3.Gameplay.Actors.Sim.kRomanceUseLikingGate)
            {
                IncStat("Too High");
                return(false);
            }

            return(base.TargetAllow(sim));
        }
Exemplo n.º 18
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if ((Origin == Origin.FromFire) && (ManagerSim.HasTrait(Target, TraitNames.Pyromaniac)))
            {
                ManagerSim.AddBuff(Target, BuffNames.Fascinated, Origin);
            }

            if ((Origin == Origin.FromTheft) && (ManagerSim.HasTrait(Target, TraitNames.Kleptomaniac)))
            {
                ManagerSim.AddBuff(Target, BuffNames.Fascinated, Origin);
            }

            if (ManagerSim.HasTrait(Target, TraitNames.Coward))
            {
                ManagerSim.AddBuff(Target, BuffNames.Scared, Origin);
            }

            if ((ManagerSim.HasTrait(Target, TraitNames.Evil)) ||
                (ManagerSim.HasTrait(Target, TraitNames.MeanSpirited)))
            {
                ManagerSim.AddBuff(Target, BuffNames.FiendishlyDelighted, Origin);
            }
            else
            {
                // Not performed for the main Sim on purpose
                if (Target != Sim)
                {
                    base.PrivateUpdate(frame);

                    bool fail = false;

                    Relationship relation = Relationship.Get(mEnemy, Target, false);
                    if (relation != null)
                    {
                        if (relation.LTR.Liking >= mRelationshipGate)
                        {
                            fail = true;
                        }
                    }

                    if (!fail)
                    {
                        int report = 0;
                        if (mEnemy.Partner == Target)
                        {
                            report = ReportChance;
                        }

                        Add(frame, new ExistingEnemyManualScenario(mEnemy, Target, mDelta, report, GetTitlePrefix(PrefixType.Story)), ScenarioResult.Start);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 19
0
        public static bool AreEnemies(SimDescription a, SimDescription b, int maximum)
        {
            Relationship relation = ManagerSim.GetRelationship(a, b);

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

            return(relation.LTR.Liking < maximum);
        }
Exemplo n.º 20
0
        public static bool AreRomantic(SimDescription a, SimDescription b)
        {
            Relationship relation = ManagerSim.GetRelationship(a, b);

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

            return(relation.AreRomantic());
        }
Exemplo n.º 21
0
        public override string GetUIValue(bool pure)
        {
            SimDescription sim = ManagerSim.Find(Value);

            if (sim == null)
            {
                return(null);
            }

            return(sim.FirstName);
        }
Exemplo n.º 22
0
        public string HandleName <T>(ManagerSim manager, SimDescription b, out bool wasEither)
            where T : NameBaseOption, new()
        {
            T option = GetInternalOption <T>();

            if (option == null)
            {
                option = new T();
            }

            return(manager.HandleName(option, SimDescription, b, out wasEither));
        }
Exemplo n.º 23
0
        protected override bool TargetAllow(SimDescription sim)
        {
            Relationship relation = ManagerSim.GetRelationship(sim, Sim);

            if (relation == null)
            {
                IncStat("No Relation");
                return(false);
            }

            return(base.TargetAllow(sim));
        }
Exemplo n.º 24
0
        protected SimDescription FindNextOpponent(SimDescription sim)
        {
            MartialArts mySkill = sim.SkillManager.GetElement(SkillNames.MartialArts) as MartialArts;

            if (mySkill == null)
            {
                IncStat("No Skill");
                return(null);
            }

            SimDescription tournamentChallenger = ManagerSim.Find(mySkill.mTournamentChallenger);

            if ((tournamentChallenger == null) ||
                (SimTypes.IsDead(tournamentChallenger)) ||
                (tournamentChallenger.CreatedSim == null) ||
                (tournamentChallenger.CreatedSim.WorldBuilderDeath != null) ||
                (!tournamentChallenger.IsValidDescription) ||
                (SimTypes.IsSelectable(tournamentChallenger)))
            {
                List <Household> households = new List <Household>(Household.sHouseholdList);
                households.Remove(Household.ActiveHousehold);

                tournamentChallenger = TournamentManagement.FindSuitableOpponent(sim, households, tournamentChallenger, new TournamentManagement.GetAffinity(mySkill.GetAffinity));
            }

            if (tournamentChallenger == null)
            {
                IncStat("No Choice");
                return(null);
            }

            mySkill.mTournamentChallenger = tournamentChallenger.SimDescriptionId;

            if (!TestNextOpponent(this, mySkill))
            {
                return(null);
            }

            if (tournamentChallenger.SkillManager == null)
            {
                return(null);
            }

            MartialArts theirSkill = tournamentChallenger.SkillManager.GetElement(SkillNames.MartialArts) as MartialArts;

            if ((theirSkill != null) && (!TestNextOpponent(this, theirSkill)))
            {
                return(null);
            }

            return(tournamentChallenger);
        }
Exemplo n.º 25
0
                public ObjectGuid GetGuid()
                {
                    if (mSimID != 0)
                    {
                        SimDescription sim = ManagerSim.Find(mSimID);
                        if ((sim != null) && (sim.CreatedSim != null))
                        {
                            return(sim.CreatedSim.ObjectId);
                        }
                    }

                    return(mGuid);
                }
Exemplo n.º 26
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (base.PrivateUpdate(frame))
            {
                List <ISimDescription> sims = new List <ISimDescription>();

                Household house = null;

                foreach (SimDescription sim in Movers)
                {
                    house = sim.Household;

                    sims.Add(sim);
                }

                if (house != null)
                {
                    Vector2 fundsRange = GetValue <CashRangeOption, Vector2>();

                    int funds = (int)RandomUtil.GetFloat(fundsRange.x, fundsRange.y);
                    if (funds == 0)
                    {
                        if (house.FamilyFunds <= 0)
                        {
                            house.ModifyFamilyFunds(CASLogic.GetHouseholdStartingFunds(sims));
                        }
                    }
                    else
                    {
                        house.SetFamilyFunds(funds, false);
                    }

                    Options.StampImmigrantHousehold(house);
                }

                if (OnAfterMoveIn != null)
                {
                    OnAfterMoveIn(this, frame);
                }

                ManagerSim.ForceRecount();
                return(true);
            }

            foreach (SimDescription sim in Movers)
            {
                sim.Dispose();
            }

            return(false);
        }
Exemplo n.º 27
0
        public bool EliminateHousehold(string storyName, Household me)
        {
            if (SimTypes.IsService(me))
            {
                return(false);
            }

            if (!GameStates.IsLiveState)
            {
                IncStat("Mode Save");
                return(false);
            }

            if (AlarmManager.Global == null)
            {
                IncStat("No Alarm Manager");
                return(false);
            }

            if (Deaths == null)
            {
                IncStat("No Death Manager");
                return(false);
            }

            foreach (SimDescription sim in new List <SimDescription>(me.AllSimDescriptions))
            {
                Deaths.CleansingKill(sim, false);
            }

            me.Destroy();

            try
            {
                me.Dispose();
            }
            catch (Exception e)
            {
                Common.DebugException(me.Name, e);

                Household.sHouseholdList.Remove(me);
            }

            AddSuccess("Household Eliminated");

            IncStat("Household Eliminated: " + me.Name + Common.NewLine + "Story: " + storyName, Common.DebugLevel.High);

            ManagerSim.ForceRecount();
            return(true);
        }
Exemplo n.º 28
0
        protected override string GetLocalizedValue(ulong value, ref bool matches, ref ThumbnailKey icon)
        {
            matches = (Value == value);

            SimDescription sim = ManagerSim.Find(value);

            if (sim == null)
            {
                return(null);
            }

            icon = sim.GetThumbnailKey(ThumbnailSize.Large, 0);

            return(sim.LastName + ", " + sim.FirstName);
        }
Exemplo n.º 29
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (AddScoring("CaresAboutChildren", GetValue <AlimonyChanceOption, int>(Target), ScoringLookup.OptionType.Chance, Target) <= 0)
            {
                ManagerSim.AddBuff(Target, BuffNames.Amused, Origin);
                return(true);
            }

            if (ManagerSim.HasTrait(Target, TraitNames.Kleptomaniac))
            {
                ManagerSim.AddBuff(Target, BuffNames.Fascinated, Origin);
            }

            return(base.PrivateUpdate(frame));
        }
Exemplo n.º 30
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            bool formalOutfit = false;

            try
            {
                if (Sim.CreatedSim.CurrentOutfitCategory == OutfitCategories.Formalwear)
                {
                    formalOutfit = true;
                }
            }
            catch (Exception e)
            {
                Common.DebugException(Sim, e);

                IncStat("Exception");
                return(false);
            }

            if (formalOutfit)
            {
                if (Party.IsInvolvedInAnyTypeOfParty(Sim.CreatedSim))
                {
                    IncStat("Party");
                    return(false);
                }
                else if (Sim.CreatedSim.CurrentInteraction is ICountsAsWorking)
                {
                    IncStat("Working");
                    return(false);
                }
                else if (PromSituation.IsHeadedToProm(Sim.CreatedSim))
                {
                    IncStat("Heading To Prom");
                    return(false);
                }
                else if (ManagerSituation.HasInteraction(Sim, PromSituation.GoToProm.Singleton))
                {
                    IncStat("At Prom");
                    return(false);
                }

                ManagerSim.ChangeOutfit(Manager, Sim, OutfitCategories.Everyday);

                ManagerCareer.PerformStylistHelp(this, frame);
            }
            return(true);
        }