Esempio n. 1
0
        /// <summary>
        /// Add to the modifier value for this frame only.
        /// </summary>
        /// <param name="property">Which property of the stat?</param>
        /// <param name="value">How much to add. Can be negative.</param>
        public virtual void AddToMod(StatProperty property, float value)
        {
            switch (property)
            {
            case StatProperty.Value:
                _mActual += value;
                break;

            case StatProperty.Base:
                _mBase += value;
                break;

            case StatProperty.Min:
                _mMin += value;
                break;

            case StatProperty.Max:
                _mMax += value;
                break;

            case StatProperty.Affinity:
                _mAffinity += value;
                break;

            case StatProperty.MaxAffinity:
                _mMaxAffinity += value;
                break;

            default: throw new ArgumentOutOfRangeException("property", property, null);
            }
        }
Esempio n. 2
0
        public virtual void SetRoot(StatProperty property, float value)
        {
            switch (property)
            {
            case StatProperty.Value:
                _rActual = Mathf.Clamp(value, _tMin, _tMax);
                break;

            case StatProperty.Base:
                _rBase = Mathf.Clamp(value, _tMin, _tMax);
                break;

            case StatProperty.Min:
                _rMin = value;
                break;

            case StatProperty.Max:
                _rMax = value;
                break;

            case StatProperty.Affinity:
                _rAffinity = value;
                break;

            case StatProperty.MaxAffinity:
                _rMaxAffinity = value;
                break;

            default: throw new ArgumentOutOfRangeException("property", property, null);
            }
        }
Esempio n. 3
0
        public StatModifier(string title, string description, StatType stat, StatModEffect effect, StatModType modType, StatProperty property, float value, float time, bool cumulative)
        {
            Title       = title;
            Description = description;

            TargetStat     = stat;
            TargetProperty = property;

            ModType       = modType;
            ModEffect     = effect;
            ModifierValue = value;
            ModifierTime  = time;

            Cumulative   = cumulative;
            _initialized = false;
        }
Esempio n. 4
0
        /// <summary>
        /// Get the value of modifiers on a property of this stat.
        /// </summary>
        /// <param name="property">Which property on this stat?</param>
        /// <returns>The total value of modifiers being applied to this stat and property.</returns>
        public virtual float GetMod(StatProperty property)
        {
            switch (property)
            {
            case StatProperty.Value:        return(_mActual);

            case StatProperty.Base:         return(_mBase);

            case StatProperty.Min:          return(_mMin);

            case StatProperty.Max:          return(_mMax);

            case StatProperty.Affinity:     return(_mAffinity);

            case StatProperty.MaxAffinity:  return(_mMaxAffinity);

            default: throw new ArgumentOutOfRangeException("property", property, null);
            }
        }
Esempio n. 5
0
 set => SetValue(StatProperty, value);
Esempio n. 6
0
 /// <summary>
 /// Multiply some value by a Stat. For example when applying damage, multiply the base damage by the caster's Strength stat.
 /// </summary>
 public static float ExampleValueMultByStat(float inValue, Stat stat, StatProperty property)
 {
     return(inValue * Mathf.Clamp(stat.Get(property) / 10, 1, 99999));
 }
Esempio n. 7
0
 public virtual bool AddToRoot(StatProperty property, float value)
 {
     SetRoot(property, GetRoot(property) + value);
     return(true);
 }