Exemple #1
0
        protected override bool EvaluateNode(PerceivedEvent perceivedEvent, Memory memory, CharacterTraits traits)
        {
            if (!CharacterHasPersonalValue(PersonalValues.Faith, traits))
            {
                return(false);
            }

            if (memory.HaveIDoneSomethingUnforgivable())
            {
                var unforgivenTestResult = new NodeTestInfo
                {
                    TestedCharacteristic = CharacteristicType.Memory,
                    CharacteristicName   = "PastActions",
                    Result      = true,
                    Description = "Conditional on:Value(Faith)"
                };
                DataToMemorize.Add(unforgivenTestResult);

                return(true);
            }

            var myTestResult = new NodeTestInfo
            {
                TestedCharacteristic = CharacteristicType.Karma,
                CharacteristicName   = "Karma",
                AttributeValue       = memory.MyKarmaScore,
                PassingValue         = -5,
                Result      = memory.MyKarmaScore < -5, //this is the test
                Description = "Conditional on:Value(Faith)"
            };

            DataToMemorize.Add(myTestResult);

            return(myTestResult.Result);
        }
        /// <summary>
        /// Takes the value of an value and check if it is greater or equal than a specified value
        /// </summary>
        /// <param name="attributeValue">Value of the value to be tested</param>
        /// <param name="setValue">value to test against</param>
        /// <param name="description">description of the test params</param>
        /// <param name="characteristicName"></param>
        /// <param name="characteristic"></param>
        /// <param name="modifier">value, if any, that modified the value of the value tested</param>
        /// <returns></returns>
        protected bool TestAttributeGreaterOrEqualThanSetValue(int attributeValue, int setValue, string description, string characteristicName, CharacteristicType characteristic, int modifier = 0)
        {
            var myTestResult = new NodeTestInfo
            {
                TestedCharacteristic = characteristic,
                CharacteristicName   = characteristicName,
                AttributeValue       = attributeValue,
                ProfileScore         = characteristic == CharacteristicType.Quality? EvaluateProfileScore(characteristicName, attributeValue) : 0,
                Result       = attributeValue + modifier >= setValue, //this is the test
                PassingValue = setValue,
                Description  = description,
                Modifier     = modifier
            };

            DataToMemorize.Add(myTestResult);

            return(myTestResult.Result);
        }
        protected bool CharacterHasPersonalValue(PersonalValues value, CharacterTraits traits, string description = "")
        {
            var myTestResult = new NodeTestInfo
            {
                TestedCharacteristic = CharacteristicType.Values,
                CharacteristicName   = value.ToString(),
                AttributeValue       = 0,
                ProfileScore         = IsValueArchetypal(value)? 0.1 : 0,
                Result       = traits.DoIPossessThisPersonalValue(value), //this is the test
                PassingValue = 1,
                Description  = description,
                Modifier     = 0
            };

            DataToMemorize.Add(myTestResult);

            return(myTestResult.Result);
        }
        /// <summary>
        /// Takes the value of an value and compares it against a random value
        /// </summary>
        /// <param name="attributeValue">Value of the value to be tested</param>
        /// <param name="description">description of the test params</param>
        /// <param name="characteristicName"></param>
        /// <param name="modifier">value, if any, that modified the value of the value tested</param>
        /// <returns></returns>
        protected bool TestAttributeAgainstRandomValue(int attributeValue, string description, string characteristicName, int modifier = 0)
        {
            int randomValue = RandomValueGenerator.GeneratePercentileIntegerValue();

            var myTestResult = new NodeTestInfo
            {
                TestedCharacteristic = CharacteristicType.Quality,
                CharacteristicName   = characteristicName,
                AttributeValue       = attributeValue,
                ProfileScore         = EvaluateProfileScore(characteristicName, attributeValue),
                Result       = attributeValue + modifier >= randomValue, //this is the test
                PassingValue = randomValue,
                Description  = description,
                Modifier     = modifier
            };

            DataToMemorize.Add(myTestResult);

            return(myTestResult.Result);
        }
Exemple #5
0
        protected override bool EvaluateNode(PerceivedEvent perceivedEvent, Memory memory, CharacterTraits traits)
        {   //TODO: rethink
            //Emotional, sad.
            var myTestResult = new NodeTestInfo
            {
                TestedCharacteristic = CharacteristicType.Emotion,
                CharacteristicName   = "Sadness",
                AttributeValue       = traits.ShortTermEmotions.Sadness,
                PassingValue         = 25,
                Result      = traits.ShortTermEmotions.Sadness >= 25, //this is the test
                Description = string.Empty
            };

            if (myTestResult.Result)
            {
                DataToMemorize.Add(myTestResult);
                return(true);
            }

            if (traits.Selflessness > traits.Compassion)
            {
                //Automatic failure: not enough compassion
                if (traits.Compassion <= ConfiguredPassFailValue)
                {
                    return(TestAttributeSmallerOrEqualThanSetValue(traits.Compassion, ConfiguredPassFailValue, "AutomaticFailure", Qualities.Compassion.ToString()));
                }
                else
                //Automatic failure: too selfish
                if (traits.Selflessness <= ConfiguredPassFailValue)
                {
                    return(TestAttributeSmallerOrEqualThanSetValue(traits.Selflessness, ConfiguredPassFailValue, "AutomaticFailure", Qualities.Selflessness.ToString()));
                }
            }

            return(true);
        }