示例#1
0
        protected override GatherResult TargetGather(List <Scenario> list, ref bool random)
        {
            GatherResult result = base.TargetGather(list, ref random);

            if ((Target == null) && (result == GatherResult.Failure))
            {
                Lots.IncreaseImmigrationPressure(Pregnancies, GetValue <ImmigrantRequirementScenario.PressureOption, int>());
            }

            return(result);
        }
示例#2
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            Lots.IncreaseImmigrationPressure(Flirts, ImmigrationPressure);

            if (Flirts.PreviousLoveLoss == null)
            {
                Flirts.PreviousLoveLoss = new SimID(Sim);
                return(true);
            }

            return(false);
        }
示例#3
0
        protected bool ChooseBoss(Career job, bool increasePressure)
        {
            if (IsValidBoss(job, job.Boss))
            {
                return(false);
            }

            if (IsValidBoss(job, job.FormerBoss))
            {
                job.SetBoss(job.FormerBoss);
                return(false);
            }
            else if (job.CareerLoc != null)
            {
                Dictionary <SimDescription, bool> candidateBosses = new Dictionary <SimDescription, bool>();

                foreach (SimDescription boss in job.CareerLoc.Workers)
                {
                    if (IsValidBoss(job, boss))
                    {
                        if (!candidateBosses.ContainsKey(boss))
                        {
                            candidateBosses.Add(boss, true);
                        }
                    }
                }

                if (candidateBosses.Count == 0)
                {
                    foreach (SimDescription owner in Money.GetDeedOwner(job.CareerLoc.Owner))
                    {
                        if (IsValidBoss(job, owner))
                        {
                            if (!candidateBosses.ContainsKey(owner))
                            {
                                candidateBosses.Add(owner, true);
                            }
                        }
                    }
                }

                if (candidateBosses.Count == 0)
                {
                    foreach (CareerLocation location in job.Locations)
                    {
                        if (location != job.CareerLoc)
                        {
                            location.CheckWorkers();
                            foreach (SimDescription boss in location.Workers)
                            {
                                if (IsValidBoss(job, boss))
                                {
                                    if (!candidateBosses.ContainsKey(boss))
                                    {
                                        candidateBosses.Add(boss, true);
                                    }
                                }
                            }
                        }
                    }
                }

                if (candidateBosses.Count > 0)
                {
                    List <SimDescription> randomList = new List <SimDescription>(candidateBosses.Keys);
                    SetBoss(job, RandomUtil.GetRandomObjectFromList(randomList));

                    if (job.Coworkers != null)
                    {
                        job.Coworkers.Remove(job.Boss);
                    }

                    Careers.VerifyTone(job.OwnerDescription);

                    return(true);
                }
                else
                {
                    if ((increasePressure) && (NeedsBoss(job, true)))
                    {
                        IncStat("Pressure: Boss Needed");

                        Lots.IncreaseImmigrationPressure(Careers, ImmigrationPressure);
                    }
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }