aboutsummaryrefslogtreecommitdiff
path: root/go/game/action.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-08-03 19:41:20 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:07 +0200
commita3e558ff022fb9c38e9edcf2ced51cfa95b8de4c (patch)
treef907aee0ba70ca8347f6ec88458f0faea0413462 /go/game/action.go
parent49a5eda54785976028e360ef1af311dfcc8e1560 (diff)
downloadmuhqs-game-a3e558ff022fb9c38e9edcf2ced51cfa95b8de4c.tar.gz
muhqs-game-a3e558ff022fb9c38e9edcf2ced51cfa95b8de4c.zip
add skeleton for triggers and triggered actions
Diffstat (limited to 'go/game/action.go')
-rw-r--r--go/game/action.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/go/game/action.go b/go/game/action.go
index fbabb06b..4f433845 100644
--- a/go/game/action.go
+++ b/go/game/action.go
@@ -79,6 +79,29 @@ func (a *ActionBase) CheckTargets(s *State) error {
return a.targets.CheckTargets(s)
}
+type TriggeredAction struct {
+ ActionBase
+ event Event
+}
+
+func newTriggeredAction(event Event, source Trigger, resolveFunc ActionResolveFunc,
+ costFunc ActionCostFunc,
+) *TriggeredAction {
+ return &TriggeredAction{
+ ActionBase: ActionBase{
+ source: source,
+ Card: source.Card(),
+ resolveFunc: resolveFunc,
+ costFunc: costFunc,
+ },
+ event: event,
+ }
+}
+
+func (a *TriggeredAction) String() string {
+ return fmt.Sprintf("%v ! %v", a.event, a.source)
+}
+
type PileDropAction struct {
ActionBase
pile []Permanent