Fix gameplay engine rules + add RuleSet/CustomLobby system
Engine corrections (per gameplay.md + user spec): - Opening draw: both players draw 6 cards at game start - P1 skips Draw phase on turn 1 (already has opening hand); P2 draws once at start of their first turn → 7 cards total - SP: starts at 0, accumulates +3/turn (never resets, no cap by default) - ST: starts at 0, earned only through sacrifice (no per-turn grant) - No entry sickness: units can attack/move/ability the turn they are summoned - Defense restores to MaxDefense at start of each turn (§6.9.3) - Rename Graveyard → Discard throughout (GameState, GameEngine, GameMessages) - Remove IsEntrySick flag from CardInstance and CardInstanceDto GameRuleSet / CustomLobby infrastructure: - GameRuleSet DB entity: admin-configurable rules (IsRankedDefault, IsCustomDefault) - GameRules record (SOR.Game): in-memory config embedded in GameState.Rules - GameSession.RuleSnapshotJson: immutable per-session rule snapshot (jsonb) - MatchmakerService: loads ranked ruleset and snapshots it into each GameSession - GameReadyHandler: deserializes rule snapshot and passes rules to GameEngine.Initialize - CustomLobby DB entity: host+guest, rule overrides, GameSessionId link - CustomLobbyStatus enum: Open / Full / Started / Cancelled Custom game handlers (4): - game.custom.create — host creates lobby with optional rule overrides - game.custom.join — guest joins; when full, creates GameSession + pushes both players - game.custom.leave — host cancels or guest leaves - game.custom.list — paged list of Open lobbies Admin portal: - /game/ranked-rules — edit the ranked play ruleset (auto-seeds default on first visit) - /game/custom-lobbies — read-only view of active and recent custom lobbies - NavMenu: added Ranked Rules + Custom Lobbies links under Game Migration: AddGameRulesAndCustomLobby (game_rule_sets, custom_lobbies, rule_snapshot column on game_sessions) 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:
@@ -78,6 +78,16 @@
|
||||
<i class="bi bi-joystick me-2"></i>Sessions
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link text-white-50 py-1" href="/game/ranked-rules">
|
||||
<i class="bi bi-sliders me-2"></i>Ranked Rules
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link text-white-50 py-1" href="/game/custom-lobbies">
|
||||
<i class="bi bi-people-fill me-2"></i>Custom Lobbies
|
||||
</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
|
||||
Reference in New Issue
Block a user