public bool CanHaveAutonomousRomance(Common.IStatGenerator stats, SimDescription sim, SimDescription other, bool fullTest) { if ((sim.Household == null) || (other.Household == null)) { stats.IncStat("No Home"); return(false); } else if ((sim.Genealogy == null) || (other.Genealogy == null)) { stats.IncStat("No Genealogy"); return(false); } else if ((fullTest) && ((SimTypes.IsSelectable(sim)) || (SimTypes.IsSelectable(other)))) { stats.IncStat("Active"); return(false); } else if ((fullTest) && (!sim.CheckAutonomousGenderPreference(other))) { stats.IncStat("Gender Pref"); return(false); } else { bool testRelation = fullTest; if ((sim.Partner == other) || (other.Partner == sim)) { testRelation = false; } if (!Relationships.CanHaveRomanceWith(stats.IncStat, sim, other, true, true, testRelation, GetValue <ManagerFlirt.CompleteAncestorCheckOption, bool>())) { return(false); } } return(true); }
private static SimDescription GetPotentialMate(SimDescription me, List <SimDescription> testAgainst, bool testRelation) { List <SimDescription> choices = new List <SimDescription>(); foreach (List <SimDescription> sims in SimListing.GetFullResidents(false).Values) { foreach (SimDescription sim in sims) { if (sim.LotHome == null) { continue; } if (testRelation) { if (sim.Partner != null) { continue; } } if (SimTypes.IsSkinJob(sim)) { continue; } if (!SimTypes.IsEquivalentSpecies(me, sim)) { continue; } if (me.Genealogy == null || me.Genealogy.SimDescription == null) { continue; } if (me.SkinToneKey == ResourceKey.kInvalidResourceKey || me.Genealogy.SimDescription.SkinToneKey == ResourceKey.kInvalidResourceKey) { continue; } choices.Add(sim); } } RandomUtil.RandomizeListOfObjects(choices); foreach (SimDescription sim in choices) { if (!sim.CheckAutonomousGenderPreference(me)) { continue; } if (!Relationships.CanHaveRomanceWith(null, sim, me, false, true, testRelation, false)) { continue; } if (testRelation) { Relationship relation = Relationship.Get(me, sim, false); if ((relation != null) && (relation.CurrentLTRLiking < 0)) { continue; } bool found = false; foreach (SimDescription test in testAgainst) { if (Relationships.IsCloselyRelated(test, sim, false)) { found = true; break; } } if (found) { continue; } } return(sim); } return(null); }