namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Normalize is an ability that changes all moves used by the Pokémon to Normal type.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Normalize_(Ability)">Bulbapedia - Normalize</see>
/// </summary>
[Script(ScriptCategory.Ability, "normalize")]
public class Normalize : Script, IScriptChangeMoveType, IScriptChangeBasePower
{
    /// <inheritdoc />
    public void ChangeMoveType(IExecutingMove move, IPokemon target, byte hit, ref TypeIdentifier? typeIdentifier)
    {
        if (move.Battle.Library.StaticLibrary.Types.TryGetTypeIdentifier("normal", out var normalType))
            typeIdentifier = normalType;
    }

    /// <inheritdoc />
    public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
    {
        if (move.GetHitData(target, hit).Type?.Name == "normal")
            basePower = (ushort)(basePower * 1.2f); // Boost Normal-type moves by 30%
    }
}