Reveal tripled-in pets but keep the pick secret unless it buys.
This commit is contained in:
+29
-2
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Tunable rules. The engine supports any player count >= 2; MinPlayers /
|
||||
@@ -369,6 +370,17 @@ func (g *Game) sellCards(p *Player, cardIDs []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// hasBuyEffect reports whether a card carries any buy-triggered ability, which
|
||||
// means acquiring it does something visible to everyone.
|
||||
func hasBuyEffect(c Card) bool {
|
||||
for _, e := range c.Effects {
|
||||
if e.Trigger == TriggerBuy {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// TradeStart spends one coin and three same-suit pets from the player's deck
|
||||
// to reveal the top two cards of the next tier's deck. The player must then
|
||||
// call TradeChoose before anything else happens.
|
||||
@@ -412,7 +424,14 @@ func (g *Game) TradeStart(playerID string, cardIDs []string) error {
|
||||
}
|
||||
p.Coins--
|
||||
p.TripledThisRound = true
|
||||
g.logf(p.Seat, "🔄", "%s traded in 3 %s pets for a tier %d pick.", p.Name, suit, nextTier)
|
||||
// The discarded trio is public — everyone sees what was given up — even
|
||||
// though the pet ultimately chosen stays secret (see TradeChoose).
|
||||
names := make([]string, len(traded))
|
||||
for i, c := range traded {
|
||||
names[i] = c.Name
|
||||
}
|
||||
g.logf(p.Seat, "🔄", "%s traded in %s (%s) for a tier %d pick.",
|
||||
p.Name, strings.Join(names, ", "), suit, nextTier)
|
||||
g.Pending = &PendingTrade{
|
||||
PlayerID: playerID,
|
||||
Tier: nextTier,
|
||||
@@ -440,7 +459,15 @@ func (g *Game) TradeChoose(playerID string, pick int) error {
|
||||
tierIdx := g.Pending.Tier - 1
|
||||
g.ShopDecks[tierIdx] = append(g.ShopDecks[tierIdx], other)
|
||||
g.Pending = nil
|
||||
g.logf(p.Seat, "🔄", "%s picked %s from the trade.", p.Name, chosen.Name)
|
||||
// The pick is secret — opponents never saw the two revealed options and
|
||||
// can't see the deck. But a pet with a Buy ability performs it publicly, so
|
||||
// we have to reveal that pet (its effect log names it anyway).
|
||||
if hasBuyEffect(chosen) {
|
||||
g.logf(p.Seat, "🔄", "%s's trade pick is %s %s — its buy ability triggers.",
|
||||
p.Name, article(chosen.Name), chosen.Name)
|
||||
} else {
|
||||
g.logf(p.Seat, "🔄", "%s keeps their trade pick hidden.", p.Name)
|
||||
}
|
||||
// Pets obtained via the Triple action trigger their Buy effects.
|
||||
g.applyShopTrigger(p, chosen, TriggerBuy)
|
||||
g.advanceShopTurn()
|
||||
|
||||
Reference in New Issue
Block a user