aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-07-30 19:44:56 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-07-30 19:44:56 +0200
commit999a435dc511784267fc6e59c1c5f74f82eb4745 (patch)
treef7b21f951fefae8b395fe4577c7e7de6ce939b54
parentfd9a96f0afcae4d2bdad931252c85b593024548b (diff)
downloadmuhqs-game-999a435dc511784267fc6e59c1c5f74f82eb4745.tar.gz
muhqs-game-999a435dc511784267fc6e59c1c5f74f82eb4745.zip
reduce amount of enemy units and potentially spawn a support equipment
-rw-r--r--go/game/challenge.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/go/game/challenge.go b/go/game/challenge.go
index ff43d061..b27ef162 100644
--- a/go/game/challenge.go
+++ b/go/game/challenge.go
@@ -41,8 +41,21 @@ func prepCavArcherChallenge(s *LocalState) *LocalState {
s.addNewUnit(u, tile.Position, p)
// Prepare the opponent's units
- nUnits := rand.Intn(2) + 4
+ nUnits := rand.Intn(2) + 2
+
+ // add support equipment
+ if nUnits > 3 {
+ candidates := NewDeckFromCardPaths(Sets.Base.CardPaths()).FilterCards(func(c *Card) bool {
+ return c.Type == CardTypes.Equipment
+ })
+ e := NewCard(candidates[rand.Intn(len(candidates))].Path())
+ tiles := s._map.AvailableTilesFor(e)
+ tile := tiles[rand.Intn(len(tiles))]
+ s.addNewEquipment(e, tile.Position, p)
+ }
+
units := make([]*Card, 0, nUnits)
+ ai := s.PlayerById(2)
// Only use Melee Units
candidates := NewDeckFromCardPaths(Sets.Base.CardPaths()).FilterCards(func(c *Card) bool {
if c.Type != CardTypes.Unit {
@@ -69,7 +82,6 @@ func prepCavArcherChallenge(s *LocalState) *LocalState {
for _, u := range units {
tiles := s._map.AvailableTilesFor(u)
tile := tiles[rand.Intn(len(tiles))]
- ai := s.PlayerById(2)
s.addNewUnit(u, tile.Position, ai)
}