namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Marvel Scale is an ability that increases the Pokémon's Defense by 50% when it has a status condition.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Marvel_Scale_(Ability)">Bulbapedia - Marvel Scale</see>
/// </summary>
[Script(ScriptCategory.Ability, "marvel_scale")]
public class MarvelScale : Script, IScriptChangeIncomingMoveDefensiveStatValue
{
    /// <inheritdoc />
    public void ChangeIncomingMoveDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
        StatisticSet<uint> statisticSet, Statistic stat, ref uint value)
    {
        if (!target.StatusScript.IsEmpty && stat == Statistic.Defense)
        {
            value = value.MultiplyOrMax(1.5f);
        }
    }
}