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 MoveInLotScenario(MoveInLotScenario scenario) : base(scenario) { mMovers = scenario.mMovers; mBreakdown = scenario.mBreakdown; mHouse = scenario.mHouse; mNewHouse = scenario.mNewHouse; }
protected override bool PrivateUpdate(ScenarioFrame frame) { ScoringList <SimDescription> scoring = new ScoringList <SimDescription>(); SimDescription head = SimTypes.HeadOfFamily(House); foreach (SimDescription sim in HouseholdsEx.All(House)) { if (!Households.AllowSoloMove(sim)) { continue; } if (head != null) { if (head == sim) { continue; } if (head.Partner == sim) { continue; } } scoring.Add(sim, AddScoring("FindOwnHome", sim, sim.Partner)); } List <SimDescription> best = scoring.GetBestByMinScore(1); if ((best == null) || (best.Count == 0)) { IncStat("No Choices"); return(false); } else { foreach (SimDescription sim in best) { HouseholdBreakdown breakdown = new HouseholdBreakdown(Manager, this, UnlocalizedName, sim, HouseholdBreakdown.ChildrenMove.Scoring, false); Add(frame, new StandardMoveInLotScenario(breakdown, 0), ScenarioResult.Failure); Add(frame, new PostScenario(sim, mPassedInspection), ScenarioResult.Success); } } return(false); }
protected override bool PrivateUpdate(ScenarioFrame frame) { HouseholdBreakdown breakdown = new HouseholdBreakdown(Manager, this, UnlocalizedName, Sim, HouseholdBreakdown.ChildrenMove.Scoring, mIgnoreHead); if (!breakdown.SimGoing) { IncStat("Not Going"); return(false); } else if ((breakdown.NoneStaying) && (GetValue <IsAncestralOption, bool>(Sim.Household))) { IncStat("Ancestral"); return(false); } Add(frame, new InspectedMoveInScenario(breakdown.Going, Target), ScenarioResult.Start); return(false); }
protected override MoveInLotScenario GetMoveInLotScenario(HouseholdBreakdown breakdown) { return(new StandardMoveInLotScenario(breakdown, 0)); }
protected override MoveInLotScenario GetMoveInLotScenario(HouseholdBreakdown breakdown) { return(new StrandedMoveInLotScenario(breakdown, mMaximumLoan)); }
public StrandedMoveInLotScenario(HouseholdBreakdown breakdown, int maximumLoan) : base(breakdown, maximumLoan) { }
public StandardMoveInLotScenario(HouseholdBreakdown breakdown, int maximumLoan) : base(breakdown) { mMaximumLoan = maximumLoan; }
protected override bool PrivateUpdate(ScenarioFrame frame) { ScoringList <SimDescription> scoring = new ScoringList <SimDescription>(); SimDescription head = SimTypes.HeadOfFamily(House); foreach (SimDescription sim in House.AllSimDescriptions) { if ((sim == head) || (sim.Partner == head)) { continue; } // Don't move sims that can't move out if (!Households.AllowSoloMove(sim)) { continue; } // Don't move sims related to the head of family if (Flirts.IsCloselyRelated(sim, head)) { continue; } // Don't move sims that don't have partners if (sim.Partner == null) { continue; } if (!House.AllSimDescriptions.Contains(sim.Partner)) { continue; } if (Flirts.IsCloselyRelated(sim.Partner, head)) { continue; } scoring.Add(sim, AddScoring("FindOwnHome", sim.Partner, sim)); } ICollection <SimDescription> best = scoring.GetBestByPercent(100); if ((best == null) || (best.Count == 0)) { IncStat("No Choices"); return(false); } else { foreach (SimDescription sim in best) { HouseholdBreakdown breakdown = new HouseholdBreakdown(Manager, this, UnlocalizedName, sim, HouseholdBreakdown.ChildrenMove.Scoring, false); Add(frame, new StandardMoveInLotScenario(breakdown, 0), ScenarioResult.Failure); Add(frame, new PostScenario(sim), ScenarioResult.Success); } } return(false); }
protected MoveInLotScenario(HouseholdBreakdown breakdown) { mBreakdown = breakdown; mMovers = new List <SimDescription>(mBreakdown.Going); }
public MarriageMoveMoveInLotScenario(HouseholdBreakdown breakdown) : base(breakdown) { }
protected override MoveInLotScenario GetMoveInLotScenario(HouseholdBreakdown breakdown) { return(new MarriageMoveMoveInLotScenario(breakdown)); }
protected abstract MoveInLotScenario GetMoveInLotScenario(HouseholdBreakdown breakdown);
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); } }