Exemplo n.º 1
0
        protected override bool AllowHouse(Household house)
        {
            if (ManagerCareer.HasSkillCareer(Sim, SkillNames.Handiness))
            {
                return(true);
            }

            if (ManagerCareer.HasSkillCareer(Household.ActiveHousehold, SkillNames.Handiness))
            {
                return(false);
            }

            bool succcess = false;

            foreach (SimDescription sim in HouseholdsEx.All(house))
            {
                if (ManagerFriendship.AreEnemies(sim, Sim, -25))
                {
                    return(false);
                }

                if (ManagerFriendship.AreFriends(sim, Sim, 25))
                {
                    succcess = true;
                }
            }

            return(succcess);
        }
Exemplo n.º 2
0
        protected bool HasMetric(SimDescription sim)
        {
            if (ManagerCareer.HasSkillCareer(sim, SkillNames.Guitar))
            {
                return(sim.Occupation.CareerLevel >= (Music.LevelToGetPaidForConcerts - 3));
            }

            Career job = sim.Occupation as Career;

            if (job != null)
            {
                if (job.CurLevel == null)
                {
                    return(false);
                }

                foreach (PerfMetric metric in job.CurLevel.Metrics)
                {
                    if (metric is Music.MetricConcertsPerformed)
                    {
                        return(metric.CalcMetric(job) < 3);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 3
0
        protected override bool Allow()
        {
            if (!GetValue <Option, bool> ())
            {
                return(false);
            }

            if (ManagerCareer.HasSkillCareer(Household.ActiveHousehold, SkillNames.Handiness))
            {
                IncStat("Active Repairman");
                return(false);
            }

            return(base.Allow());
        }
Exemplo n.º 4
0
        protected override ICollection <SimDescription> GetSims()
        {
            List <SimDescription> allSims = ManagerSim.Matching(HouseholdsEx.Humans(mHouse), CASAgeGenderFlags.Teen | CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder);
            List <SimDescription> sims    = new List <SimDescription>();

            foreach (SimDescription sim in allSims)
            {
                if (!ManagerCareer.HasSkillCareer(sim, SkillNames.Gardening))
                {
                    continue;
                }

                sims.Add(sim);
            }

            if (sims.Count == 0)
            {
                return(allSims);
            }
            else
            {
                return(sims);
            }
        }
Exemplo n.º 5
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            List <NectarMaker> choices = new List <NectarMaker>();
            NectarMaker        best = null, broken = null;

            foreach (Lot lot in ManagerLot.GetOwnedLots(Sim))
            {
                foreach (NectarMaker maker in lot.GetObjects <NectarMaker>())
                {
                    if (!maker.Repairable.Broken)
                    {
                        choices.Add(maker);
                        if (maker.Inventory.IsFull())
                        {
                            best = maker;
                        }
                    }
                    else
                    {
                        broken = maker;
                    }

                    foreach (NectarBottle bottle in maker.mBottles)
                    {
                        Inventories.TryToMove(bottle, Sim.CreatedSim);
                    }

                    AddStat("Collected Bottles", maker.mBottles.Count);

                    maker.mBottles.Clear();
                }
            }

            List <NectarRack> racks = new List <NectarRack>();

            foreach (Lot lot in ManagerLot.GetOwnedLots(Sim))
            {
                foreach (NectarRack rack in lot.GetObjects <NectarRack>())
                {
                    if (rack.HasTreasure())
                    {
                        continue;
                    }

                    if (rack.Buyable)
                    {
                        continue;
                    }

                    if (rack.Tasteable)
                    {
                        continue;
                    }

                    if (rack.Inventory.IsFull())
                    {
                        continue;
                    }

                    racks.Add(rack);
                }
            }

            if (racks.Count > 0)
            {
                List <NectarBottle> bottles = new List <NectarBottle>(Inventories.InventoryFindAll <NectarBottle>(Sim));
                foreach (NectarBottle bottle in bottles)
                {
                    if (!bottle.CanBeSold())
                    {
                        continue;
                    }

                    NectarRack rack = RandomUtil.GetRandomObjectFromList(racks);

                    IncStat("Rack Stored");
                    rack.Inventory.TryToMove(bottle);

                    if (rack.Inventory.IsFull())
                    {
                        racks.Remove(rack);
                        if (racks.Count == 0)
                        {
                            break;
                        }
                    }
                }
            }

            if (best != null)
            {
                choices.Clear();
                choices.Add(best);
            }

            if (choices.Count == 0)
            {
                if (broken != null)
                {
                    IncStat("Attempt Repair");

                    Add(frame, new ScheduledRepairScenario(Sim, broken), ScenarioResult.Start);
                }
                else
                {
                    IncStat("No Choice");
                }
                return(false);
            }

            NectarMaker choice = RandomUtil.GetRandomObjectFromList(choices);

            if (!choice.Inventory.IsFull())
            {
                List <Ingredient> list = new List <Ingredient>(Inventories.InventoryFindAll <Ingredient>(Sim));

                while (list.Count > 0)
                {
                    Ingredient ingredient = RandomUtil.GetRandomObjectFromList(list);
                    list.Remove(ingredient);

                    if (!choice.CanAddToInventory(ingredient))
                    {
                        continue;
                    }

                    if (choice.Inventory.TryToMove(ingredient))
                    {
                        IncStat("Added: " + ingredient.CatalogName);
                    }

                    if (choice.Inventory.IsFull())
                    {
                        break;
                    }
                }
            }

            if (choice.Inventory.IsFull())
            {
                if ((ManagerCareer.HasSkillCareer(Sim, SkillNames.Nectar)) ||
                    (!ManagerCareer.HasSkillCareer(Sim.Household, SkillNames.Nectar)))
                {
                    int skillLevel = Sim.SkillManager.GetSkillLevel(SkillNames.Nectar);

                    List <NectarMaker.MakeNectarStyle> styles = new List <NectarMaker.MakeNectarStyle>();

                    styles.Add(NectarMaker.MakeNectarStyle.Basic);

                    if (skillLevel >= NectarMaker.kConcentratedUnlockLevel)
                    {
                        styles.Add(NectarMaker.MakeNectarStyle.Concentrated);
                    }
                    if (skillLevel >= NectarMaker.kMassProduceUnlockLevel)
                    {
                        styles.Add(NectarMaker.MakeNectarStyle.MassProduce);
                    }
                    if (skillLevel >= NectarMaker.kExtendedNectarationUnlockLevel)
                    {
                        styles.Add(NectarMaker.MakeNectarStyle.ExtendedNectaration);
                    }

                    return(Situations.PushInteraction(this, Sim, choice, new MakeNectarEx.Definition(RandomUtil.GetRandomObjectFromList(styles))));
                }
                else
                {
                    IncStat("Not Job");
                    return(false);
                }
            }
            else
            {
                IncStat("Not Full");
                return(false);
            }
        }