Decimation_Mod/Lib/Items/DecimationWeapon.cs
FyloZ ec4585bed5 - Changed Bloodshot Eye's music to Boss 1 Orchestra ( https://www.youtube.com/watch?time_continue=120&v=r-9nKGc85FQ )
- Added support for animated projectiles
- Refactoring
- Removed useless fields
- Fixed swords not dealing damages
- Added Hour Hand (from Evie's PR)
2020-03-21 00:11:07 -04:00

61 lines
1.8 KiB
C#

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
}
}
}