namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Iron Barbs is an ability that damages attackers making contact with the Pokémon.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Iron_Barbs_(Ability)">Bulbapedia - Iron Barbs</see>
/// </summary>
[Script(ScriptCategory.Ability, "iron_barbs")]
public class IronBarbs : Script, IScriptOnIncomingHit
{
    /// <inheritdoc />
    public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
    {
        if (move.GetHitData(target, hit).IsContact)
        {
            move.User.Damage(move.User.MaxHealth / 8, DamageSource.Misc);
        }
    }
}