More UX improvements.
This commit is contained in:
+10
-6
@@ -901,13 +901,17 @@ func (g *Game) buildShopDecks() {
|
||||
}
|
||||
}
|
||||
|
||||
// Catalog returns one representative card for every pet and food in the game,
|
||||
// tier by tier, for the debug "buy any card" panel. IDs are name-based
|
||||
// Catalog returns the default pack's representative cards.
|
||||
func Catalog() []Card { return CatalogForPack(DefaultPack) }
|
||||
|
||||
// CatalogForPack returns one representative card for every pet and food in a
|
||||
// pack, tier by tier, for the debug "buy any card" panel. IDs are name-based
|
||||
// placeholders (not real instances); pets use their first printed suit.
|
||||
func Catalog() []Card {
|
||||
func CatalogForPack(pack string) []Card {
|
||||
pets, foods := packTiers(pack)
|
||||
var cards []Card
|
||||
for tierIdx := range petTiers {
|
||||
for _, t := range petTiers[tierIdx] {
|
||||
for tierIdx := range pets {
|
||||
for _, t := range pets[tierIdx] {
|
||||
suit := SuitRed
|
||||
if len(t.Suits) > 0 {
|
||||
suit = t.Suits[0]
|
||||
@@ -917,7 +921,7 @@ func Catalog() []Card {
|
||||
Power: t.Power, Suit: suit, Effects: t.Effects, EffectText: t.EffectText,
|
||||
})
|
||||
}
|
||||
for _, f := range foodTiers[tierIdx] {
|
||||
for _, f := range foods[tierIdx] {
|
||||
cards = append(cards, Card{
|
||||
ID: "food-" + f.Name, Kind: KindFood, Name: f.Name, Tier: tierIdx + 1,
|
||||
Food: f.Food, Perk: f.Perk, Effects: f.Effects, EffectText: f.EffectText,
|
||||
|
||||
@@ -617,12 +617,12 @@ func (g *Game) applyShopTrigger(p *Player, c Card, trigger EffectTrigger) {
|
||||
// inside resolveBattle, so battlePrep is excluded here.
|
||||
if trigger == TriggerSell || trigger == TriggerBuy {
|
||||
p.PendingApplesInPlay += e.count()
|
||||
g.logf(p.Seat, "🍎", "%s sets up %d apple%s in play for the battle.", c.Name, e.count(), plural(e.count()))
|
||||
g.logf(p.Seat, "🍎", "%s — %s will start the next battle with %d apple%s in play.", c.Name, p.Name, e.count(), plural(e.count()))
|
||||
}
|
||||
case ActionStartTrumpets:
|
||||
// Golden pack: Bird of Paradise banks Trumpets for the next battle.
|
||||
p.PendingTrumpets += e.count()
|
||||
g.logf(p.Seat, "🎺", "%s sets up %d Trumpet%s in play for the battle.", c.Name, e.count(), plural(e.count()))
|
||||
g.logf(p.Seat, "🎺", "%s — %s will start the next battle with %d Trumpet%s.", c.Name, p.Name, e.count(), plural(e.count()))
|
||||
case ActionReactivateBuys:
|
||||
// Golden pack: Catfish re-fires every pet's Buy ability at battle prep.
|
||||
if trigger == TriggerBattlePrep {
|
||||
|
||||
@@ -51,9 +51,14 @@ func (s *Server) Handler() http.Handler {
|
||||
return mux
|
||||
}
|
||||
|
||||
// handleCatalog returns every card in the game, for the debug panel.
|
||||
func (s *Server) handleCatalog(w http.ResponseWriter, _ *http.Request) {
|
||||
writeJSON(w, game.Catalog())
|
||||
// handleCatalog returns every card in a pack (?pack=…, default Turtle), for the
|
||||
// debug panel. Unknown packs fall back to the default.
|
||||
func (s *Server) handleCatalog(w http.ResponseWriter, req *http.Request) {
|
||||
pack := req.URL.Query().Get("pack")
|
||||
if pack == "" {
|
||||
pack = game.DefaultPack
|
||||
}
|
||||
writeJSON(w, game.CatalogForPack(pack))
|
||||
}
|
||||
|
||||
// room is one live game plus its connections.
|
||||
|
||||
Reference in New Issue
Block a user