diff --git a/SVSim.EmulatedEntrypoint/Program.cs b/SVSim.EmulatedEntrypoint/Program.cs index 193ee56..b6fb762 100644 --- a/SVSim.EmulatedEntrypoint/Program.cs +++ b/SVSim.EmulatedEntrypoint/Program.cs @@ -81,6 +81,7 @@ public class Program // in-process cache today; the IGameConfigService interface is shaped to allow one later. builder.Services.AddScoped(); builder.Services.AddScoped(); + builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); diff --git a/SVSim.EmulatedEntrypoint/Services/DbCardFoilLookup.cs b/SVSim.EmulatedEntrypoint/Services/DbCardFoilLookup.cs new file mode 100644 index 0000000..d92e1ed --- /dev/null +++ b/SVSim.EmulatedEntrypoint/Services/DbCardFoilLookup.cs @@ -0,0 +1,13 @@ +using SVSim.Database; +using SVSim.Database.Models; + +namespace SVSim.EmulatedEntrypoint.Services; + +public class DbCardFoilLookup : ICardFoilLookup +{ + private readonly SVSimDbContext _db; + public DbCardFoilLookup(SVSimDbContext db) { _db = db; } + + public ShadowverseCardEntry? TryGetFoilTwin(long baseCardId) => + _db.Cards.FirstOrDefault(c => c.Id == baseCardId + 1 && c.IsFoil); +} diff --git a/SVSim.EmulatedEntrypoint/Services/ICardFoilLookup.cs b/SVSim.EmulatedEntrypoint/Services/ICardFoilLookup.cs new file mode 100644 index 0000000..dbac013 --- /dev/null +++ b/SVSim.EmulatedEntrypoint/Services/ICardFoilLookup.cs @@ -0,0 +1,13 @@ +using SVSim.Database.Models; + +namespace SVSim.EmulatedEntrypoint.Services; + +/// +/// Looks up the foil printing of a card. The card-master convention is foil_id = base_id + 1 +/// with the IsFoil flag set; leader-card / alt-art printings typically have no foil twin +/// (TryGetFoilTwin returns null and the sampler silently keeps the base). +/// +public interface ICardFoilLookup +{ + ShadowverseCardEntry? TryGetFoilTwin(long baseCardId); +}