namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

/// <summary>
/// If an infatuated Pokémon attempts to use a move, it will fail 50% of the time, even when targeting Pokémon other than
/// the one it is infatuated with. This failed move does not spend PP. 
/// </summary>
/// <remarks>
/// Infatuation is caused when Attract is used on a target of the opposite gender, G-Max Cuddle is used by Gigantamax Eevee
/// on all opponents of the opposite gender, may be caused when a Pokémon makes contact with a Pokémon of the opposite
/// gender that has Cute Charm as its Ability, and is caused to a Pokémon that infatuates a Pokémon holding a Destiny Knot. 
/// </remarks>
[Script(ScriptCategory.Pokemon, "infatuated")]
public class Infatuated : Script, IScriptPreventMove
{
    /// <inheritdoc />
    public void PreventMove(IExecutingMove move, ref bool prevent)
    {
        if (move.User.BattleData?.Battle.Random.GetBool() == true)
            prevent = true;
    }
}