using PkmnLib.Plugin.Gen7.Scripts.Pokemon;

namespace PkmnLib.Plugin.Gen7.Scripts.Side;

[Script(ScriptCategory.Side, "safe_guard")]
public class SafeguardEffect : Script, IScriptPreventStatusChange, IScriptPreventVolatileAdd
{
    /// <inheritdoc />
    public void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted, ref bool preventStatus)
    {
        preventStatus = true;
    }

    /// <inheritdoc />
    public void PreventVolatileAdd(IScriptSource parent, Script script, ref bool preventVolatileAdd)
    {
        if (script.Category == ScriptCategory.Pokemon && script.Name == ScriptUtils.ResolveName<Confusion>())
            preventVolatileAdd = true;
    }
}