Exemple #1
0
 public void Import(Persistence.Lookup settings)
 {
     mKey = new MotiveKey(
         settings.GetEnum<CASAgeGenderFlags>("AgeSpecies", CASAgeGenderFlags.None),
         settings.GetEnum<OccultTypes>("Occult", OccultTypes.None),
         settings.GetEnum<CommodityKind>("Commodity", CommodityKind.None)
     );
     mValue = settings.GetFloat("Value", 1);
 }
Exemple #2
0
 public void Import(Persistence.Lookup settings)
 {
     mKey = new MotiveKey(
         settings.GetEnum <CASAgeGenderFlags>("AgeSpecies", CASAgeGenderFlags.None),
         settings.GetEnum <OccultTypes>("Occult", OccultTypes.None),
         settings.GetEnum <CommodityKind>("Commodity", CommodityKind.None)
         );
     mValue = settings.GetFloat("Value", 1);
 }
 public void SetMotiveFactor(MotiveKey key, float factor)
 {
     key.SetMotiveFactor(mMotiveDeltasV2, factor);
 }
        public float GetMotiveFactor(MotiveKey key, bool relative, out bool exactMatch)
        {
            float multiple = key.GetMotiveFactor(mMotiveDeltasV2, out exactMatch);

            if ((relative) && (mRelativeMotives.ContainsKey(key.mKind)))
            {
                multiple *= sRelativeFactor;
            }

            if (multiple < 0)
            {
                multiple = 0;
            }

            return multiple;
        }
 public float GetMotiveFactor(MotiveKey key, bool relative)
 {
     bool exactMatch;
     return GetMotiveFactor(key, relative, out exactMatch);
 }
        public float GetMotiveDecayFactor(MotiveKey key, out bool exactMatch)
        {
            float multiple = key.GetMotiveFactor(mMotiveDecayDeltasV2, out exactMatch);

            /*
            if ((relative) && (mRelativeDecayMotives.ContainsKey(kind)))
            {
                multiple *= sRelativeFactor;
            }
            */
            if (multiple < 0)
            {
                multiple = 0;
            }

            return multiple;
        }
 public float GetMotiveDecayFactor(MotiveKey key)
 {
     bool exactMatch;
     return GetMotiveDecayFactor(key, out exactMatch);
 }
        public void EnsureBaseMotives()
        {
            foreach (CommodityKind kind in TuningAlterations.sCommodities)
            {
                MotiveKey key = new MotiveKey(kind);

                bool exactMatch;
                GetMotiveFactor(key, false, out exactMatch);
                if (!exactMatch)
                {
                    SetMotiveFactor(key, 1f);
                }

                GetMotiveDecayFactor(key, out exactMatch);
                if (!exactMatch)
                {
                    SetMotiveDecayFactor(key, 1f);
                }
            }
        }
Exemple #9
0
        public static float ScoreMotiveTuning(MotiveTuning tuning, MotiveKey key)
        {
            float             num = 0f;
            CASAgeGenderFlags speciesSpecificity = tuning.SpeciesSpecificity;

            if (speciesSpecificity != CASAgeGenderFlags.None)
            {
                CASAgeGenderFlags species = key.mAgeSpecies & CASAgeGenderFlags.SpeciesMask;
                if (species == CASAgeGenderFlags.None)
                {
                    species = CASAgeGenderFlags.Human;
                }

                if (species != speciesSpecificity)
                {
                    return(float.MinValue);
                }

                num += Sim.kMotiveTuningScoreForSpecies;
            }

            CASAgeGenderFlags ageSpecificity = tuning.AgeSpecificity;

            if (ageSpecificity != CASAgeGenderFlags.AgeMask)
            {
                if ((key.mAgeSpecies & ageSpecificity) == CASAgeGenderFlags.None)
                {
                    return(float.MinValue);
                }

                num += Sim.kMotiveTuningScoreForAge;
            }

            if (tuning.TraitSpecificity != null)
            {
                OccultTypes occult = OccultTypes.None;

                bool flag = true;
                foreach (TraitNames names in tuning.TraitSpecificity)
                {
                    occult = OccultTypeHelper.OccultFromTrait(names);
                    if (occult != key.mOccult)
                    {
                        flag = false;
                        break;
                    }
                }

                if (flag)
                {
                    num += Sim.kMotiveTuningScoreForTrait * tuning.TraitSpecificity.Count;
                }
                else
                {
                    return(float.MinValue);
                }
            }

            if (tuning.WorldRestrictionType == WorldRestrictionType.Allow)
            {
                if (!tuning.WorldRestrictionWorldTypes.Contains(GameUtils.GetCurrentWorldType()) && !tuning.WorldRestrictionWorldNames.Contains(GameUtils.GetCurrentWorld()))
                {
                    return(float.MinValue);
                }
                num += Sim.kMotiveTuningScoreForWorld;
            }

            if (tuning.WorldRestrictionType != WorldRestrictionType.Disallow)
            {
                return(num);
            }

            if (tuning.WorldRestrictionWorldTypes.Contains(GameUtils.GetCurrentWorldType()) || tuning.WorldRestrictionWorldNames.Contains(GameUtils.GetCurrentWorld()))
            {
                return(float.MinValue);
            }

            return(num + Sim.kMotiveTuningScoreForWorld);
        }
Exemple #10
0
 public MotiveKeyValue(MotiveKey key, float value)
 {
     mKey = key;
     mValue = value;
 }
Exemple #11
0
 public MotiveKeyValue(MotiveKey key, float value)
 {
     mKey   = key;
     mValue = value;
 }
Exemple #12
0
        public static float ScoreMotiveTuning(MotiveTuning tuning, MotiveKey key)
        {
            float num = 0f;
            CASAgeGenderFlags speciesSpecificity = tuning.SpeciesSpecificity;
            if (speciesSpecificity != CASAgeGenderFlags.None)
            {
                CASAgeGenderFlags species = key.mAgeSpecies & CASAgeGenderFlags.SpeciesMask;
                if (species == CASAgeGenderFlags.None)
                {
                    species = CASAgeGenderFlags.Human;
                }

                if (species != speciesSpecificity)
                {
                    return float.MinValue;
                }

                num += Sim.kMotiveTuningScoreForSpecies;
            }

            CASAgeGenderFlags ageSpecificity = tuning.AgeSpecificity;
            if (ageSpecificity != CASAgeGenderFlags.AgeMask)
            {
                if ((key.mAgeSpecies & ageSpecificity) == CASAgeGenderFlags.None)
                {
                    return float.MinValue;
                }

                num += Sim.kMotiveTuningScoreForAge;
            }

            if (tuning.TraitSpecificity != null)
            {
                OccultTypes occult = OccultTypes.None;

                bool flag = true;
                foreach (TraitNames names in tuning.TraitSpecificity)
                {
                    occult = OccultTypeHelper.OccultFromTrait(names);
                    if (occult != key.mOccult)
                    {
                        flag = false;
                        break;
                    }
                }

                if (flag)
                {
                    num += Sim.kMotiveTuningScoreForTrait * tuning.TraitSpecificity.Count;
                }
                else
                {
                    return float.MinValue;
                }
            }

            if (tuning.WorldRestrictionType == WorldRestrictionType.Allow)
            {
                if (!tuning.WorldRestrictionWorldTypes.Contains(GameUtils.GetCurrentWorldType()) && !tuning.WorldRestrictionWorldNames.Contains(GameUtils.GetCurrentWorld()))
                {
                    return float.MinValue;
                }
                num += Sim.kMotiveTuningScoreForWorld;
            }

            if (tuning.WorldRestrictionType != WorldRestrictionType.Disallow)
            {
                return num;
            }

            if (tuning.WorldRestrictionWorldTypes.Contains(GameUtils.GetCurrentWorldType()) || tuning.WorldRestrictionWorldNames.Contains(GameUtils.GetCurrentWorld()))
            {
                return float.MinValue;
            }

            return (num + Sim.kMotiveTuningScoreForWorld);
        }