Initial pass at unicorn pack.

This commit is contained in:
Greyson Parrelli
2026-07-25 00:37:44 -04:00
parent f3783b44bf
commit a1d57fe1dd
21 changed files with 2419 additions and 44 deletions
+47
View File
@@ -52,6 +52,20 @@ func (cx *ctx) applyTemplateShopEffects(deck []game.Card, c game.Card, trigger g
for range best {
deck = append(deck, cx.simApple())
}
case game.ActionRevealTierForApples:
// Quetzalcoatl: a fixed apple reward if a low-tier pet can be revealed.
eligible := false
for _, d := range deck {
if d.IsPet() && d.ID != c.ID && (e.Cap <= 0 || d.Tier <= e.Cap) {
eligible = true
break
}
}
if eligible {
for range max(e.Count, 1) {
deck = append(deck, cx.simApple())
}
}
case game.ActionDoubleApples:
apples := 0
for _, dc := range deck {
@@ -87,6 +101,39 @@ func (cx *ctx) applyTemplateShopEffects(deck []game.Card, c game.Card, trigger g
if i := slices.IndexFunc(deck, func(d game.Card) bool { return d.ID == c.ID }); i >= 0 {
deck = slices.Delete(deck, i, i+1)
}
case game.ActionUpgradeNextTier:
// Unicorn pack (Water of Youth): discard this food and the lowest-value
// pet, then gain a sampled top card of the next tier for free.
nextTier := cx.v.Round + 1
if nextTier > game.MaxRounds {
continue
}
if i := slices.IndexFunc(deck, func(d game.Card) bool { return d.ID == c.ID }); i >= 0 {
deck = slices.Delete(deck, i, i+1)
}
worst, worstVal := -1, 0.0
for i, d := range deck {
if !d.IsPet() {
continue
}
if v := keepValue(d); worst < 0 || v < worstVal {
worst, worstVal = i, v
}
}
if worst < 0 {
continue // no pet to sacrifice; the food is wasted
}
deck = slices.Delete(deck, worst, worst+1)
pool := cx.unseenPool(nextTier)
if len(pool) == 0 {
pool = game.TierContentsForPack(cx.v.Pack, nextTier)
}
if len(pool) > 0 {
rc := pool[rand.IntN(len(pool))]
rc.ID = cx.nextSimID()
deck = append(deck, rc)
deck = cx.applyTemplateShopEffects(deck, rc, game.TriggerBuy)
}
}
}
return deck