feat(arena-colosseum): playable bracket + rank-match promotion (phase 2)

Closes 4 more arena-colosseum spec shapes (6/16 → 10/16): the dual-prefix
battle URLs (colosseum_battle/* and colosseum_rank_battle/*) for both
do_matching and per-match finish, plus the bracket-end /finish + /retire
pair on /arena_colosseum.

* ColosseumProgressionService: pure-logic decisions for win-threshold
  advancement, 3008 promotion trigger, and per-round reward bundles.
  Extends ColosseumRoundsConfig with FinishRewards/RetireRewards per
  round + a top-level ChampionRewards list.
* MatchContextBuilder.BuildForColosseumAsync: lifts the registered deck
  via IDeckRepository (NOT viewer-graph) per project_ef_nav_include_pitfall.
* ArenaColosseumBattleController: dual route prefixes off one controller
  via explicit absolute [HttpPost("/...")] routes — does NOT extend
  SVSimController's [Route("[controller]")]. Same pattern as FreeBattle.
  URL-vs-IsRankMatching mismatch returns 400 with a phase-mismatch error;
  no-deck triggers the standard 3001 matchmaking-illegal state. 3008
  flips run.IsRankMatching exactly once via the progression service.
* /arena_colosseum/finish + /retire share FinishResponse (rewards +
  reward_list + colosseum_status). Champion finish appends ChampionRewards
  and surfaces colosseum_status.is_champion = true. Both delete the run
  row after granting via IInventoryTransaction.GrantAsync.
* DI: ModePolicy entries for "colosseum_battle" and "colosseum_rank_battle".
* Tests: 8 progression-service unit tests (pure logic), 5 battle-controller
  HTTP tests, 5 bracket-terminate HTTP tests, 2 full-bracket E2E walks
  (champion path + retire mid-round). Full suite: 1331/1331.
This commit is contained in:
gamer147
2026-06-13 12:32:56 -04:00
parent 110867358c
commit cbee0f9a50
16 changed files with 1436 additions and 2 deletions

View File

@@ -1,7 +1,10 @@
using SVSim.Database.Enums;
namespace SVSim.Database.Models.Config;
/// <summary>
/// The 3-round bracket schedule for an active Colosseum season. Empty <see cref="Rounds"/>
/// The 3-round bracket schedule for an active Colosseum season — and the per-round
/// reward bundles paid out by <c>/finish</c> + <c>/retire</c>. Empty <see cref="Rounds"/>
/// is the default shipped state — lobby <c>/event_info</c> renders a benign payload with
/// no rounds active. Collection default is in <see cref="ShippedDefaults"/> per
/// feedback_config_defaults (property-initializer collection defaults silently empty out
@@ -12,9 +15,14 @@ public class ColosseumRoundsConfig
{
public List<RoundEntry> Rounds { get; set; } = new();
/// <summary>Champion-only reward bundle, paid alongside the final round's FinishRewards
/// when <c>ColosseumProgressionService</c> determines the viewer cleared the bracket.</summary>
public List<RewardEntry> ChampionRewards { get; set; } = new();
public static ColosseumRoundsConfig ShippedDefaults() => new()
{
Rounds = new(),
ChampionRewards = new(),
};
public class RoundEntry
@@ -29,6 +37,15 @@ public class ColosseumRoundsConfig
/// for late-joiners). The first entry is the canonical lookup used by
/// <c>ColosseumProgressionService</c> for the v1 single-bracket case.</summary>
public List<GroupEntry> Groups { get; set; } = new();
/// <summary>Paid by <c>/finish</c> when the viewer clears or otherwise ends this round
/// successfully. Empty = no bonus for this round.</summary>
public List<RewardEntry> FinishRewards { get; set; } = new();
/// <summary>Paid by <c>/retire</c> when the viewer abandons mid-round. Client ignores
/// these once <c>run.RoundId &gt;= FinalB</c>, but server still emits them per
/// retire.md (log completeness).</summary>
public List<RewardEntry> RetireRewards { get; set; } = new();
}
public class GroupEntry
@@ -44,4 +61,15 @@ public class ColosseumRoundsConfig
/// <summary>Total bracket entries allotted to this group.</summary>
public int EntryNumber { get; set; }
}
public class RewardEntry
{
public UserGoodsType Type { get; set; }
public long DetailId { get; set; }
public int Count { get; set; }
/// <summary>Display name for the <c>rewards[]</c> receipt block. Defaults to empty;
/// client uses system-text lookups when blank.</summary>
public string Name { get; set; } = "";
}
}