using Microsoft.Extensions.Options; using NeonSprawl.Server.Game.Npc; using NeonSprawl.Server.Game.PositionState; namespace NeonSprawl.Server.Game.Combat; /// Dev-only route to reset prototype combat dummy HP for Bruno and manual QA (NEO-83). public static class CombatTargetFixtureApi { public static WebApplication MapCombatTargetFixtureApi(this WebApplication app) { app.MapPost( "/game/__dev/combat-targets-fixture", ( CombatTargetFixtureRequest? body, ICombatEntityHealthStore healthStore, IThreatStateStore threatStore, INpcRuntimeStateStore runtimeStore, IPlayerCombatHealthStore playerHealthStore, IOptions gameOptions) => { if (body is null || body.SchemaVersion != CombatTargetFixtureRequest.CurrentSchemaVersion) { return Results.BadRequest(); } foreach (var id in PrototypeNpcRegistry.GetInstanceIdsInOrder()) { if (!healthStore.TryResetToFull(id, out _)) { return Results.NotFound(); } } AggroOperations.ClearAllPrototypeHolders(threatStore); NpcRuntimeOperations.ResetAllPrototypeRows(runtimeStore); var devPlayerId = gameOptions.Value.DevPlayerId; if (!playerHealthStore.TryResetToFull(devPlayerId, out _)) { return Results.NotFound(); } return Results.Json( new CombatTargetFixtureResponse { Applied = true, }); }); return app; } }