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-01-27 16:43:53 +0100
commit5caa446e8d95bb55c66cd79b5fb10e6f7cf61aec (patch)
treedd496091bcce132f1384ccc67951619862d4868e /go/game/action.go
parentd63c4bf273011945455d18b5444890c16db0396c (diff)
downloadmuhqs-game-5caa446e8d95bb55c66cd79b5fb10e6f7cf61aec.tar.gz
muhqs-game-5caa446e8d95bb55c66cd79b5fb10e6f7cf61aec.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