Add DPS calculations and columns to WeaponTable
Introduced new methods in `EntityWeaponModel` to calculate DPS for normal, light, medium, and heavy damage types. Updated `WeaponTable.razor` to display these new DPS values as additional columns for better weapon performance insights. Also fixed missing initialization of the base `Damage` property in test data.
This commit is contained in:
@@ -6,6 +6,12 @@
|
|||||||
<PropertyColumn Property="x => x.Range" Title="Range"/>
|
<PropertyColumn Property="x => x.Range" Title="Range"/>
|
||||||
<PropertyColumn Property="x => x.Damage" Title="Damage"/>
|
<PropertyColumn Property="x => x.Damage" Title="Damage"/>
|
||||||
<PropertyColumn Property="x => x.AttacksPerSecond" Title="Attacks Per Second"/>
|
<PropertyColumn Property="x => x.AttacksPerSecond" Title="Attacks Per Second"/>
|
||||||
|
<PropertyColumn Property="x => x.DamagePerSecond()" Title="DPS"/>
|
||||||
|
<PropertyColumn Property="x => x.DamagePerSecondLight()" Title="DPS (Light)"/>
|
||||||
|
<PropertyColumn Property="x => x.DamagePerSecondMedium()" Title="DPS (Medium)"/>
|
||||||
|
<PropertyColumn Property="x => x.DamagePerSecondHeavy()" Title="DPS (Heavy)"/>
|
||||||
|
|
||||||
|
|
||||||
<PropertyColumn Property="x => x.Parent.GetName()" Title="Owner Name"/>
|
<PropertyColumn Property="x => x.Parent.GetName()" Title="Owner Name"/>
|
||||||
|
|
||||||
<PropertyColumn Property="x => x.Parent.GetFaction()" Title="Faction"/>
|
<PropertyColumn Property="x => x.Parent.GetFaction()" Title="Faction"/>
|
||||||
|
|||||||
@@ -1376,7 +1376,7 @@ public class DATA
|
|||||||
.AddPart(new EntityMovementModel { Speed = 532, Movement = MovementType.Air })
|
.AddPart(new EntityMovementModel { Speed = 532, Movement = MovementType.Air })
|
||||||
.AddPart(new EntityWeaponModel
|
.AddPart(new EntityWeaponModel
|
||||||
{
|
{
|
||||||
LightDamage = 100, MediumDamage = 130, HeavyDamage = 160, Range = 20, AttacksPerSecond = 1,
|
Damage = 100, LightDamage = 100, MediumDamage = 130, HeavyDamage = 160, Range = 20, AttacksPerSecond = 1,
|
||||||
Targets =
|
Targets =
|
||||||
TargetType.Air
|
TargetType.Air
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,6 +12,52 @@ public class EntityWeaponModel : IEntityPartInterface
|
|||||||
public float AttacksPerSecond { get; set; } = 0;
|
public float AttacksPerSecond { get; set; } = 0;
|
||||||
public float SecondsBetweenAttacks { get; set; } = 0;
|
public float SecondsBetweenAttacks { get; set; } = 0;
|
||||||
|
|
||||||
|
public float DamagePerSecond()
|
||||||
|
{
|
||||||
|
if (SecondsBetweenAttacks == 0)
|
||||||
|
{
|
||||||
|
return Damage * AttacksPerSecond;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Damage / SecondsBetweenAttacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float DamagePerSecondLight()
|
||||||
|
{
|
||||||
|
var damage = LightDamage != 0 ? LightDamage : Damage;
|
||||||
|
|
||||||
|
if (SecondsBetweenAttacks == 0)
|
||||||
|
{
|
||||||
|
return damage * AttacksPerSecond;
|
||||||
|
}
|
||||||
|
|
||||||
|
return damage / SecondsBetweenAttacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float DamagePerSecondMedium()
|
||||||
|
{
|
||||||
|
var damage = MediumDamage != 0 ? MediumDamage : Damage;
|
||||||
|
|
||||||
|
if (SecondsBetweenAttacks == 0)
|
||||||
|
{
|
||||||
|
return damage * AttacksPerSecond;
|
||||||
|
}
|
||||||
|
|
||||||
|
return damage / SecondsBetweenAttacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float DamagePerSecondHeavy()
|
||||||
|
{
|
||||||
|
var damage = HeavyDamage != 0 ? HeavyDamage : Damage;
|
||||||
|
|
||||||
|
if (SecondsBetweenAttacks == 0)
|
||||||
|
{
|
||||||
|
return damage * AttacksPerSecond;
|
||||||
|
}
|
||||||
|
|
||||||
|
return damage / SecondsBetweenAttacks;
|
||||||
|
}
|
||||||
|
|
||||||
public float Cooldown { get; set; } = 0;
|
public float Cooldown { get; set; } = 0;
|
||||||
public float Charges { get; set; } = 0;
|
public float Charges { get; set; } = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user