Example #1
0
        public static bool UnderEAControl(Relationship ths)
        {
            SimDescription simA = ths.SimDescriptionA;
            SimDescription simB = ths.SimDescriptionB;

            if ((((simA != null) && (simB != null)) && (SimTypes.IsSelectable(simA) || SimTypes.IsSelectable(simB))) && (simA.IsHuman && simB.IsHuman))
            {
                if ((simA.Service is GrimReaper) || (simB.Service is GrimReaper))
                {
                    return(true);
                }
                else
                {
                    switch (ths.LTR.CurrentLTR)
                    {
                    case LongTermRelationshipTypes.Spouse:
                    case LongTermRelationshipTypes.Fiancee:
                        return(false);
                    }

                    if (simA.CanHaveRomanceWith(simB) && simA.CheckAutonomousGenderPreference(simB))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Example #2
0
        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);
        }
Example #3
0
        private SimDescription FindPartner(SimDescription parent, List <SimDescription> dyingSims)
        {
            SimDescription description = null;
            float          liking      = -100f;

            List <SimDescription> list = new List <SimDescription>();

            foreach (Relationship relationship in Relationship.GetRelationships(parent))
            {
                SimDescription otherSimDescription = relationship.GetOtherSimDescription(parent);
                if (otherSimDescription.Household == null)
                {
                    continue;
                }

                if (otherSimDescription.Household.IsPreviousTravelerHousehold)
                {
                    continue;
                }

                if (otherSimDescription.Household.IsTravelHousehold)
                {
                    continue;
                }

                if (((parent.Gender != otherSimDescription.Gender) && (otherSimDescription.Partner == null)) && !otherSimDescription.IsMummy)
                {
                    if (relationship.AreRomantic())
                    {
                        list.Add(otherSimDescription);
                    }
                    else if ((!Relationships.IsCloselyRelated(parent, otherSimDescription, false) && parent.CheckAutonomousGenderPreference(otherSimDescription)) && (otherSimDescription.CheckAutonomousGenderPreference(parent) && (relationship.LTR.Liking > liking)))
                    {
                        liking      = relationship.LTR.Liking;
                        description = otherSimDescription;
                    }
                }
            }

            if (list.Count > 0x0)
            {
                return(list[RandomUtil.GetInt(list.Count - 0x1)]);
            }

            foreach (SimDescription description3 in dyingSims)
            {
                if ((((parent.Gender != description3.Gender) && (description3.Partner == null)) && (!description3.IsMummy && !Relationships.IsCloselyRelated(parent, description3, false))) && (parent.CheckAutonomousGenderPreference(description3) && description3.CheckAutonomousGenderPreference(parent)))
                {
                    list.Add(description3);
                }
            }

            if (list.Count > 0x0)
            {
                return(list[RandomUtil.GetInt(list.Count - 0x1)]);
            }

            return(description);
        }
Example #4
0
        private SimDescription FindPartner(SimDescription parent, List<SimDescription> dyingSims)
        {
            SimDescription description = null;
            float liking = -100f;

            List<SimDescription> list = new List<SimDescription>();

            foreach (Relationship relationship in Relationship.GetRelationships(parent))
            {
                SimDescription otherSimDescription = relationship.GetOtherSimDescription(parent);
                if (otherSimDescription.Household == null) continue;

                if (otherSimDescription.Household.IsPreviousTravelerHousehold) continue;

                if (otherSimDescription.Household.IsTravelHousehold) continue;

                if (((parent.Gender != otherSimDescription.Gender) && (otherSimDescription.Partner == null)) && !otherSimDescription.IsMummy)
                {
                    if (relationship.AreRomantic())
                    {
                        list.Add(otherSimDescription);
                    }
                    else if ((!Relationships.IsCloselyRelated(parent, otherSimDescription, false) && parent.CheckAutonomousGenderPreference(otherSimDescription)) && (otherSimDescription.CheckAutonomousGenderPreference(parent) && (relationship.LTR.Liking > liking)))
                    {
                        liking = relationship.LTR.Liking;
                        description = otherSimDescription;
                    }
                }
            }

            if (list.Count > 0x0)
            {
                return list[RandomUtil.GetInt(list.Count - 0x1)];
            }

            foreach (SimDescription description3 in dyingSims)
            {
                if ((((parent.Gender != description3.Gender) && (description3.Partner == null)) && (!description3.IsMummy && !Relationships.IsCloselyRelated(parent, description3, false))) && (parent.CheckAutonomousGenderPreference(description3) && description3.CheckAutonomousGenderPreference(parent)))
                {
                    list.Add(description3);
                }
            }

            if (list.Count > 0x0)
            {
                return list[RandomUtil.GetInt(list.Count - 0x1)];
            }

            return description;
        }