aboutsummaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
Diffstat (limited to 'go')
-rw-r--r--go/game/action.go7
-rw-r--r--go/game/targets.go8
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") {