namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Fluffy is an ability that halves the damage taken from contact moves but doubles the damage taken from Fire-type moves.
/// This ability is exclusive to Stufful and Bewear.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Fluffy_(Ability)">Bulbapedia - Fluffy</see>
/// </summary>
[Script(ScriptCategory.Ability, "fluffy")]
public class Fluffy : Script, IScriptChangeDamageModifier
{
    /// <inheritdoc />
    public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
    {
        if (move.GetHitData(target, hit).Type?.Name == "fire")
        {
            modifier *= 2f;
        }
        if (move.GetHitData(target, hit).IsContact)
        {
            modifier *= 0.5f;
        }
    }
}