using System;
using PkmnLibSharp.Utilities;

namespace PkmnLibSharp.Battling
{
    public class DamageLibrary : PointerWrapper
    {
        internal DamageLibrary(IntPtr ptr) : base(ptr)
        {
        }
        public DamageLibrary() : base(Pkmnlib.Generated.DamageLibrary.Construct())
        {
        }

        public uint GetDamage(IntPtr attack, Pokemon target, byte hitIndex, IntPtr hitData)
        {
            uint val = 0;
            Creaturelib.Generated.DamageLibrary.GetDamage(ref val, Ptr, attack, target.Ptr, hitIndex, hitData)
                .Assert();
            return val;
        }

        public byte GetBasePower(IntPtr attack, Pokemon target, byte hitIndex, IntPtr hitData)
        {
            byte val = 0;
            Creaturelib.Generated.DamageLibrary.GetBasePower(ref val, Ptr, attack, target.Ptr, hitIndex, hitData)
                .Assert();
            return val;
        }

        public float GetStatModifier(IntPtr attack, Pokemon target, byte hitIndex, IntPtr hitData)
        {
            float val = 0;
            Creaturelib.Generated.DamageLibrary.GetStatModifier(ref val, Ptr, attack, target.Ptr, hitIndex, hitData)
                .Assert();
            return val;
        }

        public float GetDamageModifier(IntPtr attack, Pokemon target, byte hitIndex, IntPtr hitData)
        {
            float val = 0;
            Creaturelib.Generated.DamageLibrary
                .GetDamageModifier(ref val, Ptr, attack, target.Ptr, hitIndex, hitData)
                .Assert();
            return val;
        }


        protected override void DeletePtr()
        {
            Pkmnlib.Generated.DamageLibrary.Destruct(Ptr);
        }
    }
}