Add DEBUG-gated panel to buy any card in the shop

When the server's DEBUG env var is on, expose a card catalog endpoint
and a collapsible client panel that drops any pet or food straight into
your deck (free, off-turn). Gated server-side so it is inert in normal
play.
This commit is contained in:
Greyson Parrelli
2026-07-23 01:07:14 -04:00
parent 71fa20493a
commit b2aa7c5ca3
13 changed files with 282 additions and 7 deletions
+19
View File
@@ -430,6 +430,25 @@ func (g *Game) TradeChoose(playerID string, pick int) error {
return nil
}
// DebugGrant drops any card straight into a player's deck during the shop,
// free and off-turn — a testing aid gated behind the server's DEBUG flag, not
// a normal action. No buy effects fire.
func (g *Game) DebugGrant(playerID, name string) error {
if g.Phase != PhaseShop && g.Phase != PhaseCleanup {
return ErrWrongPhase
}
p := g.PlayerByID(playerID)
if p == nil {
return errors.New("unknown player")
}
c, ok := g.cardByName(name)
if !ok {
return fmt.Errorf("%w: no card named %q", ErrInvalidAction, name)
}
p.Deck = append(p.Deck, c)
return nil
}
// Pass forfeits the player's remaining coins and ends their shopping.
func (g *Game) Pass(playerID string) error {
p, err := g.requireShopTurn(playerID)