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)); }