Add pets for tiers 4-6.
This commit is contained in:
+21
-1
@@ -45,6 +45,9 @@ type Player struct {
|
||||
Trophies int `json:"trophies"`
|
||||
Ready bool `json:"ready"` // arrange submitted / battle acknowledged
|
||||
Connected bool `json:"connected"`
|
||||
// TripledThisRound records whether the player used the Triple (trade-in)
|
||||
// action during the current round's shop (Bison's Battle Prep).
|
||||
TripledThisRound bool `json:"tripledThisRound"`
|
||||
}
|
||||
|
||||
// PetCount counts pet cards in the player's deck.
|
||||
@@ -207,6 +210,7 @@ func (g *Game) startShopRound() {
|
||||
for _, p := range g.Players {
|
||||
p.Coins = CoinsPerRound
|
||||
p.Ready = false
|
||||
p.TripledThisRound = false
|
||||
}
|
||||
g.ShopRow = make([]Card, ShopRowSize)
|
||||
for i := range g.ShopRow {
|
||||
@@ -285,12 +289,17 @@ func (g *Game) Sell(playerID string, cardIDs []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// applyShopTrigger fires a shop-time trigger (buy/sell/triple) on one card.
|
||||
// applyShopTrigger fires a shop-time trigger (buy/sell/triple/battle prep)
|
||||
// on one card. Battle-time actions on the same trigger (Monkey's
|
||||
// applesInPlay) are ignored here and handled by the battle resolver.
|
||||
func (g *Game) applyShopTrigger(p *Player, c Card, trigger EffectTrigger) {
|
||||
for _, e := range c.Effects {
|
||||
if e.Trigger != trigger || g.Round < e.MinRound {
|
||||
continue
|
||||
}
|
||||
if e.Condition == ConditionTripled && !p.TripledThisRound {
|
||||
continue
|
||||
}
|
||||
switch e.Action {
|
||||
case ActionGainApple:
|
||||
for range e.count() {
|
||||
@@ -298,6 +307,16 @@ func (g *Game) applyShopTrigger(p *Player, c Card, trigger EffectTrigger) {
|
||||
}
|
||||
case ActionRefreshGold:
|
||||
p.Coins = min(p.Coins+e.count(), CoinsPerRound)
|
||||
case ActionDoubleApples:
|
||||
apples := 0
|
||||
for _, dc := range p.Deck {
|
||||
if dc.Food == FoodApple {
|
||||
apples++
|
||||
}
|
||||
}
|
||||
for range apples {
|
||||
p.Deck = append(p.Deck, g.newApple())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -369,6 +388,7 @@ func (g *Game) TradeStart(playerID string, cardIDs []string) error {
|
||||
p.Deck = slices.Delete(p.Deck, idx, idx+1)
|
||||
}
|
||||
p.Coins--
|
||||
p.TripledThisRound = true
|
||||
g.Pending = &PendingTrade{
|
||||
PlayerID: playerID,
|
||||
Tier: nextTier,
|
||||
|
||||
Reference in New Issue
Block a user