Allow Instinct quick-play on any turn; keep other cards main-phase only
This commit is contained in:
@@ -189,13 +189,23 @@ public static class GameEngine
|
||||
public static GameState ChannelCard(
|
||||
GameState state, string actorId, string cardInstanceId, IReadOnlyList<Coord>? targetTiles)
|
||||
{
|
||||
ValidateActivePlayer(state, actorId);
|
||||
ValidatePhase(state, GamePhase.Main);
|
||||
|
||||
var player = state.Players[actorId];
|
||||
var card = player.Hand.FirstOrDefault(c => c.InstanceId == cardInstanceId)
|
||||
?? throw new GameException("CARD_NOT_IN_HAND");
|
||||
|
||||
// Instinct is quick-play: it may be channeled on any turn (including opponent turn),
|
||||
// but never during Setup/Placement/GameOver.
|
||||
if (card.CardType == "Instinct")
|
||||
{
|
||||
if (state.Phase is GamePhase.Setup or GamePhase.Placement or GamePhase.GameOver)
|
||||
throw new GameException($"INVALID_PHASE:{state.Phase}");
|
||||
}
|
||||
else
|
||||
{
|
||||
ValidateActivePlayer(state, actorId);
|
||||
ValidatePhase(state, GamePhase.Main);
|
||||
}
|
||||
|
||||
if (player.CurrentSp < card.SpCost) throw new GameException("INSUFFICIENT_SP");
|
||||
if (player.CurrentSt < card.StCost) throw new GameException("INSUFFICIENT_ST");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user