Add lobby and pack concept.
This commit is contained in:
+15
-4
@@ -482,12 +482,23 @@ func (g *Game) newCardID() string {
|
||||
return fmt.Sprintf("c%d", g.NextCardID)
|
||||
}
|
||||
|
||||
// buildShopDecks creates all six tier decks (unshuffled).
|
||||
// packTiers returns the pet and food templates for a pack, tier by tier. Only
|
||||
// the Turtle pack has real data today; the other (not-yet-playable) packs fall
|
||||
// back to it so this is the single seam future packs plug their cards into.
|
||||
func packTiers(pack string) (*[MaxRounds][]petTemplate, *[MaxRounds][]foodTemplate) {
|
||||
switch pack {
|
||||
default: // turtle (and the placeholder packs, until they ship)
|
||||
return &petTiers, &foodTiers
|
||||
}
|
||||
}
|
||||
|
||||
// buildShopDecks creates all six tier decks (unshuffled) for the game's pack.
|
||||
func (g *Game) buildShopDecks() {
|
||||
pets, foods := packTiers(g.Pack)
|
||||
g.ShopDecks = make([][]Card, MaxRounds)
|
||||
for tierIdx := range petTiers {
|
||||
for tierIdx := range pets {
|
||||
var deck []Card
|
||||
for _, t := range petTiers[tierIdx] {
|
||||
for _, t := range pets[tierIdx] {
|
||||
for _, suit := range t.Suits {
|
||||
deck = append(deck, Card{
|
||||
ID: g.newCardID(),
|
||||
@@ -501,7 +512,7 @@ func (g *Game) buildShopDecks() {
|
||||
})
|
||||
}
|
||||
}
|
||||
for _, f := range foodTiers[tierIdx] {
|
||||
for _, f := range foods[tierIdx] {
|
||||
for range f.Copies {
|
||||
deck = append(deck, Card{
|
||||
ID: g.newCardID(),
|
||||
|
||||
Reference in New Issue
Block a user