namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Rough Skin is an ability that damages attackers using contact moves.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Rough_Skin_(Ability)">Bulbapedia - Rough Skin</see>
/// </summary>
[Script(ScriptCategory.Ability, "rough_skin")]
public class RoughSkin : 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);
        }
    }
}