using Decimation.Lib.Util; using Terraria; namespace Decimation.Lib.Items { public abstract class DecimationWeapon : DecimationItem { protected virtual DamageType DamagesType { get; } = DamageType.Melee; protected virtual string Projectile { get; } = null; protected virtual string Ammo { get; } = null; protected virtual bool VanillaProjectile { get; } = false; protected virtual bool VanillaAmmo { get; } = false; protected abstract int Damages { get; } protected abstract void InitWeapon(); protected override void Init() { this.item.useStyle = 1; this.item.autoReuse = false; this.item.useTurn = true; this.item.maxStack = 1; switch (this.DamagesType) { case DamageType.Magic: this.item.magic = true; break; case DamageType.Ranged: this.item.ranged = true; break; case DamageType.Throw: this.item.thrown = true; break; default: this.item.melee = true; break; } InitWeapon(); this.item.damage = this.Damages; if (this.Projectile != null) this.item.shoot = ItemUtils.GetIdFromName(this.Projectile, typeof(Projectile), this.VanillaProjectile); if (this.Ammo != null) this.item.useAmmo = ItemUtils.GetIdFromName(this.Ammo, typeof(Item), this.VanillaAmmo); if (this.item.melee) this.item.noMelee = false; } public enum DamageType { Melee, Magic, Throw, Ranged } } }