Adding StatEfficiency
This commit is contained in:
@@ -7,6 +7,15 @@ public class CardData
|
||||
public int? Cost { get; init; }
|
||||
public int? Attack { get; init; }
|
||||
public int? Health { get; init; }
|
||||
|
||||
public float StatEfficiency()
|
||||
{
|
||||
if(Cost == 0) return 0;
|
||||
if (Attack != null && Cost != null && Health != null) return MathF.Round((float)((Health + Attack) / (float)Cost),2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public string? Description { get; init; }
|
||||
public string? Faction { get; init; }
|
||||
public string? Set { get; init; }
|
||||
|
||||
@@ -3,18 +3,13 @@
|
||||
<PageTitle>Agents</PageTitle>
|
||||
|
||||
<div class="agents-page">
|
||||
<div class="agents-header">
|
||||
<h1>Agents</h1>
|
||||
<p class="text-secondary">@agents.Count agents in the database</p>
|
||||
</div>
|
||||
|
||||
<TelerikGrid Data="@agents"
|
||||
Sortable="true"
|
||||
FilterMode="@GridFilterMode.FilterRow"
|
||||
Pageable="true"
|
||||
PageSize="250"
|
||||
Resizable="true"
|
||||
Height="700px"
|
||||
Height="850px"
|
||||
class="agents-grid">
|
||||
<GridColumns>
|
||||
<GridColumn Field="@nameof(CardData.HasImmortalize)" Title="Im." Width="120px">
|
||||
@@ -35,6 +30,11 @@
|
||||
</Template>
|
||||
</GridColumn>
|
||||
<GridColumn Field="@nameof(CardData.Cost)" Title="Cost" Width="120px"/>
|
||||
<GridColumn Field="@nameof(CardData.StatEfficiency)" Title="SE" Width="120px">
|
||||
<Template>
|
||||
@(((CardData)context).StatEfficiency())
|
||||
</Template>
|
||||
</GridColumn>
|
||||
<GridColumn Field="@nameof(CardData.Faction)" Title="Faction" Width="140px"/>
|
||||
<GridColumn Field="@nameof(CardData.Attack)" Title="ATK" Width="120px"/>
|
||||
<GridColumn Field="@nameof(CardData.Health)" Title="HP" Width="120px"/>
|
||||
|
||||
Reference in New Issue
Block a user