53 lines
1.9 KiB
C#
53 lines
1.9 KiB
C#
namespace ZenithInfo.Models
|
|
{
|
|
public class Spinal
|
|
{
|
|
public string Name { get; set; }
|
|
public double Damage { get; set; }
|
|
public double Reload { get; set; }
|
|
public double Range { get; set; }
|
|
public SpinalTypes Type { get; set; }
|
|
public DamageTypes DamageType { get; set; }
|
|
public ModuleSizes Size { get; set; }
|
|
public double Velocity { get; set; }
|
|
public double Interval { get; set; }
|
|
public int Icon { get; set; }
|
|
public double ParticleSize { get; set; }
|
|
public double BaseCost { get; set; }
|
|
public string? Rarity { get; set; }
|
|
|
|
public DamageStats Dps(int range: 0, int barrelCount: 1)
|
|
{
|
|
if (range > this.Range)
|
|
{
|
|
return new DamageStats(0, 0, 0, 0, 0, 0);
|
|
}
|
|
|
|
double baseAlpha = this.Damage * barrelCount;
|
|
double shieldAlpha = 0;
|
|
double hullAlpha = 0;
|
|
|
|
double intervalTime = this.Interval * (barrelCount - 1);
|
|
double totalDelay = this.Reload + intervalTime;
|
|
double baseDps = baseAlpha / (totalDelay != 0 ? totalDelay : 1); // prevent divide by zero
|
|
double shieldDps = 0;
|
|
double hullDps = 0;
|
|
|
|
if (this.DamageType == DamageTypes.Shield) {
|
|
shieldAlpha = baseAlpha;
|
|
hullAlpha = baseAlpha * 0.5;
|
|
shieldDps = baseDps;
|
|
hullDps = baseDps * 0.5;
|
|
} else if (this.DamageType == DamageTypes.Hull) {
|
|
shieldAlpha = baseAlpha * 0.5;
|
|
hullAlpha = baseAlpha;
|
|
shieldDps = baseDps * 0.5;
|
|
hullDps = baseDps;
|
|
}
|
|
|
|
double averageDps = (shieldDps + hullDps) / 2;
|
|
double averageAlpha = (shieldAlpha + hullAlpha) / 2;
|
|
return new DamageStats(averageDps, shieldDps, hullDps, averageAlpha, shieldAlpha, hullAlpha);
|
|
}
|
|
}
|
|
}
|