First pass at full refactor to 2.0 design

Restructures the game around the cyclical run loop from Game Design Doc V2:
5 waves = a cycle, 3 cycles = a phase, each phase ends in a boss.

- New TD.Gameplay.Waves: WaveGroup / PhaseDefinition / RunDefinition author the
  run as draggable weighted pools; RunState owns phase/cycle position, the drawn
  wave slots, and the per-slot enemy buff sets. WaveManager's flat wave array is
  gone -- it now only runs the encounter RunState points at.
- New TD.Gameplay.EnemyUpgrades: the post-wave enemy-buff vote, with public
  live-replicated ballots so the HUD can show who voted for what.
- Inter-wave flow is now strictly sequential: draft -> vote -> build, each stage
  ending early once every player has acted.
- Enemy abilities inverted from per-instance random rolls to deterministic,
  stacking per-wave-slot sets. Six cards ship: Split (reworked), Flight, Blink,
  No Bounty, Gold Theft, Double Up.
- Tower upgrades are a two-step tree: a draft pick unlocks a node, gold converts
  an already-placed tower in place.
- Boss encounters flag their enemies and drive a boss HP bar.
- Player cap reduced to 3 via MatchRules.MaxPlayers.
- GoldConfig is now keyed by global encounter number rather than wave index.

Compiles clean; NOT yet verified in-engine. Editor wiring still required --
see Docs/2.0_Setup_Checklist.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Matt F 2026-07-30 17:45:11 -07:00
parent 7e5c3a8279
commit 4892d7253d
64 changed files with 4023 additions and 344 deletions

View file

@ -68,8 +68,12 @@ namespace TD.Core
/// </summary>
/// <remarks>
/// <c>None</c> is a sentinel value used in <c>OwnerGrid</c> to mark tiles not owned by any player zone.
/// Player1..Player9 cover the maximum supported player count. Maps using fewer players use a
/// contiguous prefix (e.g., a 3-player map uses Player1, Player2, Player3 only).
/// Maps use a contiguous prefix of the player values.
///
/// <para><b>The enum runs to 9, but only <see cref="MatchRules.MaxPlayers"/> slots are ever
/// allocated.</b> Lobbies capped at 3 for the 2.0 design; the surplus values are kept because
/// they are baked into existing <c>LevelData</c> owner grids, and renumbering the enum would
/// force a re-bake of every map to no runtime benefit.</para>
/// </remarks>
/// <summary>
/// Global phase of a match, driven by <c>MatchState</c>.
@ -92,6 +96,28 @@ namespace TD.Core
Defeat = 4,
}
/// <summary>
/// Which step of the between-encounters sequence is currently running. Replicated by
/// <c>WaveManager</c> so every HUD can label the shared countdown correctly.
/// </summary>
/// <remarks>
/// These run strictly in order and never overlap: players take their personal draft, then vote
/// on the buff for the wave they just cleared, then build. The build timer deliberately does
/// NOT run concurrently with the choices — "after all players have chosen" only means
/// something if it isn't racing a clock players also want to spend on their maze.
/// </remarks>
public enum InterWaveStage : byte
{
/// <summary>No inter-wave step running — a wave is spawning or being fought.</summary>
None = 0,
/// <summary>Players are picking their personal draft reward.</summary>
Draft = 1,
/// <summary>Players are voting on the buff for the wave they just cleared.</summary>
Vote = 2,
/// <summary>Build countdown before the next wave spawns.</summary>
Build = 3,
}
/// <summary>
/// Stable identifier per race. Values 1-16 reserve slots for the planned
/// 16-race grid in the lobby; only races with a corresponding