...model fix

This commit is contained in:
2026-06-18 00:30:06 -04:00
parent 2a6bc4542e
commit 919754d284
2 changed files with 4 additions and 7 deletions
+3 -6
View File
@@ -8,12 +8,9 @@ public class CardData
public int? Attack { get; init; } public int? Attack { get; init; }
public int? Health { get; init; } public int? Health { get; init; }
public float StatEfficiency() public float StatEfficiency => Cost is > 0 && Attack is not null && Health is not null
{ ? MathF.Round((Health.Value + Attack.Value) / (float)Cost.Value, 2)
if(Cost == 0) return 0; : 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? Description { get; init; }
+1 -1
View File
@@ -32,7 +32,7 @@
<GridColumn Field="@nameof(CardData.Cost)" Title="Cost" Width="120px"/> <GridColumn Field="@nameof(CardData.Cost)" Title="Cost" Width="120px"/>
<GridColumn Field="@nameof(CardData.StatEfficiency)" Title="SE" Width="120px"> <GridColumn Field="@nameof(CardData.StatEfficiency)" Title="SE" Width="120px">
<Template> <Template>
@(((CardData)context).StatEfficiency()) @(((CardData)context).StatEfficiency)
</Template> </Template>
</GridColumn> </GridColumn>
<GridColumn Field="@nameof(CardData.Faction)" Title="Faction" Width="140px"/> <GridColumn Field="@nameof(CardData.Faction)" Title="Faction" Width="140px"/>