Refactor WeaponStats and related classes to include attack speed, range, and damage type; update damage calculations for melee and ranged attacks
This commit is contained in:
@@ -22,7 +22,23 @@ namespace Weapons
|
||||
if (!(timer <= 0f)) return;
|
||||
|
||||
Fire();
|
||||
timer = 1f / character.attributes.AttackSpeed;
|
||||
timer = 1f / GetFinalAttackSpeed();
|
||||
}
|
||||
|
||||
private float GetFinalAttackSpeed()
|
||||
{
|
||||
return character.attributes.AttackSpeed * weaponStats.attackSpeed;
|
||||
}
|
||||
|
||||
protected float GetFinalDamage()
|
||||
{
|
||||
return weaponStats.damage + character.attributes.Damage *
|
||||
(weaponStats.damageType == DamageType.Melee ? character.attributes.MeleeDamage : character.attributes.RangedDamage);
|
||||
}
|
||||
|
||||
protected float GetFinalRange()
|
||||
{
|
||||
return weaponStats.range * character.attributes.AttackRange;
|
||||
}
|
||||
|
||||
public abstract void Fire();
|
||||
|
Reference in New Issue
Block a user