From 8295c30b7125b9e47a1a5abcb771a7111ae6140e Mon Sep 17 00:00:00 2001 From: Acentech Dev Date: Mon, 20 Jul 2026 23:04:21 +0300 Subject: [PATCH] feat(hs): wire HeykelSavasiContext in GetMiniGameAsync + team gate resolver --- src/GameLogic/GameContext.cs | 3 ++ .../MiniGames/HeykelSavasiContext.cs | 42 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/GameLogic/GameContext.cs b/src/GameLogic/GameContext.cs index 00ba1fb..6abbf3d 100644 --- a/src/GameLogic/GameContext.cs +++ b/src/GameLogic/GameContext.cs @@ -284,6 +284,9 @@ public class GameContext : AsyncDisposable, IGameContext case MiniGameType.BloodCastle: miniGameContext = new BloodCastleContext(miniGameKey, miniGameDefinition, this, this._mapInitializer); break; + case MiniGameType.HeykelSavasi: + miniGameContext = new HeykelSavasiContext(miniGameKey, miniGameDefinition, this, this._mapInitializer); + break; default: miniGameContext = new MiniGameContext(miniGameKey, miniGameDefinition, this, this._mapInitializer); break; diff --git a/src/GameLogic/MiniGames/HeykelSavasiContext.cs b/src/GameLogic/MiniGames/HeykelSavasiContext.cs index 006944a..66c440e 100644 --- a/src/GameLogic/MiniGames/HeykelSavasiContext.cs +++ b/src/GameLogic/MiniGames/HeykelSavasiContext.cs @@ -24,6 +24,30 @@ public class HeykelSavasiContext : MiniGameContext /// private const int MaxTeamDifference = 2; + /// + /// The X1/Y1 anchor of the red team's base spawn gate. + /// Must match Gates.cs targetGates 600 (RedBase). + /// + private const byte RedBaseAnchorX1 = 20; + + /// + /// The X1/Y1 anchor of the red team's base spawn gate. + /// Must match Gates.cs targetGates 600 (RedBase). + /// + private const byte RedBaseAnchorY1 = 20; + + /// + /// The X1/Y1 anchor of the blue team's base spawn gate. + /// Must match Gates.cs targetGates 601 (BlueBase). + /// + private const byte BlueBaseAnchorX1 = 220; + + /// + /// The X1/Y1 anchor of the blue team's base spawn gate. + /// Must match Gates.cs targetGates 601 (BlueBase). + /// + private const byte BlueBaseAnchorY1 = 220; + private readonly ConcurrentDictionary _teams = new(); /// @@ -66,6 +90,24 @@ public class HeykelSavasiContext : MiniGameContext /// The team of the player, or if the player is not assigned to a team. public HeykelSavasiTeam GetTeam(Player player) => this._teams.TryGetValue(player, out var team) ? team : HeykelSavasiTeam.None; + /// + /// Gets the base spawn gate for the given team. + /// + /// The team. + /// The which is the base spawn point of . + /// + /// The gate is resolved by matching the X1/Y1 anchor of the gates created for this event's map + /// (see Gates.cs targetGates 600/601, added in Task 0.3). Red anchors at (20, 20), Blue at (220, 220). + /// + public ExitGate GetTeamSpawnGate(HeykelSavasiTeam team) + { + var (anchorX1, anchorY1) = team == HeykelSavasiTeam.Blue + ? (BlueBaseAnchorX1, BlueBaseAnchorY1) + : (RedBaseAnchorX1, RedBaseAnchorY1); + + return this.Definition.Entrance!.Map!.ExitGates.First(g => g.X1 == anchorX1 && g.Y1 == anchorY1); + } + /// /// Gets all players which are currently assigned to the given team. ///