Files
ChronoCCG/Chrono/Web/Models/CardData.cs
T

38 lines
1.8 KiB
C#

using System.Text.Json.Serialization;
namespace Web.Models;
public class CardCatalog
{
[JsonPropertyName("cards")]
public List<CardData> Cards { get; set; } = [];
}
public class CardData
{
[JsonPropertyName("name")] public string Name { get; set; } = "";
[JsonPropertyName("category")] public string Category { get; set; } = "";
[JsonPropertyName("cost")] public int? Cost { get; set; }
[JsonPropertyName("attack")] public int? Attack { get; set; }
[JsonPropertyName("health")] public int? Health { get; set; }
[JsonPropertyName("description")] public string? Description { get; set; }
[JsonPropertyName("faction")] public string? Faction { get; set; }
[JsonPropertyName("set")] public string? Set { get; set; }
[JsonPropertyName("speed")] public string? Speed { get; set; }
[JsonPropertyName("archetypes")] public List<string>? Archetypes { get; set; }
[JsonPropertyName("immortalizeTo")] public List<string>? ImmortalizeTo { get; set; }
[JsonPropertyName("immortalizeFrom")] public string? ImmortalizeFrom { get; set; }
[JsonPropertyName("immortalizeWhen")] public string? ImmortalizeWhen { get; set; }
[JsonPropertyName("imageFile")] public string? ImageFile { get; set; }
public bool IsAgent => Category == "Agent";
public bool IsSpell => Category == "Spell";
public bool IsToken => Category == "Token";
public string? CostDisplay => Cost?.ToString();
public string? AttackDisplay => Attack.HasValue ? Attack.Value.ToString() : null;
public string? HealthDisplay => Health.HasValue ? Health.Value.ToString() : null;
public bool HasImmortalize => ImmortalizeTo is { Count: > 0 };
public bool IsImmortalized => ImmortalizeFrom != null;
public string ImagePath => $"cards/{ImageFile ?? "placeholder.png"}";
}