Example #1
0
        protected bool IsValidLover(IScoringGenerator stats, SimDescription sim, SimDescription potential, bool allowAffair, bool force)
        {
            if (sim == potential)
            {
                //stats.IncStat("Myself");
                return(false);
            }
            else if (!GetValue <AllowRomanceOption, bool>(potential))
            {
                stats.IncStat("User Denied");
                return(false);
            }
            else if ((!allowAffair) && (potential.Partner != null))
            {
                stats.IncStat("Affair Denied");
                return(false);
            }
            else if (sim.Partner == potential)
            {
                stats.IncStat("Partner");
                return(false);
            }
            else if ((!GetValue <AllowOldLoverOption, bool>()) && (WasOldLover(sim, potential)))
            {
                stats.IncStat("Old Lover");
                return(false);
            }
            else if (!Allow(stats, sim, potential))
            {
                //stats.IncStat("Mixed Aged Denied");
                return(false);
            }
            else if (potential.Household == null)
            {
                stats.IncStat("Invalid House");
                return(false);
            }
            else if ((SimTypes.IsSpecial(sim)) && (SimTypes.IsSpecial(potential)))
            {
                stats.IncStat("Both Special");
                return(false);
            }
            else if (Situations.IsBusy(stats, potential, true))
            {
                stats.IncStat("Other Busy");
                return(false);
            }
            else if (IsActiveInvolved(potential))
            {
                stats.IncStat("Other Active Involved");
                return(false);
            }

            return(true);
        }
Example #2
0
        public List <SimDescription> FindExistingFriendFor(IScoringGenerator stats, SimDescription sim, int minLiking, bool ignoreBusy)
        {
            List <SimDescription> choices = new List <SimDescription>();

            List <Relationship> relations = new List <Relationship>(Relationship.GetRelationships(sim));

            if (relations.Count == 0)
            {
                stats.IncStat("Friend: None");
                return(choices);
            }

            stats.AddStat("Friend: Relations", relations.Count);

            foreach (Relationship relation in relations)
            {
                SimDescription other = relation.GetOtherSimDescription(sim);
                if (other == null)
                {
                    stats.IncStat("Friend: Bad Link");
                    continue;
                }

                stats.IncStat(other.FullName, Common.DebugLevel.Logging);

                if (relation.LTR.Liking <= minLiking)
                {
                    stats.IncStat("Friend: Unliked");
                }
                else if (SimTypes.IsDead(other))
                {
                    stats.IncStat("Friend: Dead");
                }
                else if ((!ignoreBusy) && (Situations.IsBusy(stats, other, true)))
                {
                    stats.IncStat("Friend: Busy");
                }
                else if (!Allow(stats, other))
                {
                    stats.IncStat("Friend: User Denied");
                }
                else
                {
                    choices.Add(other);
                }

                Main.Sleep("ManagerFriendship:FindExistingFriendFor");
            }

            return(choices);
        }
Example #3
0
        public List <SimDescription> FindNemesisFor(IScoringGenerator stats, SimDescription sim, bool ignoreBusy)
        {
            List <SimDescription> choices = new List <SimDescription>();

            List <Relationship> relations = new List <Relationship>(Relationship.GetRelationships(sim));

            if (relations.Count == 0)
            {
                stats.IncStat("Nemesis: None");
                return(choices);
            }

            stats.AddStat("Nemesis: Relations", relations.Count);

            foreach (Relationship relation in relations)
            {
                SimDescription other = relation.GetOtherSimDescription(sim);
                if (other == null)
                {
                    stats.IncStat("Nemesis: Bad Link");
                    continue;
                }

                stats.IncStat(other.FullName, Common.DebugLevel.Logging);

                if (!relation.HasInteractionBitSet(LongTermRelationship.InteractionBits.MakeEnemy))
                {
                    stats.IncStat("Nemesis: Not");
                }
                else if (SimTypes.IsDead(other))
                {
                    stats.IncStat("Nemesis: Dead");
                }
                else if ((!ignoreBusy) && (Situations.IsBusy(stats, other, true)))
                {
                    stats.IncStat("Nemesis: Busy");
                }
                else if (!Allow(stats, other))
                {
                    stats.IncStat("Nemesis: User Denied");
                }
                else
                {
                    choices.Add(other);
                }

                Main.Sleep("ManagerFriendship:FindNemesisFor");
            }

            return(choices);
        }
Example #4
0
        public List <SimDescription> FindPartneredFor(SimDescription sim)
        {
            if ((sim == null) || (sim.Household == null))
            {
                IncStat("Taken: Invalid Sim");
                return(null);
            }

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

            foreach (SimDescription potential in Sims.All)
            {
                if (sim == potential)
                {
                    //IncStat("Taken: Myself");
                }
                else if (!Romances.Allow(this, sim, potential))
                {
                    IncStat("Taken: User Denied");
                }
                else if (Situations.IsBusy(this, potential, true))
                {
                    IncStat("Taken: Busy");
                }
                else if (!potential.Marryable)
                {
                    IncStat("Taken: Not Marryable");
                }
                else if (potential.Partner == null)
                {
                    IncStat("Taken: No Partner");
                }
                else if (sim.Teen != potential.Teen)
                {
                    IncStat("Taken: Wrong Age");
                }
                else if (potential.Household == null)
                {
                    IncStat("Taken: Invalid Sim");
                }
                else
                {
                    choices.Add(potential);
                }

                Main.Sleep("ManagerRomance:FindPartneredFor");
            }

            return(choices);
        }
Example #5
0
        protected virtual bool Allow(SimDescription sim)
        {
            if (SimTypes.IsPassporter(sim))
            {
                IncStat("Simport");
                return(false);
            }
            else if (sim == mNotSim)
            {
                IncStat("Not Sim");
                return(false);
            }
            else if (!AllowSpecies(sim))
            {
                IncStat("Species Denied");
                return(false);
            }

            if (!AllowActive)
            {
                if (SimTypes.IsSelectable(sim))
                {
                    IncStat("Active");
                    return(false);
                }
            }

            if (CheckBusy)
            {
                if (Situations.IsBusy(this, sim, true))
                {
                    IncStat("Busy");
                    return(false);
                }
            }

            if (!sim.IsHuman)
            {
                IncStat("Species " + sim.Species);
            }
            return(true);
        }
Example #6
0
        protected virtual bool TargetAllow(SimDescription target)
        {
            if (SimTypes.IsPassporter(target))
            {
                IncStat("Simport");
                return(false);
            }
            else if (Sim == target)
            {
                IncStat("Is Actor");
                return(false);
            }
            else if (target == mNotTarget)
            {
                IncStat("Not Target");
                return(false);
            }
            else if (!AllowSpecies(Sim, target))
            {
                IncStat("Species Match Denied");
                return(false);
            }

            if (TestOpposing)
            {
                if (Personalities.IsOpposing(this, Sim, target, false))
                {
                    IncStat("Opposing");
                    return(false);
                }
            }

            if (!TargetAllowActive)
            {
                if (SimTypes.IsSelectable(target))
                {
                    IncStat("Active");
                    return(false);
                }
            }

            if ((!mTargetGatheringFailure) && (TargetCheckBusy))
            {
                if (Situations.IsBusy(this, target, true))
                {
                    IncStat("Busy");
                    return(false);
                }
            }

            if (!CommonAllow(target))
            {
                return(false);
            }

            if ((!Sim.IsHuman) || (!target.IsHuman))
            {
                IncStat("Species Match " + Sim.Species + " - " + target.Species);
            }
            return(true);
        }
Example #7
0
        public List <SimDescription> FindExistingFor(IScoringGenerator stats, SimDescription sim, bool disallowPartner)
        {
            if ((sim == null) || (sim.Household == null))
            {
                stats.IncStat("Invalid Sim");
                return(new List <SimDescription>());
            }

            List <Relationship> relations = new List <Relationship>(Relationship.GetRelationships(sim));

            if (relations.Count == 0)
            {
                stats.IncStat("None");
                return(new List <SimDescription>());
            }

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

            stats.AddStat("Relations", relations.Count);

            foreach (Relationship relation in relations)
            {
                SimDescription other = relation.GetOtherSimDescription(sim);
                if (other == null)
                {
                    stats.IncStat("Bad Link");
                    continue;
                }

                stats.IncStat(other.FullName, Common.DebugLevel.Logging);

                if (relation.LTR.Liking <= 0)
                {
                    stats.AddStat("Unliked", relation.LTR.Liking);
                }
                else if (!relation.AreRomantic())
                {
                    stats.IncStat("No Romantic");
                }
                else if ((disallowPartner) && (sim.Partner == other))
                {
                    stats.IncStat("Partner");
                }
                else if (SimTypes.IsDead(other))
                {
                    stats.IncStat("Dead");
                }
                else if (Situations.IsBusy(stats, other, true))
                {
                    stats.IncStat("Other Busy");
                }
                else if (!mFlirtPool.Contains(other))
                {
                    stats.IncStat("Not Pool");
                }
                else if (!Allow(stats, sim, other))
                {
                    stats.IncStat("User Denied");
                }
                else if (other.Household == null)
                {
                    stats.IncStat("Invalid Sim");
                }
                else if ((SimTypes.IsSpecial(sim)) && (SimTypes.IsSpecial(other)))
                {
                    stats.IncStat("Both Special");
                }
                else if (IsActiveInvolved(other))
                {
                    stats.IncStat("Other Active Involved");
                }
                else
                {
                    list.Add(other);
                }

                Main.Sleep("ManagerFlirt:FindExistingFor");
            }

            return(list);
        }