Пример #1
0
 /// <summary>
 /// Adds a personality effect to the batch.
 /// Personality effects will change the first impression that new relationships get seeded with.
 /// </summary>
 /// <param name="target">The person whose personality should change.</param>
 /// <param name="t">The trait of the personality that should change.</param>
 /// <param name="amount">How much the specified trait should change.</param>
 public void AddPersonalityEffect(Person target, Trait t, double amount)
 {
     Applied += delegate(object sender, RelationshipChangeEventArgs r)
     {
         Dictionary<Trait, double> qual = r.Relationship.Other.Qualities;
         if (!qual.ContainsKey(t))
             qual.Add(t, 0);
         qual[t] += amount;
     };
 }
Пример #2
0
 /// <summary>
 /// Adds a relationship trait change to the batch.
 /// </summary>
 /// <param name="t">The trait to change.</param>
 /// <param name="amount">How much the trait should change.</param>
 public void AddRelationshipChange(Trait t, double amount)
 {
     Applied += delegate(object sender, RelationshipChangeEventArgs r)
     {
         r.Relationship.Affect(t, amount);
     };
 }
Пример #3
0
        /// <summary>
        /// Gets the quality of a particular trait.
        /// </summary>
        /// <seealso cref="Relationship.Quality"/>
        /// <param name="t">The trait to query.</param>
        /// <returns>The trait quality. 
        /// Like relationship quality, this depends entirely on the scale of effects.</returns>
        public double GetTraitQuality(Trait t)
        {
            double shorttermquality = shorttermquality = impressions[t];
            double longtermquality = longtermquality = opinions[t];

            return (shorttermquality + (longtermquality * Ratio)) / (Ratio + 1.0);
        }
Пример #4
0
        /// <summary>
        /// Affect a particular aspect of a relationship.
        /// </summary>
        /// <param name="t">The trait to affect</param>
        /// <param name="change">
        /// How much to affect the trait. If the trait is negative, 
        /// a numerically positive change will have a harmful effect.
        /// </param>
        public void Affect(Trait t, double change)
        {
            double annoyancefactor = Owner.Annoyances[t];

            if (annoyancefactor >= 0)
                change *= annoyancefactor;
            else if (annoyancefactor < 0)
                change /= annoyancefactor;

            change = t.CalculateAmount(change);

            impressions[t] += change;
            opinions[t] += (change / Ratio);
        }