Add support for up to 6 players.

This commit is contained in:
Greyson Parrelli
2026-07-28 07:36:09 -04:00
parent e542118175
commit a4f5f6910d
38 changed files with 2306 additions and 713 deletions
+19 -17
View File
@@ -1,15 +1,15 @@
package game
// SimulateBattle resolves a hypothetical two-player battle between the given
// arranged decks (top of deck first) and returns the result. It runs on a
// scratch game, so it never touches real state — callers (notably the AI
// player) can roll out as many what-if battles as they like. Dice rolls are
// random unless rollDie is non-nil.
func SimulateBattle(round, prioritySeat int, deckA, deckB []Card, rollDie func() int) *BattleResult {
// SimulateBattle resolves a hypothetical battle between the given arranged
// decks (top of deck first) and returns the result. deckA sits at seat 0 and
// deckB at seat 1; firstSeat (0 or 1) is the one holding priority. It runs on
// a scratch game and awards nothing, so it never touches real state — callers
// (notably the AI player) can roll out as many what-if battles as they like.
// Dice rolls are random unless rollDie is non-nil.
func SimulateBattle(round, firstSeat int, deckA, deckB []Card, rollDie func() int) *BattleResult {
g := &Game{
Round: round,
PrioritySeat: prioritySeat,
RollDie: rollDie,
Round: round,
RollDie: rollDie,
// Cards minted during the simulation (apples, bees) get IDs far away
// from real ones, purely to avoid confusion when reading results.
NextCardID: 1_000_000,
@@ -18,22 +18,24 @@ func SimulateBattle(round, prioritySeat int, deckA, deckB []Card, rollDie func()
{Name: "B", Seat: 1, Deck: append([]Card(nil), deckB...)},
},
}
g.startBattle()
return g.Battle
if firstSeat == 1 {
return g.runBattle(1, 0)
}
return g.runBattle(0, 1)
}
// TierContents returns the full printed contents of a tier's shop deck for the
// default pack. Cards carry placeholder IDs; they are reference data, not live
// instances.
func TierContents(tier int) []Card {
return TierContentsForPack(DefaultPack, tier)
return TierContentsForPacks([]string{DefaultPack}, tier)
}
// TierContentsForPack returns a pack's printed tier contents — public
// information from the box. Used by the AI, which decides from a View that
// names its pack.
func TierContentsForPack(pack string, tier int) []Card {
scratch := &Game{Pack: pack}
// TierContentsForPacks returns the printed tier contents of a pack selection,
// combined the way the shop decks combine them — public information from the
// boxes. Used by the AI, which decides from a View that names its packs.
func TierContentsForPacks(packs []string, tier int) []Card {
scratch := &Game{Packs: packs}
scratch.buildShopDecks()
if tier < 1 || tier > len(scratch.ShopDecks) {
return nil