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-08-20 15:57:33 +0200
commit1393e8ff52d4d07cd8504c11450861888ca33ad2 (patch)
treecef670d6a34f48422887f6449ac9d21eadc203f5
parent3e070cedf2455cb7513c0200512f2105fa2f1871 (diff)
downloadmuhqs-game-1393e8ff52d4d07cd8504c11450861888ca33ad2.tar.gz
muhqs-game-1393e8ff52d4d07cd8504c11450861888ca33ad2.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)
}