using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Framework.StatSystem
{
    /// <summary>
    /// Used to apply a scale modification to a <see cref="ModifiableVariable"/>
    /// often a <see cref="Stat"/>. Scales the variable by multiplying or dividing
    /// an factor.
    /// </summary>
    public class ScaleModifier : Modifierlike
    {
        public float factor; // The factor to scale by

        /// <summary>
        /// Initializes a new instance of the <see cref="ScaleModifier"/> class.
        /// </summary>
        /// <param name="factor">The factor.</param>
        public ScaleModifier(float factor)
        {
            this.factor = factor;
        }

        /// <summary>
        /// Gets the strength of this modifier.
        /// </summary>
        /// <returns></returns>
        public float GetStrength()
        {
            return this.factor;
        }

        /// <summary>
        /// Applies this modifier.
        /// </summary>
        /// <param name="stat">The stat.</param>
        /// <returns></returns>
        public float Apply(ModifiableVariable stat)
        {
            return stat.GetCurrentValue() + ((stat.GetBaseValue() * this.factor) - stat.GetBaseValue());
        }
    }
}
