Let players peek both decks during and after a battle
Record each seat's arranged lineup on the battle result (already public) and reveal the full deck in a popover when hovering a deck pile in the battle view — the opponent's included.
This commit is contained in:
@@ -102,12 +102,14 @@ type BattleEvent struct {
|
||||
Bonus int `json:"bonus"`
|
||||
}
|
||||
|
||||
// BattleResult is the full, public record of one round's battle. Only what
|
||||
// was revealed appears in Events; the rest of the winner's stack stays
|
||||
// hidden.
|
||||
// BattleResult is the full, public record of one round's battle.
|
||||
type BattleResult struct {
|
||||
Round int `json:"round"`
|
||||
StackSizes []int `json:"stackSizes"` // starting deck size per seat
|
||||
Round int `json:"round"`
|
||||
StackSizes []int `json:"stackSizes"` // starting deck size per seat
|
||||
// Lineups is each seat's arranged deck at battle start (top of deck
|
||||
// first). Public so players can review the whole matchup — including the
|
||||
// opponent's cards — during and after the fight.
|
||||
Lineups [][]Card `json:"lineups,omitempty"`
|
||||
Events []BattleEvent `json:"events"`
|
||||
WinnerSeat int `json:"winnerSeat"` // -1 = draw
|
||||
Trophies int `json:"trophies"` // awarded to the winner
|
||||
@@ -189,7 +191,7 @@ func effectCount(e Effect, s *battleSide, u *BattleUnit) int {
|
||||
// stalemate.
|
||||
func (g *Game) resolveBattle() {
|
||||
n := len(g.Players)
|
||||
res := &BattleResult{Round: g.Round, WinnerSeat: -1, StackSizes: make([]int, n)}
|
||||
res := &BattleResult{Round: g.Round, WinnerSeat: -1, StackSizes: make([]int, n), Lineups: make([][]Card, n)}
|
||||
sides := make([]*battleSide, n)
|
||||
emit := func(ev BattleEvent) { res.Events = append(res.Events, ev) }
|
||||
|
||||
@@ -197,6 +199,7 @@ func (g *Game) resolveBattle() {
|
||||
s := &battleSide{stack: append([]Card(nil), p.Deck...)}
|
||||
sides[p.Seat] = s
|
||||
res.StackSizes[p.Seat] = len(p.Deck)
|
||||
res.Lineups[p.Seat] = append([]Card(nil), p.Deck...)
|
||||
}
|
||||
// seatOrder resolves the priority-token holder first, then everyone else.
|
||||
// Reveals, queued play effects, and cross-side triggers all follow it, so
|
||||
|
||||
Reference in New Issue
Block a user