protected override bool CommonAllow(SimDescription sim) { if (Sims.HasEnough(this, sim)) { IncStat("Maximum Reached"); return(false); } else if (sim.IsPregnant) { IncStat("Couple Pregnant"); return(false); } else if (!Pregnancies.Allow(this, sim)) { IncStat("User Denied"); return(false); } if (GetValue <MaximumNumberOfChildrenOption, int>(sim) > 0) { if (AddScoring("PreferredBabyCount", sim) <= Relationships.GetChildren(sim).Count) { IncStat("Enough"); return(false); } } return(base.CommonAllow(sim)); }
protected ICollection <SimDescription> FindPotentialMothers(int additionalBabyCount) { List <SimDescription> choices = new List <SimDescription>(); foreach (SimDescription sim in Sims.All) { using (Common.TestSpan span = new Common.TestSpan(Scenarios, "FindPotentialMothers")) { if (!AllowSpecies(sim)) { continue; } IncStat(sim.FullName, Common.DebugLevel.Logging); if ((sim.IsHuman) && (sim.Partner == null)) { IncStat("Unpartnered"); } else if (sim.IsPregnant) { IncStat("Already Pregnant"); } else if (!Pregnancies.Allow(this, sim, sim.Partner, Managers.Manager.AllowCheck.Active)) { //IncStat("Allow Fail"); continue; } else if (!TestPreferredBaby(this, sim, additionalBabyCount)) { //IncStat("Preferred Fail"); continue; } else if (!Pregnancies.TestCooldown(this, sim)) { //IncStat("Cooldown Fail"); continue; } else { choices.Add(sim); } } } AddStat("Fertile Choices", choices.Count); return(new SimScoringList(this, "PotentialMother", choices, false).GetBestByMinScore(0)); }
protected override bool TargetAllow(SimDescription target) { if (target.IsFrankenstein) { IncStat("Partner Simbot"); return(false); } else if ((Sim.CreatedSim != null) && (Stylist.IsStyleeJobTargetOfAnyStyler(Sim.CreatedSim))) { IncStat("Stylee"); return(false); } else if (!Pregnancies.Allow(this, Sim, Target, Managers.Manager.AllowCheck.Active)) { return(false); } return(base.TargetAllow(target)); }
protected override bool CommonAllow(SimDescription sim) { if (Sims.HasEnough(this, sim)) { IncStat("Maximum Reached"); return(false); } else if (sim.IsPregnant) { IncStat("Couple Pregnant"); return(false); } else if (!Pregnancies.Allow(this, sim)) { IncStat("User Denied"); return(false); } return(base.CommonAllow(sim)); }
public void AddWoohooerNotches(SimDescription a, SimDescription b, bool risky, bool tryForBaby) { if (sWoohooAddNotch.Valid) { bool allow = false; if ((Households.AllowGuardian(a)) || (Pregnancies.Allow(this, a))) { allow = true; } else if ((Households.AllowGuardian(b)) || (Pregnancies.Allow(this, b))) { allow = true; } if (!allow) { return; } sWoohooAddNotch.Invoke <object>(new object[] { a, b, risky, tryForBaby }); } }
protected override bool Allow(SimDescription sim) { if (!base.Allow(sim)) { return(false); } if (sim.Elder) { if (!ManagerPregnancy.TestNearElderLimit(this, sim, GetValue <NearDeathLimitOption, int>())) { IncStat("Near Death Denied"); return(false); } else if (ExpectedPregnancyBaseScenario.GetNumLiveChildren(sim) > 0) { IncStat("Has Children"); return(false); } else if (AddScoring("PreferredBabyCount", sim) <= 0) { IncStat("Score Fail"); return(false); } else if (sim.Partner != null) { if (Pregnancies.Allow(this, sim, sim.Partner, Managers.Manager.AllowCheck.Active)) { IncStat("Partner Too Young"); return(false); } else if (!GetValue <AllowAdoptionOption, bool>(sim.Partner)) { IncStat("Partner Adoption Denied"); return(false); } else if (AddScoring("Partner", ScoringLookup.GetScore("PreferredBabyCount", sim.Partner)) <= 0) { IncStat("Partner Score Fail"); return(false); } } foreach (SimDescription other in HouseholdsEx.Humans(sim.Household)) { if (other.ChildOrBelow) { IncStat("Child in Home"); return(false); } } } else if ((sim.Partner != null) && (sim.Gender == sim.Partner.Gender)) { // If the sims can have children normally, then don't allow adoption if (Pregnancies.Allow(this, sim, sim.Partner, Managers.Manager.AllowCheck.Active)) { return(false); } else if (!GetValue <AllowAdoptionOption, bool>(sim.Partner)) { IncStat("Partner Adoption Denied"); return(false); } else if (!ExpectedPregnancyBaseScenario.TestPreferredBaby(this, sim, 0)) { IncStat("Preferred Fail"); return(false); } else if (!Pregnancies.TestCooldown(this, sim)) { IncStat("Cooldown Fail"); return(false); } } else { IncStat("Too Young"); return(false); } return(true); }
protected override bool Allow(SimDescription sim) { if (!sim.Elder) { IncStat("Too Young"); return(false); } else if (sim.Household == null) { IncStat("No Home"); return(false); } else if (!Households.Allow(this, sim)) { IncStat("Move Denied"); return(false); } else if ((sim.Partner != null) && (!SimTypes.IsDead(sim.Partner)) && (Pregnancies.Allow(this, sim, sim.Partner, Managers.Manager.AllowCheck.Active))) { IncStat("Fertile Partnered"); return(false); } else if (!GetValue <EmigrationOption, bool>(sim)) { IncStat("Emigrate Denied"); return(false); } else if (HouseholdsEx.NumHumansIncludingPregnancy(sim.Household) < GetValue <MaximumSizeOption, int>(sim.Household)) { IncStat("House Empty"); return(false); } else { bool found = false; foreach (SimDescription other in HouseholdsEx.Humans(sim.Household)) { if (other == sim) { continue; } if (other == sim.Partner) { continue; } if (other.Partner == null) { continue; } if (!Pregnancies.Allow(this, other)) { continue; } if (ExpectedPregnancyBaseScenario.GetNumLiveChildren(other) > 0) { continue; } if (AddScoring("PreferredBabyCount", other) <= 0) { continue; } if ((!Relationships.IsCloselyRelated(other, sim, false)) || (!Relationships.IsCloselyRelated(other, sim.Partner, false))) { continue; } found = true; } if (!found) { IncStat("Not Necessary"); return(false); } } return(base.Allow(sim)); }