Fix shop action costs and pass semantics.
Only buying costs gold; selling and trading (Triple) are free. Pass is now a final action, legal only at or under the pet limit: it forfeits remaining gold and ends that player's shopping for the round, with the shop closing once everyone has passed. That makes the separate cleanup phase unreachable (you sell down in-shop before passing), so it is removed. The client asks for confirmation before passing, and the bot knows buys are the only coin sink, when passing is legal, and that it must sell down before it can pass.
This commit is contained in:
+10
-6
@@ -66,9 +66,6 @@ func applyAction(g *game.Game, playerID string, a *Action) error {
|
||||
case "buy":
|
||||
return g.Buy(playerID, a.Row)
|
||||
case "sell":
|
||||
if g.Phase == game.PhaseCleanup {
|
||||
return g.CleanupSell(playerID, a.Cards)
|
||||
}
|
||||
return g.Sell(playerID, a.Cards)
|
||||
case "trade":
|
||||
return g.TradeStart(playerID, a.Cards)
|
||||
@@ -112,7 +109,8 @@ func TestObserveTracksOpponentDeck(t *testing.T) {
|
||||
}
|
||||
obs()
|
||||
|
||||
// Whoever holds priority shops first; walk both players through buys.
|
||||
// Whoever holds priority shops first; walk both players through buys,
|
||||
// then have both pass to end the shop.
|
||||
first, second := g.Players[g.PrioritySeat], g.Players[1-g.PrioritySeat]
|
||||
for range 3 { // 3 coins each, alternating
|
||||
for _, p := range []*game.Player{first, second} {
|
||||
@@ -122,6 +120,12 @@ func TestObserveTracksOpponentDeck(t *testing.T) {
|
||||
obs()
|
||||
}
|
||||
}
|
||||
for _, p := range []*game.Player{first, second} {
|
||||
if err := g.Pass(p.ID); err != nil {
|
||||
t.Fatalf("pass: %v", err)
|
||||
}
|
||||
obs()
|
||||
}
|
||||
|
||||
// The model of B's deck must now match B's real deck card-for-card:
|
||||
// every buy was public (and buy effects like Otter's apple are printed
|
||||
@@ -129,8 +133,8 @@ func TestObserveTracksOpponentDeck(t *testing.T) {
|
||||
assertModelMatches(t, mem, pb)
|
||||
|
||||
// Play out the round; the battle lineup resync must also match.
|
||||
for g.Phase == game.PhaseCleanup {
|
||||
t.Fatal("unexpected cleanup with 3 buys")
|
||||
if g.Phase != game.PhaseArrange {
|
||||
t.Fatalf("phase = %s, want arrange after both pass", g.Phase)
|
||||
}
|
||||
for _, p := range g.Players {
|
||||
ids := make([]string, len(p.Deck))
|
||||
|
||||
Reference in New Issue
Block a user