diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-12-26 18:52:15 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:57 +0100 |
| commit | 5684983b963eeb2f498028360ebc17cc2fb32564 (patch) | |
| tree | 0a9e4c95b7d38ff664190eaee7168830997efcbf /go/game/state.go | |
| parent | d1d926debe4d261e057980f325741440b3d76609 (diff) | |
| download | muhqs-game-5684983b963eeb2f498028360ebc17cc2fb32564.tar.gz muhqs-game-5684983b963eeb2f498028360ebc17cc2fb32564.zip | |
pass the PlayAction to the cards onPlay implementations
This is done to propagate the chosen variadic play cost to the
card implementation.
Diffstat (limited to 'go/game/state.go')
| -rw-r--r-- | go/game/state.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/go/game/state.go b/go/game/state.go index 021d88ab..078815da 100644 --- a/go/game/state.go +++ b/go/game/state.go @@ -557,7 +557,10 @@ func (s *State) EnemyUnits(player *Player) []*Unit { }) } -func (s *State) resolvePlay(p *Player, c *Card, targets *Targets) { +func (s *State) resolvePlay(a *PlayAction) { + p := a.Controller() + c := a.Card + targets := a.targets switch c.Type { case CardTypes.Unit: tile := targets.ts[0].sel[0].(*Tile) @@ -579,7 +582,7 @@ func (s *State) resolvePlay(p *Player, c *Card, targets *Targets) { s.addNewEquipment(c, tile.Position, p) } case CardTypes.Spell: - c.Impl.onPlay(s, c, p, targets) + c.Impl.onPlay(a) default: log.Printf("Resolving unhandled card type: %s\n", c.Type.String()) } |
