示例#1
0
        public static bool IsCloselyRelated(SimDescription a, SimDescription b, bool thoroughCheck)
        {
            if ((a == null) || (b == null))
            {
                return(false);
            }

            if (a == b)
            {
                return(true);
            }

            if (!SimTypes.IsEquivalentSpecies(a, b))
            {
                return(false);
            }

            if (a.IsRobot)
            {
                return(false);
            }

            if (b.IsRobot)
            {
                return(false);
            }

            if (FutureDescendantService.IsAncestorOf(a, b) || FutureDescendantService.IsAncestorOf(b, a))
            {
                return(true);
            }

            return(IsCloselyRelated(a.Genealogy, b.Genealogy, thoroughCheck));
        }
示例#2
0
        public static bool CanHaveRomanceWith(Logger log, SimDescription ths, SimDescription other, bool testAge, bool allowAdultTeen, bool testRelation, bool thoroughCheck)
        {
            if (!SimTypes.IsEquivalentSpecies(ths, other))
            {
                if (log != null)
                {
                    log("Species Mismatch");
                }
                return(false);
            }

            bool flag = false;

            if (!testAge)
            {
                flag = true;
            }
            else
            {
                switch (ths.Age)
                {
                case CASAgeGenderFlags.Adult:
                case CASAgeGenderFlags.Elder:
                case CASAgeGenderFlags.YoungAdult:
                    if (other.YoungAdultOrAbove)
                    {
                        flag = true;
                    }
                    else if (allowAdultTeen)
                    {
                        if (other.Teen)
                        {
                            flag = true;
                        }
                    }
                    break;

                case CASAgeGenderFlags.Teen:
                    if (allowAdultTeen)
                    {
                        if (other.TeenOrAbove)
                        {
                            flag = true;
                        }
                    }
                    else
                    {
                        if (other.Teen)
                        {
                            flag = true;
                        }
                    }
                    break;
                }
            }

            if (!flag)
            {
                if (log != null)
                {
                    log("Age Mismatch: " + ths.Age + " - " + other.Age);
                }
                return(false);
            }

            if ((testRelation) && (IsCloselyRelated(ths.Genealogy, other.Genealogy, thoroughCheck)))
            {
                if (log != null)
                {
                    log("IsCloselyRelated");
                }
                return(false);
            }

            return(true);
        }