using System;
using Decimation.Content.Items.Weapons;
using Decimation.Lib.Items;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Decimation.Content.Projectiles
{
   internal class BloodClot : DecimationProjectile
    {
        protected override void Init()
        {
            projectile.width = 24;
            projectile.height = 24;
            Damages = 22;
            DamageType = DecimationWeapon.DamageType.Ranged;
            projectile.tileCollide = true;
            projectile.knockBack = 7f;
            projectile.aiStyle = -1;
            projectile.penetrate = 1;
            projectile.timeLeft = 600;
            projectile.hostile = true;
        }

        public override void AI()
        {
            projectile.velocity.Y += (600 - projectile.timeLeft) * 0.002f;

            Dust.NewDust(projectile.position, 26, 26, DustID.SomethingRed);
        }

        public override bool OnTileCollide(Vector2 oldVelocity)
        {
            for (int i = 0; i < projectile.width; i++)
            {
                for (int j = 0; j < projectile.height; j++)
                {
                    Dust.NewDust(new Vector2(projectile.position.X + i, projectile.position.Y + j), projectile.width, projectile.height, DustID.Blood);
                }
            }

            Main.PlaySound(SoundID.NPCDeath1, projectile.Center);

            return true;
        }
    }
}
