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); }
private static SimDescription GetPotentialInLaw(SimDescription me, SimDescription partner, 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 == me) { continue; } if (sim == partner) { continue; } if (testRelation) { bool found = false; foreach (SimDescription test in testAgainst) { if (Relationships.IsCloselyRelated(test, sim, false)) { found = true; break; } } if (found) { continue; } } return(sim); } return(null); }