refactor(arena-tk2): FinishAsync returns RunFinishOutcome with WasFullClear signal

Introduces RunFinishOutcome — a semantic record that wraps the wire
FinishResponseDto with the controller-side WasFullClear signal used to fire
the challenge_full_clear mission event. The wire response isn't affected
(controller unwraps the .Response field before returning to the client);
RetireAsync stays returning FinishResponseDto because retire cannot full-clear.

Full-clear detection compares run.WinCount against ResolveMaxBattleCountAsync
rather than hard-coding 5, so a future TK2 rules-config change tracks
automatically. New test covers the full-clear signal explicitly.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-07-04 13:17:23 -04:00
parent f3c8b46469
commit 94622a526d
5 changed files with 56 additions and 8 deletions

View File

@@ -49,7 +49,11 @@ public class ArenaTwoPickController : SVSimController
public async Task<IActionResult> Finish([FromBody] FinishRequest _)
{
if (!TryGetViewerId(out var vid)) return Unauthorized();
return await GuardAsync(() => _svc.FinishAsync(vid));
return await GuardAsync(async () =>
{
var outcome = await _svc.FinishAsync(vid);
return outcome.Response;
});
}
private async Task<IActionResult> GuardAsync<T>(Func<Task<T>> action)