using System;
using PkmnLibSharp.Utilities;

namespace PkmnLibSharp.Battling
{
    public class BattleRandom : PointerWrapper
    {
        public BattleRandom() : base(Creaturelib.Generated.BattleRandom.Construct())
        {}
        public BattleRandom(ulong seed) : base(Creaturelib.Generated.BattleRandom.ConstructWithSeed(seed))
        {}
        
        internal BattleRandom(IntPtr ptr) : base(ptr){}

        public ulong Seed => Creaturelib.Generated.BattleRandom.GetSeed(Ptr);

        public bool EffectChance(float chance, ExecutingMove move,Pokemon target)
        {
            byte b = 0;
            Creaturelib.Generated.BattleRandom.EffectChance(ref b, Ptr, chance, move.Ptr, target.Ptr);
            return b == 1;
        }

        public int Get()
        {
            return Creaturelib.Generated.BattleRandom.Get(Ptr);
        }
        public int Get(int max)
        {
            return Creaturelib.Generated.BattleRandom.GetMax(Ptr, max);
        }
        public int Get(int min, int max)
        {
            return Creaturelib.Generated.BattleRandom.GetMinMax(Ptr, min, max);
        }
        
        protected override void DeletePtr()
        {
            Creaturelib.Generated.BattleRandom.Destruct(Ptr);
        }
    }
}