Ejemplo n.º 1
0
        protected override NameTakeType Combine(NameTakeType original, NameTakeType add, out bool same)
        {
            NameTakeType result = original | add;

            same = (result == original);

            return(result);
        }
Ejemplo n.º 2
0
 public NameTakeBaseOption(NameTakeType defValue)
     : base(defValue, defValue)
 {
 }
Ejemplo n.º 3
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (Sim.Household == Target.Household)
            {
                HouseholdBreakdown breakdown = new HouseholdBreakdown(Manager, this, "MoveSame", Sim, Target, HouseholdBreakdown.ChildrenMove.Go, false);

                Add(frame, GetMoveInLotScenario(breakdown), ScenarioResult.Start);
                return(false);
            }
            else
            {
                HouseholdBreakdown breakdownA = new HouseholdBreakdown(Manager, this, "MoveA1", Sim, HouseholdBreakdown.ChildrenMove.Scoring, false);
                HouseholdBreakdown breakdownB = new HouseholdBreakdown(Manager, this, "MoveB1", Target, HouseholdBreakdown.ChildrenMove.Scoring, false);

                if ((!breakdownA.SimGoing) && (!breakdownB.SimGoing))
                {
                    if ((Sim.LotHome != null) && (Target.LotHome != null))
                    {
                        breakdownA = new HouseholdBreakdown(Manager, this, "MoveA2", Sim, HouseholdBreakdown.ChildrenMove.Scoring, true);
                        breakdownB = new HouseholdBreakdown(Manager, this, "MoveB2", Target, HouseholdBreakdown.ChildrenMove.Scoring, true);
                    }
                    else if (Sim.LotHome == null)
                    {
                        breakdownA = new HouseholdBreakdown(Manager, this, "MoveA3", Sim, HouseholdBreakdown.ChildrenMove.Scoring, true);
                    }
                    else
                    {
                        breakdownB = new HouseholdBreakdown(Manager, this, "MoveB3", Target, HouseholdBreakdown.ChildrenMove.Scoring, true);
                    }
                }

                int scoreA = 0;
                int scoreB = 0;

                bool moveIn = true;

                NameTakeType type = GetValue <MoveOption, NameTakeType>();
                if (type == NameTakeType.Husband)
                {
                    if (Sim.IsMale)
                    {
                        scoreA = 1000;
                    }
                    else
                    {
                        scoreB = 1000;
                    }
                }
                else if (type == NameTakeType.Wife)
                {
                    if (Sim.IsFemale)
                    {
                        scoreA = 1000;
                    }
                    else
                    {
                        scoreB = 1000;
                    }
                }

/*
 *              else if ((type == NameTakeType.User) && (Sim.LotHome != null) && (Target.LotHome != null))
 *              {
 *                  bool flag = TwoButtonDialog.Show(
 *                      Households.Localize(Sim.IsFemale, "", new object[] { Sim, Target }),
 *                      Households.Localize(Sim.IsFemale, Sim.FirstName, new object[0]),
 *                      Households.Localize(Sim.IsFemale, Target.FirstName, new object[0])
 *                  );
 *              }
 *              else if (type == NameTakeType.None)
 *              {
 *                  moveIn = false;
 *              }
 */
                else
                {
                    scoreA = AddScoring("Score A", GetScore(Sim));
                    scoreB = AddScoring("Score B", GetScore(Target));
                }

                if (moveIn)
                {
                    if (scoreA > scoreB)
                    {
                        if ((breakdownA.SimGoing) && (Target.LotHome != null))
                        {
                            IncStat("Try Move A");
                            Add(frame, GetMoveInScenario(breakdownA.Going, Target), ScenarioResult.Failure);
                        }
                        else
                        {
                            if (!breakdownA.SimGoing)
                            {
                                IncStat("Not SimGoing A");
                            }

                            if (Target.LotHome == null)
                            {
                                IncStat("No LotHome A");
                            }
                        }

                        if ((breakdownB.SimGoing) && (Sim.LotHome != null))
                        {
                            IncStat("Try Move B");
                            Add(frame, GetMoveInScenario(breakdownB.Going, Sim), ScenarioResult.Failure);
                        }
                        else
                        {
                            if (!breakdownB.SimGoing)
                            {
                                IncStat("Not SimGoing B");
                            }

                            if (Sim.LotHome == null)
                            {
                                IncStat("No LotHome B");
                            }
                        }
                    }
                    else
                    {
                        if ((breakdownB.SimGoing) && (Sim.LotHome != null))
                        {
                            IncStat("Try Move B");
                            Add(frame, GetMoveInScenario(breakdownB.Going, Sim), ScenarioResult.Failure);
                        }
                        else
                        {
                            if (!breakdownB.SimGoing)
                            {
                                IncStat("Not SimGoing B");
                            }

                            if (Sim.LotHome == null)
                            {
                                IncStat("No LotHome B");
                            }
                        }

                        if ((breakdownA.SimGoing) && (Target.LotHome != null))
                        {
                            IncStat("Try Move A");
                            Add(frame, GetMoveInScenario(breakdownA.Going, Target), ScenarioResult.Failure);
                        }
                        else
                        {
                            if (!breakdownA.SimGoing)
                            {
                                IncStat("Not SimGoing A");
                            }

                            if (Target.LotHome == null)
                            {
                                IncStat("No LotHome A");
                            }
                        }
                    }
                }
                else
                {
                    IncStat("Not MoveIn");
                }

                breakdownA = new HouseholdBreakdown(Manager, this, "MoveLotA", Sim, HouseholdBreakdown.ChildrenMove.Scoring, true);
                breakdownB = new HouseholdBreakdown(Manager, this, "MoveLotB", Target, HouseholdBreakdown.ChildrenMove.Scoring, true);

                if ((breakdownA.SimGoing) && (breakdownB.SimGoing))
                {
                    int humans = 0, pets = 0, plumbots = 0;
                    breakdownA.GetGoingCount(ref humans, ref pets, ref plumbots);
                    breakdownB.GetGoingCount(ref humans, ref pets, ref plumbots);

                    if ((humans <= Options.GetValue <MaximumSizeOption, int>()) && (pets <= Options.GetValue <MaximumPetSizeOption, int>()))
                    {
                        List <SimDescription> going = new List <SimDescription>();
                        going.AddRange(breakdownA.Going);
                        going.AddRange(breakdownB.Going);

                        IncStat("Try Move A + B");
                        Add(frame, GetMoveInLotScenario(going), ScenarioResult.Failure);
                    }
                    else
                    {
                        AddStat("Too Many Movers", humans + pets);
                        AddStat("Too Many Movers Humans", humans);
                        AddStat("Too Many Movers Pets", pets);
                    }
                }
                else
                {
                    if (!breakdownA.SimGoing)
                    {
                        IncStat("Not Going A");
                    }

                    if (!breakdownB.SimGoing)
                    {
                        IncStat("Not Going B");
                    }
                }

                return(false);
            }
        }