using PkmnLib.Plugin.Gen7.Scripts.Status;

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Merciless is an ability that always results in critical hits against poisoned targets.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Merciless_(Ability)">Bulbapedia - Merciless</see>
/// </summary>
[Script(ScriptCategory.Ability, "merciless")]
public class Merciless : Script, IScriptChangeCriticalStage
{
    /// <inheritdoc />
    public void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
    {
        if (target.StatusScript.Script?.Name == ScriptUtils.ResolveName<Poisoned>() ||
            target.StatusScript.Script?.Name == ScriptUtils.ResolveName<BadlyPoisoned>())
        {
            stage = 100;
        }
    }
}