Esempio n. 1
0
        internal static (Perception, Reaction) FromFirstImpression(PersonalityTraits other, Perception globalPerceptions, ushort verbID, ushort targetID, bool notTarget, float verbIntensity, TraitsVector reactorTraits)
        {
            // personaliy vs circumstance
            var perceptions = new Perception(other, 1 - verbIntensity);

            perceptions.Blend(globalPerceptions, 0.75f);
            perceptions.CircumferentialValues = globalPerceptions.CircumferentialValues;
            ++perceptions.TotalPerceptions;
            ++globalPerceptions.TotalPerceptions;
            //perceptions._personalFirstImpression = !notTarget;
            //perceptions._firstImpressionIntensity = verbIntensity;

            ObservedVerb verb         = new ObservedVerb(verbID);
            var          actionTraits = verb.GetTraits().ApplyMagnitude(verbIntensity);

            perceptions.AddVector(actionTraits);

            return(
                perceptions,
                new Reaction(
                    (reactorTraits - actionTraits).SumToBounded(),
                    (perceptions - actionTraits).SumToBounded(),
                    actionTraits,
                    1f,
                    verbIntensity
                    )
                );
        }
Esempio n. 2
0
        internal Reaction ObserveVerb(ushort verbID, VerbTargetInfo target, TraitsVector reactorTraits, float verbIntensity)
        {
            IVerb verbTraits = null;

            if (ObservedActions.TryGetValue(verbID, out ObservedVerb verb))
            {
                verbTraits = verb.GetTraits();
                ObservedActions[verbID] = verb;
            }
            else
            {
                verb       = new ObservedVerb(verbID);
                verbTraits = verb.GetTraits();
                ObservedActions.Add(verbID, verb);
            }

            if (!verb.HitLimit)
            {
                ++TotalPerceptions;
                // could also be used to represent desensitization to violence
                float magnitude = (1.0f / verb.NumberOfTimes) * (1 - verbIntensity);
                //TraitsVector thisTraits = this;
                AddVector(verbTraits.ApplyMagnitude(magnitude));


                if (verbTraits.VerbType == VerbType.None)
                {
                    AddVector(verbTraits.ApplyMagnitude(magnitude));
                }
                else if (verb)
                {
                }

                return(new Reaction(
                           (reactorTraits - verbTraits).SumToBounded().Suppress(1 - magnitude),
                           ((TraitsVector)this - verbTraits).SumToBounded().Suppress(1 - magnitude),
                           verbTraits,
                           magnitude,
                           verbIntensity
                           ));
            }
            else
            {
                return(null);
            }
        }