Initial pass at unicorn pack.

This commit is contained in:
Greyson Parrelli
2026-07-25 00:37:44 -04:00
parent f3783b44bf
commit a1d57fe1dd
21 changed files with 2419 additions and 44 deletions
+20 -2
View File
@@ -22,7 +22,13 @@ type PlayerView struct {
BuysThisRound int `json:"buysThisRound,omitempty"`
// Trumpets is the count banked for the next battle (Bird of Paradise).
// Self-only — shown under the player's own deck.
Trumpets int `json:"trumpets,omitempty"`
Trumpets int `json:"trumpets,omitempty"`
// Mana is the player's persistent Mana pool (Unicorn pack). Public: it's a
// play-area counter derivable from public shop/battle events.
Mana int `json:"mana,omitempty"`
// ShopPeek is the card Bigfoot revealed off the top of the shop deck this
// round (Unicorn pack). Self-only — it's private information.
ShopPeek *Card `json:"shopPeek,omitempty"`
Deck []Card `json:"deck,omitempty"` // self only
}
@@ -56,7 +62,10 @@ type View struct {
// see a reveal is in progress; the eligible options are only sent to the
// buyer (they name the buyer's own hidden pets).
PendingReveal *PendingReveal `json:"pendingReveal,omitempty"`
Battle *BattleResult `json:"battle,omitempty"`
// PendingSacrifice (Unicorn pack: Water of Youth) mirrors PendingReveal: the
// options (the buyer's own pets) are only sent to the buyer.
PendingSacrifice *PendingSacrifice `json:"pendingSacrifice,omitempty"`
Battle *BattleResult `json:"battle,omitempty"`
WinnerSeat int `json:"winnerSeat"`
// Log is the shared, public event log shown across every phase.
Log []LogEntry `json:"log,omitempty"`
@@ -102,6 +111,7 @@ func (g *Game) ViewFor(playerID string) View {
DeckSize: len(p.Deck),
PetCount: p.PetCount(),
Avocados: p.Avocados,
Mana: p.Mana,
}
if p.ID == playerID {
v.YouSeat = p.Seat
@@ -109,6 +119,7 @@ func (g *Game) ViewFor(playerID string) View {
pv.FirstBuyFree = p.FirstBuyFree
pv.BuysThisRound = p.BuysThisRound
pv.Trumpets = p.PendingTrumpets
pv.ShopPeek = p.ShopPeek
}
v.Players = append(v.Players, pv)
}
@@ -126,6 +137,13 @@ func (g *Game) ViewFor(playerID string) View {
}
v.PendingReveal = &reveal
}
if g.PendingSacrifice != nil {
sac := *g.PendingSacrifice
if sac.PlayerID != playerID {
sac.Options = nil // hide which of the buyer's pets are eligible
}
v.PendingSacrifice = &sac
}
// Battle results (lineups, events) are public once resolved. Keep the
// battle around during the following shop phase too, so late joiners /
// reconnects can still see the last result.