feat: implement CardWars game engine

Implement the core CardWars game logic using an ECS-based architecture.
This includes:
- Card effect registry and various card effect implementations.
- Game phase management (Setup, Play, Flip, Scoring, Cleanup).
- Command system for player actions (PlayCard, FlipCard, etc.).
- Component-based game state and entity relationships.
- Automated game setup and scoring systems.
- Unit tests for game setup, card effects, and play logs.
This commit is contained in:
2026-07-20 22:52:28 +08:00
parent 3b08138580
commit 2de735498c
40 changed files with 2440 additions and 25 deletions
+18
View File
@@ -0,0 +1,18 @@
using MessagePack;
namespace Game.CardWars;
/// <summary>
/// Global game state on the singleton entity.
/// </summary>
[MessagePackObject]
public record struct GameState
{
[Key(0)] public GamePhase Phase;
[Key(1)] public int PlayerCount;
[Key(2)] public int CurrentPlayerIndex;
[Key(3)] public int StartingPlayerIndex;
[Key(4)] public int RoundNumber;
[Key(5)] public uint Seed;
[Key(6)] public bool PlayPhaseEnded;
}
+14
View File
@@ -0,0 +1,14 @@
using MessagePack;
namespace Game.CardWars;
/// <summary>
/// Per-player score tracking.
/// </summary>
[MessagePackObject]
public record struct PlayerScores
{
[Key(0)] public int[] Scores;
[Key(1)] public CastleColor[] WonCastles;
[Key(2)] public int Count;
}