diff --git a/SVSim.Database/Models/Config/FreeplayConfig.cs b/SVSim.Database/Models/Config/FreeplayConfig.cs new file mode 100644 index 0000000..9d26507 --- /dev/null +++ b/SVSim.Database/Models/Config/FreeplayConfig.cs @@ -0,0 +1,17 @@ +namespace SVSim.Database.Models.Config; + +/// +/// Global "freeplay" toggle. When , every viewer is treated (in logic, +/// never in the DB) as owning all cards ( each), all cosmetics, and +/// of Crystal/Rupee/Red-Ether. See +/// docs/superpowers/specs/2026-05-29-freeplay-mode-design.md. +/// +[ConfigSection("Freeplay")] +public class FreeplayConfig +{ + public bool Enabled { get; set; } = false; + public ulong CurrencyAmount { get; set; } = 99999; + public int CardCopies { get; set; } = 3; + + public static FreeplayConfig ShippedDefaults() => new(); +} diff --git a/SVSim.UnitTests/Services/FreeplayConfigTests.cs b/SVSim.UnitTests/Services/FreeplayConfigTests.cs new file mode 100644 index 0000000..60683a7 --- /dev/null +++ b/SVSim.UnitTests/Services/FreeplayConfigTests.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using SVSim.Database; +using SVSim.Database.Models.Config; +using SVSim.EmulatedEntrypoint.Services; +using SVSim.UnitTests.Infrastructure; + +namespace SVSim.UnitTests.Services; + +public class FreeplayConfigTests +{ + [Test] + public void Freeplay_defaults_to_disabled_with_canonical_amounts() + { + using var factory = new SVSimTestFactory(); + using var scope = factory.Services.CreateScope(); + var db = scope.ServiceProvider.GetRequiredService(); + var svc = new GameConfigService(db, new ConfigurationBuilder().Build()); + + var cfg = svc.Get(); + + Assert.That(cfg.Enabled, Is.False, "freeplay must be off unless explicitly enabled"); + Assert.That(cfg.CurrencyAmount, Is.EqualTo(99999UL)); + Assert.That(cfg.CardCopies, Is.EqualTo(3)); + } +}