namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Grass Pelt is an ability that boosts Defense in Grassy Terrain.
/// This ability is exclusive to Gogoat.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Grass_Pelt_(Ability)">Bulbapedia - Grass Pelt</see>
/// </summary>
[Script(ScriptCategory.Ability, "grass_pelt")]
public class GrassPelt : Script, IScriptChangeIncomingMoveDefensiveStatValue
{
    /// <inheritdoc />
    public void ChangeIncomingMoveDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
        StatisticSet<uint> statisticSet, Statistic stat, ref uint value)
    {
        if (move.Battle.TerrainName == ScriptUtils.ResolveName<Terrain.GrassyTerrain>() && stat == Statistic.Defense)
            value = value.MultiplyOrMax(1.5f);
    }
}