namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "cure_party_status")]
public class CurePartyStatus : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        var user = move.User;
        var battle = user.BattleData?.Battle;
        if (battle == null)
            return;
        var party = battle.Parties.FirstOrDefault(p => p.Party.Contains(user));
        if (party == null)
            return;
        foreach (var pokemon in party.Party.WhereNotNull())
        {
            pokemon.ClearStatus();
        }
    }
}