示例#1
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Money.AdjustFunds(House, "PayDebt", -House.FamilyFunds);

            SetValue<DebtOption,int>(House, 0);
            return true;
        }
示例#2
0
 public void Perform(IEnumerable<SimDescription> sims, ScenarioFrame frame)
 {
     foreach (SimDescription sim in sims)
     {
         Perform(GetData(sim), frame);
     }
 }
 protected override bool PrivateUpdate(ScenarioFrame frame)
 {
     Add(frame, new EngagementScenario(Sim, Target, TestScoring), ScenarioResult.Failure);
     Add(frame, new CooldownMarriageScenario(Sim, Target, TestScoring), ScenarioResult.Failure);
     Add(frame, new StrandedCoupleScenario(Sim, Target, true), ScenarioResult.Start);
     return false;
 }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame)) return false;

            PushAndPrint();
            return false;
        }
示例#5
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame)) return false;

            Skills.HandleMoochSkill(Sim, SkillIncrease);
            return true;
        }
示例#6
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame)) return false;

            mNewHome.House = House;
            return true;
        }
示例#7
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            GetData<ManagerDeath.DyingSimData>(Sim).Saved = true;

            AgingManager.Singleton.CancelAgingAlarmsForSim(Sim.AgingState);
            return true;
        }
示例#8
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            if (mPush)
            {
                Sim createdSim = Job.OwnerDescription.CreatedSim;
                if (createdSim != null)
                {
                    if ((SimTypes.IsSelectable(Job.OwnerDescription)) || (!NpcParty.IsHostAtNpcParty(createdSim)))
                    {
                        foreach(InteractionInstance instance in createdSim.InteractionQueue.InteractionList)
                        {
                            if (instance is ICountsAsWorking)
                            {
                                IncStat("Already Queued");
                                return false;
                            }
                        }

                        VisitSituation.AnnounceTimeToGoToWork(createdSim);
                        createdSim.InteractionQueue.Add(CareerPushScenario.GetWorkInteraction(Job));
                    }
                }

                if (GetValue<AllowGoHomePushOption, bool>(Sim))
                {
                    Manager.AddAlarm(new GoHomePushScenario(Sim));
                }
            }
            return true;
        }
示例#9
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            HouseholdBreakdown breakdown = new HouseholdBreakdown(Manager, this, UnlocalizedName, Sim, ChildMove, false);

            if (!breakdown.SimGoing)
            {
                IncStat("Staying");
                return false;
            }
            else if ((breakdown.NoneStaying) && (Sim.LotHome != null))
            {
                IncStat("None Staying");
                return false;
            }
            else if (breakdown.NoneGoing)
            {
                IncStat("None Going");
                return false;
            }
            else if ((mStay != null) && (breakdown.Going.Contains(mStay)))
            {
                IncStat("Both Going");
                return false;
            }

            if (Households.AllowSoloMove (Sim))
            {
                Add(frame, GetMoveInLotScenario(breakdown.Going), ScenarioResult.Failure);
            }

            Add(frame, GetMoveInScenario(breakdown.Going), ScenarioResult.Failure);
            return false;
        }
        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;
        }
示例#11
0
 protected override bool PrivateUpdate(ScenarioFrame frame)
 {
     if (OnCarpoolUpdateScenario != null)
     {
         OnCarpoolUpdateScenario(this, frame);
     }
     return true;
 }
示例#12
0
 protected override bool PrivateUpdate(ScenarioFrame frame)
 {
     if (SimID.Matches(Flirts.PreviousLoveLoss, Sim))
     {
         Flirts.PreviousLoveLoss = null;
     }
     return true;
 }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame)) return false;

            Add(frame, new MarriageMoveScenario(Sim, Target), ScenarioResult.Start);
            Add(frame, new NoHoneymoonScenario(Sim, Target), ScenarioResult.Failure);
            return true;
        }
示例#14
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame)) return false;

            Drink(Sim.CreatedSim, Target.CreatedSim);

            return true;
        }
示例#15
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Firefighter instance = Firefighter.Instance;
            if (instance == null)
            {
                IncStat("No Service");
                return false;
            }

            List<SimDescription> sims = new List<SimDescription>();
            foreach (SimDescription sim in Sims.All)
            {
                if (SimTypes.IsSelectable(sim))
                {
                    IncStat("Active");
                }
                else if (sim.CreatedSim == null)
                {
                    IncStat("Hibernating");
                }
                else if (sim.LotHome == null)
                {
                    IncStat("Not Resident");
                }
                else if (!(sim.Occupation is ActiveFireFighter))
                {
                    IncStat("Not Firefighter");
                }
                else if (!Situations.Allow(this, sim, Managers.Manager.AllowCheck.None))
                {
                    IncStat("Situation Denied");
                }
                else
                {
                    sims.Add(sim);
                }
            }

            if (sims.Count > 0)
            {
                AddStat("Choices", sims.Count);

                SimDescription choice = RandomUtil.GetRandomObjectFromList(sims);

                if (Situations.GreetSimOnLot(choice, Lot))
                {
                    IncStat("Active Firefighter");

                    new NRaas.StoryProgressionSpace.Situations.FirefighterSituation(Lot, choice.CreatedSim);
                    return true;
                }
            }

            IncStat("Service Firefighter");

            instance.MakeServiceRequest(Lot, true, ObjectGuid.InvalidObjectGuid);
            return true;
        }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (mProcessed.ContainsKey(Sim.SimDescriptionId))
            {
                mProcessed.Add(Sim.SimDescriptionId, true);
            }

            return false;
        }
示例#17
0
        public void ShowConfig()
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // When the navigation stack isn't restored navigate to the first page,
            // configuring the new page by passing required information as a navigation
            // parameter
            ScenarioFrame.Navigate(typeof(ConfigPage));
        }
示例#18
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Household house = GetData <StoredNetWorthSimData>(Sim).Household;

            int iTotalWorth = GetData <StoredNetWorthSimData>(Sim).NetWorth;

            iTotalWorth -= GetValue <DebtOption, int>(house);

            SetValue <DebtOption, int>(house, 0);

            if (iTotalWorth <= 0)
            {
                IncStat("Inherit Cash: Poor");
                return(false);
            }

            Dictionary <SimDescription, float> inheritors = Deaths.GetInheritors(Sim, GetValue <InheritorsOption, ManagerDeath.Inheritors>(), true);

            float fTotal = 0f;

            foreach (KeyValuePair <SimDescription, float> fraction in inheritors)
            {
                fTotal += fraction.Value;
            }

            AddStat("Worth", iTotalWorth);
            AddStat("Inheritors", inheritors.Count);
            AddStat("Split", fTotal);

            bool simMatches = (Deaths.MatchesAlertLevel(Sim)) || (Money.MatchesAlertLevel(Sim));

            foreach (KeyValuePair <SimDescription, float> inheritor in inheritors)
            {
                int iInheritance = (int)(iTotalWorth * (inheritor.Value / fTotal));

                if (iInheritance <= 0)
                {
                    continue;
                }

                SimDescription child = inheritor.Key;
                if (child.Household == null)
                {
                    continue;
                }

                Money.AdjustFunds(child, "Inheritance", iInheritance);

                if ((simMatches) || (Deaths.MatchesAlertLevel(child)) || (Money.MatchesAlertLevel(child)))
                {
                    mInheritance.Add(child, iInheritance);
                }
            }

            return(mInheritance.Count > 0);
        }
示例#19
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Sim sim = Sim.CreatedSim;

            if (sim == null)
            {
                Sims.Instantiate(Sim, null, false);

                sim = Sim.CreatedSim;
            }

            if (sim == null)
            {
                IncStat("Hibernating");
                return(false);
            }

            Career job = Occupation as Career;

            Careers.VerifyTone(job);

            if (!ManagerCareer.ValidCareer(job))
            {
                IncStat("Career Invalidated");
                return(false);
            }

            InteractionInstance instance = GetWorkInteraction(job);

            if (instance == null)
            {
                IncStat("No Interaction");
                return(false);
            }
            else if (!Test(sim, instance.InteractionDefinition))
            {
                return(false);
            }
            else
            {
                if (sim.InteractionQueue.Add(instance))
                {
                    if (GetValue <AllowGoHomePushOption, bool>(Sim))
                    {
                        Manager.AddAlarm(new GoHomePushScenario(Sim));
                    }
                }
                else
                {
                    IncStat("Failure");
                }

                mReport = PostSlackerWarning();
                return(true);
            }
        }
示例#20
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Add(frame, new ImmigrantCareerScenario(Sim, mRequirement), ScenarioResult.Start);

            if ((mRequirement.mFertile) && (Sim.TeenOrAbove) && (RandomUtil.RandomChance(25)))
            {
                Trait trait = TraitManager.GetTraitFromDictionary(TraitNames.FamilyOriented);
                if (trait != null)
                {
                    Sim.RemoveTrait(TraitManager.GetTraitFromDictionary(TraitNames.DislikesChildren));

                    List <Trait> traits = new List <Trait>(Sim.TraitManager.List);
                    if ((traits.Count > 0) && (traits.Count >= Sim.TraitManager.NumTraitsForAge()))
                    {
                        Sim.RemoveTrait(RandomUtil.GetRandomObjectFromList(traits));
                    }

                    Sim.AddTrait(trait);
                }
            }

            if ((mRequirement.mSingle) && (Sim.TeenOrAbove) && (RandomUtil.RandomChance(25)))
            {
                Trait trait = TraitManager.GetTraitFromDictionary(TraitNames.Flirty);
                if (trait != null)
                {
                    Sim.RemoveTrait(TraitManager.GetTraitFromDictionary(TraitNames.Unflirty));

                    List <Trait> traits = new List <Trait>(Sim.TraitManager.List);
                    if ((traits.Count > 0) && (traits.Count >= Sim.TraitManager.NumTraitsForAge()))
                    {
                        Sim.RemoveTrait(RandomUtil.GetRandomObjectFromList(traits));
                    }

                    Sim.AddTrait(trait);
                }
            }

            foreach (SimDescription other in mImmigrants)
            {
                if (Sim == other)
                {
                    continue;
                }

                Relationship relation = Relationship.Get(Sim, other, true);
                if (relation == null)
                {
                    continue;
                }

                relation.LTR.SetLiking(RandomUtil.GetFloat(25, 100));
            }

            return(true);
        }
示例#21
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (mRepairs.Count == 0)
            {
                return(false);
            }

            List <GameObject> repair = new List <GameObject>();

            if (mRepairs.ContainsKey(Sim.Household))
            {
                repair.AddRange(mRepairs[Sim.Household]);
                mRepairs.Remove(Sim.Household);

                mHouse = Sim.Household;
            }

            if (repair.Count == 0)
            {
                List <Household> houses = new List <Household>(mRepairs.Keys);

                while (houses.Count > 0)
                {
                    mHouse = RandomUtil.GetRandomObjectFromList(houses);
                    houses.Remove(mHouse);

                    if (AllowHouse(mHouse))
                    {
                        repair.AddRange(mRepairs[mHouse]);
                        mRepairs.Remove(mHouse);
                        break;
                    }
                    else
                    {
                        IncStat("House Denied");
                    }
                }

                mTownRepair = true;

                if (repair.Count > 0)
                {
                    IncStat("Around Town");
                }
                else
                {
                    IncStat("No Choice");
                }
            }
            else
            {
                IncStat("Home Work");
            }

            return(PushInteractions(Manager, Sim, repair));
        }
示例#22
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            bool pushed = false;

            Gardening gardeningSkill = Sim.SkillManager.GetSkill<Gardening>(SkillNames.Gardening);

            List<HarvestPlant> plants = GatherPlants();
            if ((plants == null) || (plants.Count == 0))
            {
                IncStat("No Plants");
                return false;
            }

            int index = 0;
            while (index < plants.Count)
            {
                HarvestPlant plant = plants[index];

                if ((plant is Sims3.Gameplay.Objects.Gardening.OmniPlant) || (!Sims3.Gameplay.Objects.Gardening.HarvestPlant.HarvestTest(plant, null)))
                {
                    IncStat("Unharvestable");
                    plants.RemoveAt(index);
                    continue;
                }
                else if (!plant.CanProduceMoreHarvestables())
                {
                    if ((gardeningSkill != null) && (gardeningSkill.SkillLevel <= plant.PlantDef.GetSkillRequirement()))
                    {
                        plant.mLifetimeHarvestablesYielded = 0;

                        IncStat("Replanted");
                    }
                    else
                    {
                        IncStat("Skill Too Low");

                        index++;
                        continue;
                    }
                }

                if (Situations.PushInteraction(this, Sim, plant, HarvestEx.Singleton))
                {
                    plants.RemoveAt(index);

                    pushed = true;
                }
                else
                {
                    IncStat("Failure");
                    break;
                }
            }

            return pushed;
        }
示例#23
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;
            }
        }
示例#24
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            MiniSimDescription miniSim = Sim.GetMiniSimForProtection();

            if (miniSim != null)
            {
                miniSim.AddProtection(MiniSimDescription.ProtectionFlag.PartialFromPlayer);
            }
            return(true);
        }
示例#25
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (Guests.Count < TargetMinimum)
            {
                return(false);
            }

            new FuneralSituation(Lot, mDeadSim, Sim.CreatedSim, Guests, PartyAttire, SimClock.CurrentTime());
            return(true);
        }
示例#26
0
        /// <summary>
        /// The hardware buttons back pressed.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="eventArgs">
        /// The event args.
        /// </param>
        private void HardwareButtonsBackPressed(object sender, BackPressedEventArgs eventArgs)
        {
            if (ScenarioFrame.CanGoBack)
            {
                ScenarioFrame.GoBack();

                // Indicate the back button press is handled so the app does not exit
                eventArgs.Handled = true;
            }
        }
示例#27
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (ManagerCareer.RetiredLocation != null)
            {
                GetData <CareerSimData>(Sim).Retire();
            }

            Add(frame, new CareerChangedScenario(Sim), ScenarioResult.Start);
            return(true);
        }
示例#28
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Add(frame, new UpdateCareerScenario(Sim, true), ScenarioResult.Start);

            if (OnManageCareerScenario != null)
            {
                OnManageCareerScenario(this, frame);
            }
            return false;
        }
示例#29
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (OnBreakup != null)
            {
                OnBreakup(this, frame);
            }
            ;

            return(base.PrivateUpdate(frame));
        }
示例#30
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame))
            {
                return(false);
            }

            mNewHome.House = House;
            return(true);
        }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Add(frame, new ImmigrantNoHomeScenario(), ScenarioResult.Start);

            ManagerLot.ImmigrationRequirement requirement = new ManagerLot.ImmigrationRequirement();

            Add(frame, new ImmigrantPressureScenario(requirement, true), ScenarioResult.Failure);
            Add(frame, new ImmigrateScenario(requirement, true), ScenarioResult.Success);
            return(false);
        }
        private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox  scenarioListBox = sender as ListBox;
            Scenario s = scenarioListBox.SelectedItem as Scenario;

            if (s != null)
            {
                ScenarioFrame.Navigate(s.ClassType);
            }
        }
示例#33
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            SetValue <ArrangedMarriageOption, ulong>(Sim, Target.SimDescriptionId);
            SetValue <ArrangedMarriageOption, ulong>(Target, Sim.SimDescriptionId);

            HandleDowry(Sim, Target);
            HandleDowry(Target, Sim);

            return(base.PrivateUpdate(frame));
        }
        public MainPage()
        {
            InitializeComponent();

            CurrentPage = this;

            ModuleControl.ItemsSource = Modules;

            ScenarioFrame.Navigate(typeof(Connection));
        }
示例#35
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (OnOnlyOneMayLeadScenario != null)
            {
                OnOnlyOneMayLeadScenario(this, frame);
            }

            Add(frame, new CareerChangedScenario(Sim), ScenarioResult.Start);
            return(true);
        }
示例#36
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame))
            {
                return(false);
            }

            Skills.HandleMoochSkill(Sim, SkillIncrease);
            return(true);
        }
示例#37
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if ((mNewHome.House != null) && (HouseholdsEx.NumSims(mNewHome.House) > 0))
            {
                Add(frame, GetMoveInScenario(mNewHome), ScenarioResult.Start);
            }

            Add(frame, GetMoveOutScenario(mNewHome), ScenarioResult.Failure);
            return(false);
        }
示例#38
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame))
            {
                return(false);
            }

            PushAndPrint();
            return(false);
        }
示例#39
0
            protected override bool PrivateUpdate(ScenarioFrame frame)
            {
                if (base.PrivateUpdate(frame))
                {
                    SetValue <ReplacedRoommatesOption, bool>(Sim, true);
                    return(true);
                }

                return(false);
            }
示例#40
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Add(frame, new UpdateCareerScenario(Sim, true), ScenarioResult.Start);

            if (OnManageCareerScenario != null)
            {
                OnManageCareerScenario(this, frame);
            }
            return(false);
        }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame))
            {
                return(false);
            }

            SetValue <CurrentIncreasedChanceOption, int>(0);
            return(true);
        }
示例#42
0
            protected override bool PrivateUpdate(ScenarioFrame frame)
            {
                if (!base.PrivateUpdate(frame))
                {
                    return(false);
                }

                UpdateExperience(Sim, Funds);
                return(true);
            }
示例#43
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (GetValue <SplitOpposingClanOption, bool>())
            {
                mOpposing = !Households.Allow(this, Sim, Target, Managers.Manager.AllowCheck.None);
            }

            Add(frame, new BrokenHomeMoveOutScenario(Sim, Target), ScenarioResult.Start);
            return(false);
        }
示例#44
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            List <AthleticGameObject> objs = new List <AthleticGameObject>();

            InteractionInstance interaction = Target.CreatedSim.InteractionQueue.GetCurrentInteraction();

            if ((interaction != null) && (interaction.Target is AthleticGameObject))
            {
                IncStat("Trainee Ready");

                objs.Add(interaction.Target as AthleticGameObject);
            }
            else
            {
                foreach (Lot lot in ManagerLot.GetOwnedLots(Sim))
                {
                    objs.AddRange(lot.GetObjects <AthleticGameObject>(TestObject));
                }

                if (objs.Count == 0)
                {
                    foreach (Lot lot in ManagerLot.GetOwnedLots(Target))
                    {
                        objs.AddRange(lot.GetObjects <AthleticGameObject>(TestObject));
                    }
                    if (objs.Count == 0)
                    {
                        foreach (AthleticGameObject obj in Sims3.Gameplay.Queries.GetObjects <AthleticGameObject>())
                        {
                            if (!TestObject(obj))
                            {
                                continue;
                            }

                            if (!obj.LotCurrent.IsCommunityLot)
                            {
                                continue;
                            }

                            objs.Add(obj);
                        }

                        if (objs.Count == 0)
                        {
                            IncStat("No Training Object");
                            return(false);
                        }
                    }
                }
            }

            return(Situations.PushMeetUp(this, Sim, Target, RandomUtil.GetRandomObjectFromList(objs).LotCurrent, FirstAction));
        }
示例#45
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Sim sim = Sim.CreatedSim;
            if (sim == null)
            {
                Sims.Instantiate(Sim, null, false);

                sim = Sim.CreatedSim;
            }

            if (sim == null)
            {
                IncStat("Hibernating");
                return false;
            }

            Career job = Occupation as Career;

            Careers.VerifyTone(job);

            if (!ManagerCareer.ValidCareer(job))
            {
                IncStat("Career Invalidated");
                return false;
            }

            InteractionInstance instance = GetWorkInteraction(job);

            if (instance == null)
            {
                IncStat("No Interaction");
                return false;
            }
            else if (!Test(sim, instance.InteractionDefinition))
            {
                return false;
            }
            else
            {
                if (sim.InteractionQueue.Add(instance))
                {
                    if (GetValue<AllowGoHomePushOption, bool>(Sim))
                    {
                        Manager.AddAlarm(new GoHomePushScenario(Sim));
                    }
                }
                else
                {
                    IncStat("Failure");
                }

                mReport = PostSlackerWarning();
                return true;
            }
        }
示例#46
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);
        }
示例#47
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (Event.Career is Retired)
            {
                IncStat("Retired");
                mReport = false;
            }

            Add(frame,new CareerChangedScenario(Sim), ScenarioResult.Start);
            return true;
        }
            public static void OnRun(Scenario scenario, ScenarioFrame frame)
            {
                ImmigrantRequirementScenario s = scenario as ImmigrantRequirementScenario;

                if (s == null)
                {
                    return;
                }

                scenario.Add(frame, new ImmigrantRequirementPostScenario(s.Requirement), ScenarioResult.Start);
            }
示例#49
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            bool result = base.PrivateUpdate(frame);

            if (!mFail)
            {
                DrinkScenario.Drink(Sim.CreatedSim, Target.CreatedSim);
            }

            return result;
        }
示例#50
0
            protected static void OnPerform(Scenario scenario, ScenarioFrame frame)
            {
                SimScenario s = scenario as SimScenario;

                if (s == null)
                {
                    return;
                }

                scenario.Add(frame, new JackOfAllTradesScenario(s.Sim), ScenarioResult.Failure);
            }
示例#51
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (Event.Career is Retired)
            {
                IncStat("Retired");
                mReport = false;
            }

            Add(frame, new CareerChangedScenario(Sim), ScenarioResult.Start);
            return(true);
        }
示例#52
0
 protected override bool PrivateUpdate(ScenarioFrame frame)
 {
     if (ShouldFire)
     {
         Sim.Occupation.LeaveJobNow(Career.LeaveJobReason.kFired);
     }
     else
     {
         Sim.Occupation.DemoteSim();
     }
     return true;
 }
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List<Manager> managers = new List<Manager>();

            string body = null;

            int previousPressure = 0;
            foreach (KeyValuePair<Manager, int> value in Lots.ImmigrationPressure)
            {
                if (value.Value == 0) continue;

                AddStat("Pressure: " + value.Key.UnlocalizedName, value.Value);

                body += Localize("PressureElement", false, new object[] { value.Key.GetLocalizedName(), value.Value });

                managers.Add(value.Key);

                previousPressure += value.Value;
            }

            AddStat("Total", previousPressure);

            Lots.PreviousPressure = previousPressure;

            if (ImmigrationGauge <= 0) return false;

            mStory = Localize("PressureSummary", false, new object[] { body, previousPressure });

            if (previousPressure <= ImmigrationGauge)
            {
                mStory += Localize("PressureInsufficient", false, new object[] { ImmigrationGauge });
                return true;
            }

            if (Sims.HasEnough(this, CASAgeGenderFlags.Human))
            {
                mStory += Localize("PressureMaxResidents");
                return true;
            }

            foreach (Manager manager in managers)
            {
                Add(frame, manager.GetImmigrantRequirement(mRequirement), ScenarioResult.Start);
            }

            mStory = null;

            mRequirement.mRequired = true;
            return false;
        }
示例#54
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Add(frame, new ImmigrantCareerScenario(Sim, mRequirement), ScenarioResult.Start);

            if ((mRequirement.mFertile) && (Sim.TeenOrAbove) && (RandomUtil.RandomChance(25)))
            {
                Trait trait = TraitManager.GetTraitFromDictionary(TraitNames.FamilyOriented);
                if (trait != null)
                {
                    Sim.RemoveTrait(TraitManager.GetTraitFromDictionary(TraitNames.DislikesChildren));

                    List<Trait> traits = new List<Trait>(Sim.TraitManager.List);
                    if ((traits.Count > 0) && (traits.Count >= Sim.TraitManager.NumTraitsForAge()))
                    {
                        Sim.RemoveTrait(RandomUtil.GetRandomObjectFromList(traits));
                    }

                    Sim.AddTrait(trait);
                }
            }

            if ((mRequirement.mSingle) && (Sim.TeenOrAbove) && (RandomUtil.RandomChance(25)))
            {
                Trait trait = TraitManager.GetTraitFromDictionary(TraitNames.Flirty);
                if (trait != null)
                {
                    Sim.RemoveTrait(TraitManager.GetTraitFromDictionary(TraitNames.Unflirty));

                    List<Trait> traits = new List<Trait>(Sim.TraitManager.List);
                    if ((traits.Count > 0) && (traits.Count >= Sim.TraitManager.NumTraitsForAge()))
                    {
                        Sim.RemoveTrait(RandomUtil.GetRandomObjectFromList(traits));
                    }

                    Sim.AddTrait(trait);
                }
            }

            foreach (SimDescription other in mImmigrants)
            {
                if (Sim == other) continue;

                Relationship relation = Relationship.Get(Sim, other, true);
                if (relation == null) continue;

                relation.LTR.SetLiking(RandomUtil.GetFloat(25, 100));
            }

            return true;
        }
示例#55
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            try
            {
                if (mRequirement.mCareerSim != null)
                {
                    AcquireOccupationParameters parameters = new AcquireOccupationParameters(mRequirement.CareerLoc, false, false);
                    parameters.JumpStartJob = true;
                    parameters.JumpStartLevel = mRequirement.CareerLevel.NextLevels[0];

                    Sim.AcquireOccupation(parameters);
                }
            }
            catch (Exception e)
            {
                Common.DebugException(Sim, e);
                return false;
            }

            if (mRequirement.mCareerSim == null)
            {
                Add(frame, new FindJobScenario(Sim, true, false), ScenarioResult.Start);

                mCareerSim = null;
            }
            else
            {
                if (Sim.Occupation != null)
                {
                    foreach (KeyValuePair<uint, DreamNodeInstance> instance in DreamsAndPromisesManager.sMajorWishes)
                    {
                        if (instance.Value.InputSubject == null) continue;

                        if (instance.Value.InputSubject.mType != DreamNodePrimitive.InputSubjectType.Career) continue;

                        OccupationNames career = (OccupationNames)instance.Value.InputSubject.EnumValue;
                        if (career != Sim.Occupation.Guid) continue;

                        Sim.LifetimeWish = instance.Key;
                        break;
                    }
                }

                Add(frame, new CareerChangedScenario(Sim), ScenarioResult.Start);

                mRequirement.mCareerSim = null;
            }

            return true;
        }
示例#56
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Job.SetHoursUntilWork();

            Add(frame, new SchoolPushScenario(Sim), ScenarioResult.Start);

            if (OnSchoolStartTwoHourCommuteScenario != null)
            {
                base.PrivateUpdate(frame);

                OnSchoolStartTwoHourCommuteScenario(this, frame);
            }
            return false;
        }
        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);
        }
示例#58
0
        public void Perform(SimData data, ScenarioFrame frame)
        {
            if (data.SimDescription == null) return;

            IncStat(data.SimDescription.FullName, Common.DebugLevel.Logging);

            try
            {
                PrivatePerform(data.SimDescription, data, frame);
            }
            catch (Exception e)
            {
                Common.Exception(data.SimDescription, e);
            }
        }
示例#59
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            bool success = false;
            foreach (GameObject obj in GetInventory(Sim))
            {
                int value = Money.Sell(Sim, obj);

                mFunds += value;

                AddStat("Sold", value);
                success = true;
            }

            return success;
        }
示例#60
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Job.SetHoursUntilWork();

            GetData<CareerSimData>(Sim).UpdateCareer ();

            Add(frame, new WorkPushScenario(Sim), ScenarioResult.Start);

            if (OnWorkStartTwoHourCommuteScenario != null)
            {
                base.PrivateUpdate(frame);

                OnWorkStartTwoHourCommuteScenario(this, frame);
            }
            return false;
        }