feat(hs): wire HeykelSavasiContext in GetMiniGameAsync + team gate resolver
This commit is contained in:
@@ -284,6 +284,9 @@ public class GameContext : AsyncDisposable, IGameContext
|
|||||||
case MiniGameType.BloodCastle:
|
case MiniGameType.BloodCastle:
|
||||||
miniGameContext = new BloodCastleContext(miniGameKey, miniGameDefinition, this, this._mapInitializer);
|
miniGameContext = new BloodCastleContext(miniGameKey, miniGameDefinition, this, this._mapInitializer);
|
||||||
break;
|
break;
|
||||||
|
case MiniGameType.HeykelSavasi:
|
||||||
|
miniGameContext = new HeykelSavasiContext(miniGameKey, miniGameDefinition, this, this._mapInitializer);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
miniGameContext = new MiniGameContext(miniGameKey, miniGameDefinition, this, this._mapInitializer);
|
miniGameContext = new MiniGameContext(miniGameKey, miniGameDefinition, this, this._mapInitializer);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -24,6 +24,30 @@ public class HeykelSavasiContext : MiniGameContext
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const int MaxTeamDifference = 2;
|
private const int MaxTeamDifference = 2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The X1/Y1 anchor of the red team's base spawn gate.
|
||||||
|
/// Must match Gates.cs targetGates 600 (RedBase).
|
||||||
|
/// </summary>
|
||||||
|
private const byte RedBaseAnchorX1 = 20;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The X1/Y1 anchor of the red team's base spawn gate.
|
||||||
|
/// Must match Gates.cs targetGates 600 (RedBase).
|
||||||
|
/// </summary>
|
||||||
|
private const byte RedBaseAnchorY1 = 20;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The X1/Y1 anchor of the blue team's base spawn gate.
|
||||||
|
/// Must match Gates.cs targetGates 601 (BlueBase).
|
||||||
|
/// </summary>
|
||||||
|
private const byte BlueBaseAnchorX1 = 220;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The X1/Y1 anchor of the blue team's base spawn gate.
|
||||||
|
/// Must match Gates.cs targetGates 601 (BlueBase).
|
||||||
|
/// </summary>
|
||||||
|
private const byte BlueBaseAnchorY1 = 220;
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<Player, HeykelSavasiTeam> _teams = new();
|
private readonly ConcurrentDictionary<Player, HeykelSavasiTeam> _teams = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -66,6 +90,24 @@ public class HeykelSavasiContext : MiniGameContext
|
|||||||
/// <returns>The team of the player, or <see cref="HeykelSavasiTeam.None"/> if the player is not assigned to a team.</returns>
|
/// <returns>The team of the player, or <see cref="HeykelSavasiTeam.None"/> if the player is not assigned to a team.</returns>
|
||||||
public HeykelSavasiTeam GetTeam(Player player) => this._teams.TryGetValue(player, out var team) ? team : HeykelSavasiTeam.None;
|
public HeykelSavasiTeam GetTeam(Player player) => this._teams.TryGetValue(player, out var team) ? team : HeykelSavasiTeam.None;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the base spawn gate for the given team.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="team">The team.</param>
|
||||||
|
/// <returns>The <see cref="ExitGate"/> which is the base spawn point of <paramref name="team"/>.</returns>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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).
|
||||||
|
/// </remarks>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all players which are currently assigned to the given team.
|
/// Gets all players which are currently assigned to the given team.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user