diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-08-15 23:49:42 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:38 +0200 |
| commit | 9a0e003c823115baeaf3d9b2b7d3f3b74df8b096 (patch) | |
| tree | e7e44fa70f728a66f0701a4acabc1e3eb78081bb | |
| parent | 90b6c711bfebb5c5c96b46efab5a7eaa3fa6795c (diff) | |
| download | muhqs-game-9a0e003c823115baeaf3d9b2b7d3f3b74df8b096.tar.gz muhqs-game-9a0e003c823115baeaf3d9b2b7d3f3b74df8b096.zip | |
include the tile where a pile is dropped in the action
| -rw-r--r-- | go/game/action.go | 7 | ||||
| -rw-r--r-- | go/game/targets.go | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/go/game/action.go b/go/game/action.go index 08ef25cf..f588dce5 100644 --- a/go/game/action.go +++ b/go/game/action.go @@ -211,19 +211,19 @@ func NewDeclareTriggeredActionsAction(t []*TriggeredAction) *DeclareTriggeredAct type PileDropAction struct { ActionBase pile []Permanent + tile *Tile } func (a *PileDropAction) String() string { perm := a.source.(Permanent) controller := perm.Controller() if a.targets.RequireSelection() { - return fmt.Sprintf("%s drop %v", controller.Name, perm.Tile().Position) + return fmt.Sprintf("%s drop %v", controller.Name, a.tile) } s := fmt.Sprintf("%s drop [", controller.Name) - pile := perm.Pile() for i, t := range a.targets.ts { - s = fmt.Sprintf("%s %v@%v,", s, pile[i], t.sel[0]) + s = fmt.Sprintf("%s %v@%v,", s, a.pile[i], t.sel[0]) } return s[:len(s)-1] + " ]" } @@ -237,6 +237,7 @@ func newPileDropAction(perm Permanent, tile *Tile, pile []Permanent) *PileDropAc source: perm, }, pile, + tile, } a.resolveFunc = func(s *LocalState) { diff --git a/go/game/targets.go b/go/game/targets.go index 53b8bdcd..e056a5c0 100644 --- a/go/game/targets.go +++ b/go/game/targets.go @@ -704,7 +704,13 @@ func parseTileTargetConstraint(desc string, s *LocalState, action Action) []Targ } if strings.Contains(desc, "adjacent") { - constraints = append(constraints, rangeTargetConstraint(action.Source(), 1)) + var origin any + if pda, ok := action.(*PileDropAction); ok { + origin = pda.tile + } else { + origin = action.Source() + } + constraints = append(constraints, rangeTargetConstraint(origin, 1)) } if strings.Contains(desc, "free") { |
