using System;
using Microsoft.Xna.Framework;

namespace Igdc.Drawables
{
    public class BattleEnemy : DrawableBase
    {
        public override Point Size { get; } = new Point(30, 27);

        public byte X;
        public byte Y;
        public int Health;
        public int ShootingChance;
        public int Texture;
        public Color Color = Color.White;
        public int Kind = Random.Next(0, 3);

        private static readonly Random Random = new Random();

        public BattleEnemy()
        {
            IdleAnimation = new AnimationDefenition
            {
                new AnimationFrame {Frame = new Point(Kind, 0), Length = 6},
                new AnimationFrame {Frame = new Point(Kind, 1), Length = 6},
            };
            IdleAnimationEnabled = true;
            for (var i = 0; i < Random.Next(0, 30); i++)
            {
                GetAnimationFrame();
            }
        }

        public void AnimateHit()
        {
            SetAnimation(new AnimationDefenition
            {
                new AnimationFrame {Frame = new Point(Kind, 13), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 12), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 11), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 10), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 09), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 08), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 07), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 06), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 05), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 04), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 03), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 02), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 01), Length = 2},
                new AnimationFrame {Frame = new Point(Kind, 00), Length = 2},
            });
        }
    }
}