aboutsummaryrefslogtreecommitdiff
path: root/go/game
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-03-25 16:58:11 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:09 +0200
commit1bbc8ea18b13d81998c4f454c653674c5088380a (patch)
tree21778c3e8bc6470458e7e18934c78ca03ffd442d /go/game
parent770bc6cf967fc779775ccadc49fa4347859185a3 (diff)
downloadmuhqs-game-1bbc8ea18b13d81998c4f454c653674c5088380a.tar.gz
muhqs-game-1bbc8ea18b13d81998c4f454c653674c5088380a.zip
add onETB card hook
Diffstat (limited to 'go/game')
-rw-r--r--go/game/card.go2
-rw-r--r--go/game/cardParsing.go7
2 files changed, 9 insertions, 0 deletions
diff --git a/go/game/card.go b/go/game/card.go
index a7b9cc52..e52ad3dc 100644
--- a/go/game/card.go
+++ b/go/game/card.go
@@ -103,6 +103,7 @@ type cardImplementation interface {
onEntering(*Tile)
onLeaving(*Tile)
onPlay(*State, *Card, *Player, *Targets)
+ onETB(*State, Permanent)
onPile(containing Permanent)
onUnpile(containing Permanent)
onDrop(dropped Permanent)
@@ -127,6 +128,7 @@ func (*cardImplementationBase) additionalSpawnsFor(Permanent, CardType) []*Tile
func (*cardImplementationBase) onEntering(*Tile) {}
func (*cardImplementationBase) onLeaving(*Tile) {}
func (*cardImplementationBase) onPlay(*State, *Card, *Player, *Targets) {}
+func (*cardImplementationBase) onETB(*State, Permanent) {}
func (*cardImplementationBase) onPile(Permanent) {}
func (*cardImplementationBase) onUnpile(Permanent) {}
func (*cardImplementationBase) onDrop(Permanent) {}
diff --git a/go/game/cardParsing.go b/go/game/cardParsing.go
index b14f3f96..2a53926e 100644
--- a/go/game/cardParsing.go
+++ b/go/game/cardParsing.go
@@ -22,6 +22,7 @@ type dynamicCardImplementation struct {
_onEntering func(*Tile)
_onLeaving func(*Tile)
_onPlay func(*State, *Card, *Player, *Targets)
+ _onETB func(*State, Permanent)
_onPile func(Permanent)
_onUnpile func(Permanent)
_onDrop func(Permanent)
@@ -83,6 +84,12 @@ func (impl *dynamicCardImplementation) onPlay(s *State, c *Card, p *Player, t *T
}
}
+func (impl *dynamicCardImplementation) onETB(s *State, p Permanent) {
+ if impl._onETB != nil {
+ impl._onETB(s, p)
+ }
+}
+
func (impl *dynamicCardImplementation) onPile(p Permanent) {
if impl._onPile != nil {
impl._onPile(p)