Add lobby and pack concept.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package game
|
||||
|
||||
// Card packs are the selectable sets of pets and food a game is played with.
|
||||
// Only the Turtle pack ships with real card data today; Golden and Unicorn are
|
||||
// declared here as infrastructure (shown but not yet playable) so the lobby,
|
||||
// views, and deck-building all have a single source of truth to grow into.
|
||||
|
||||
// PackInfo describes one selectable pack. Playable gates whether a lobby may
|
||||
// choose it and start a game with it.
|
||||
type PackInfo struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Emoji string `json:"emoji"`
|
||||
Playable bool `json:"playable"`
|
||||
}
|
||||
|
||||
// DefaultPack is the pack a freshly created game starts on.
|
||||
const DefaultPack = "turtle"
|
||||
|
||||
// Packs is the ordered catalog of packs shown in the lobby.
|
||||
var Packs = []PackInfo{
|
||||
{ID: "turtle", Name: "Turtle Pack", Emoji: "🐢", Playable: true},
|
||||
{ID: "golden", Name: "Golden Pack", Emoji: "🥇", Playable: false},
|
||||
{ID: "unicorn", Name: "Unicorn Pack", Emoji: "🦄", Playable: false},
|
||||
}
|
||||
|
||||
// packByID looks up a pack, returning false if the id is unknown.
|
||||
func packByID(id string) (PackInfo, bool) {
|
||||
for _, p := range Packs {
|
||||
if p.ID == id {
|
||||
return p, true
|
||||
}
|
||||
}
|
||||
return PackInfo{}, false
|
||||
}
|
||||
Reference in New Issue
Block a user