feat(config): add Freeplay config section (default off)

Adds FreeplayConfig [ConfigSection("Freeplay")] with Enabled=false,
CurrencyAmount=99999, CardCopies=3, and ShippedDefaults(). Covered by
FreeplayConfigTests verifying the tier-chain resolves shipped defaults.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-29 13:25:47 -04:00
parent 76aad36e84
commit 7b5edb7c65
2 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
namespace SVSim.Database.Models.Config;
/// <summary>
/// Global "freeplay" toggle. When <see cref="Enabled"/>, every viewer is treated (in logic,
/// never in the DB) as owning all cards (<see cref="CardCopies"/> each), all cosmetics, and
/// <see cref="CurrencyAmount"/> of Crystal/Rupee/Red-Ether. See
/// docs/superpowers/specs/2026-05-29-freeplay-mode-design.md.
/// </summary>
[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();
}

View File

@@ -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<SVSimDbContext>();
var svc = new GameConfigService(db, new ConfigurationBuilder().Build());
var cfg = svc.Get<FreeplayConfig>();
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));
}
}