From b810c024c301fdbe3d0833422bd18449d66d276a Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 15 Feb 2023 15:49:50 +0100 Subject: implement the basics of the rest of the base cards * Add more TODOs * Implement permanents granting more spawn tiles --- go/game/state.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'go/game/state.go') diff --git a/go/game/state.go b/go/game/state.go index 5c2fd053..a5a9de82 100644 --- a/go/game/state.go +++ b/go/game/state.go @@ -409,6 +409,16 @@ func (s *State) resolvePlay(p *Player, c *Card, targets *Targets) { } } +func (s *State) additionalSpawnsFor(p *Player, cType CardType) (spawns []*Tile) { + for _, perm := range s.Permanents { + if perm.Controller() != p { + continue + } + spawns = append(spawns, perm.Card().Impl.additionalSpawnsFor(perm, cType)...) + } + return +} + func (s *State) SpawnTiles(p *Player) []*Tile { spawns := s.Map.FilterTiles(func(t *Tile) bool { if t.Type != TileTypes.Spawn { @@ -459,6 +469,8 @@ func (s *State) AvailableSpawnTiles(p *Player, c *Card) []*Tile { } else { candidates = s.SpawnTiles(p) } + + candidates = append(candidates, s.additionalSpawnsFor(p, c.Type)...) } tiles := []*Tile{} -- cgit v1.2.3