using Decimation.Lib.Util;
using Terraria;

namespace Decimation.Lib.Items
{
    public abstract class DecimationAmmo : DecimationItem
    {
        protected abstract string Projectile { get; }
        protected abstract int Ammo { get; }
        protected virtual int Damages { get; set; } = 0;
        protected virtual bool VanillaProjectile { get; } = false;
        protected abstract void InitAmmo();

        protected sealed override void Init()
        {
            this.item.maxStack = 999;
            this.item.consumable = true;

            InitAmmo();

            this.item.damage = Damages;

            this.item.shoot = ItemUtils.GetIdFromName(this.Projectile, typeof(Terraria.Projectile), this.VanillaProjectile);
            this.item.ammo = this.Ammo;

            this.item.ranged = true;
        }
    }
}