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:
@@ -123,11 +123,24 @@ public class ArenaTwoPickServiceFinishTests
|
||||
var (db, svc, vid) = await SetupWithRunAsync(winCount: 0, lossCount: 5);
|
||||
await using var _ = db;
|
||||
|
||||
var dto = await svc.FinishAsync(vid);
|
||||
Assert.That(dto.Rewards.Single(r => r.RewardType == 9).RewardCount, Is.EqualTo(100));
|
||||
var outcome = await svc.FinishAsync(vid);
|
||||
Assert.That(outcome.Response.Rewards.Single(r => r.RewardType == 9).RewardCount, Is.EqualTo(100));
|
||||
Assert.That(outcome.WasFullClear, Is.False, "0W 5L is not a full clear");
|
||||
Assert.That(await db.ViewerArenaTwoPickRuns.AnyAsync(), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task FinishAsync_signals_full_clear_when_run_ended_with_5_wins()
|
||||
{
|
||||
// Full clear = 5W 0L (max battles = 5). Controller consumes this to fire the
|
||||
// challenge_full_clear mission event.
|
||||
var (db, svc, vid) = await SetupWithRunAsync(winCount: 5, lossCount: 0);
|
||||
await using var _ = db;
|
||||
|
||||
var outcome = await svc.FinishAsync(vid);
|
||||
Assert.That(outcome.WasFullClear, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RecordBattleResultAsync_win_increments_win_and_grants_xp_and_spot_points()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user