Initial pass at Golden Pack.
This commit is contained in:
+29
-4
@@ -13,7 +13,14 @@ type PlayerView struct {
|
||||
IsBot bool `json:"isBot,omitempty"`
|
||||
DeckSize int `json:"deckSize"`
|
||||
PetCount int `json:"petCount"`
|
||||
Deck []Card `json:"deck,omitempty"` // self only
|
||||
// Avocados is the player's set-aside Avocado token count (Golden pack).
|
||||
// Public: buying an Avocado is a public shop event.
|
||||
Avocados int `json:"avocados,omitempty"`
|
||||
// FirstBuyFree / BuysThisRound (Golden pack) are self-only: they'd reveal
|
||||
// hidden deck facts (a Manta Ray) to opponents.
|
||||
FirstBuyFree bool `json:"firstBuyFree,omitempty"`
|
||||
BuysThisRound int `json:"buysThisRound,omitempty"`
|
||||
Deck []Card `json:"deck,omitempty"` // self only
|
||||
}
|
||||
|
||||
// View is the full game state as seen by one player.
|
||||
@@ -41,9 +48,16 @@ type View struct {
|
||||
Players []PlayerView `json:"players"`
|
||||
// Pending is included for everyone so opponents see a trade is in
|
||||
// progress, but the revealed options are only shown to the trader.
|
||||
Pending *PendingTrade `json:"pending,omitempty"`
|
||||
Battle *BattleResult `json:"battle,omitempty"`
|
||||
WinnerSeat int `json:"winnerSeat"`
|
||||
Pending *PendingTrade `json:"pending,omitempty"`
|
||||
// PendingReveal (Golden pack: Cockatoo) is shown to everyone so opponents
|
||||
// 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"`
|
||||
// PendingBattle (Golden pack: Nurse Shark) is a mid-battle decision owed by
|
||||
// one seat; public since the battle replay is public.
|
||||
PendingBattle *PendingBattleDecision `json:"pendingBattle,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"`
|
||||
// Debug is set by the server when its DEBUG flag is on, unlocking the
|
||||
@@ -87,10 +101,13 @@ func (g *Game) ViewFor(playerID string) View {
|
||||
IsBot: p.IsBot,
|
||||
DeckSize: len(p.Deck),
|
||||
PetCount: p.PetCount(),
|
||||
Avocados: p.Avocados,
|
||||
}
|
||||
if p.ID == playerID {
|
||||
v.YouSeat = p.Seat
|
||||
pv.Deck = p.Deck
|
||||
pv.FirstBuyFree = p.FirstBuyFree
|
||||
pv.BuysThisRound = p.BuysThisRound
|
||||
}
|
||||
v.Players = append(v.Players, pv)
|
||||
}
|
||||
@@ -101,6 +118,14 @@ func (g *Game) ViewFor(playerID string) View {
|
||||
}
|
||||
v.Pending = &pending
|
||||
}
|
||||
if g.PendingReveal != nil {
|
||||
reveal := *g.PendingReveal
|
||||
if reveal.PlayerID != playerID {
|
||||
reveal.Options = nil // hide which of the buyer's pets are eligible
|
||||
}
|
||||
v.PendingReveal = &reveal
|
||||
}
|
||||
v.PendingBattle = g.PendingBattle
|
||||
// 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.
|
||||
|
||||
Reference in New Issue
Block a user