Fix team play: correct team indices, team-aware unit colors and ownership
Server: - Add TeamCount, PlayerOneTeamIndex, PlayerTwoTeamIndex to GameSession so team assignments survive the lobby→game transition without recomputation - GameLobbyReadyHandler.StartGameAsync: apply TeamAssignmentsJson (host custom reassignments) for all seats; store P1/P2 team indices on the session - GameReadyHandler N-player path: use session.PlayerOneTeamIndex / PlayerTwoTeamIndex instead of hardcoded teamCount=1 (which put both P1 and P2 on team 0 in every non-FFA game) - EF migration: AddGameSessionTeamFields Client (game_screen.gd): - _rebuild_ownership: treat same-team allies as friendly instead of enemy - Unit color loop: use state.teamColors palette per team instead of hardcoded blue (self) / red (everyone else) - _on_game_over: derive i_won from player_outcomes[me].outcome == "Winner" so a teammate's final kill correctly shows "Victory!" for the whole team Also: skip absent hex tiles in BoardTemplateBuilder SVG render Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -412,6 +412,9 @@ namespace SOR.Database.Migrations.Game
|
||||
b.Property<bool>("PlayerOneReady")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("PlayerOneTeamIndex")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("PlayerTwoAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
@@ -421,6 +424,9 @@ namespace SOR.Database.Migrations.Game
|
||||
b.Property<bool>("PlayerTwoReady")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("PlayerTwoTeamIndex")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("RuleSnapshotJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("rule_snapshot");
|
||||
@@ -436,6 +442,9 @@ namespace SOR.Database.Migrations.Game
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TeamCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WinCondition")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user