aboutsummaryrefslogtreecommitdiff
path: root/go/game/card.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-12-27 12:40:19 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-27 16:43:58 +0100
commit4e2ab55d345fd5e5c5d2d5bc56948611b15564d5 (patch)
treec6998ac54687c442ad0baa541edd0fbf917b1308 /go/game/card.go
parent5aa8e7ddbc41aed55e7918e6afaec0b5c07fa510 (diff)
downloadmuhqs-game-4e2ab55d345fd5e5c5d2d5bc56948611b15564d5.tar.gz
muhqs-game-4e2ab55d345fd5e5c5d2d5bc56948611b15564d5.zip
introduce game.State interface abstraction
This allows to not use the internal game state directly from client code.
Diffstat (limited to 'go/game/card.go')
-rw-r--r--go/game/card.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/go/game/card.go b/go/game/card.go
index ee16346c..90dd8f2b 100644
--- a/go/game/card.go
+++ b/go/game/card.go
@@ -90,20 +90,20 @@ func (ct CardType) IsArtifact() bool {
}
type cardImplementation interface {
- spawnTiles(*State, *Player) []*Tile
+ spawnTiles(*LocalState, *Player) []*Tile
fullActions(*Unit) []*FullAction
freeActions(Permanent) []*FreeAction
playTargets() TargetDesc
- stateBasedActions(*State, Permanent)
+ stateBasedActions(*LocalState, Permanent)
additionalSpawnsFor(Permanent, CardType) []*Tile
onEntering(*Tile)
onLeaving(*Tile)
onPlay(*PlayAction)
- onETB(*State, Permanent)
+ onETB(*LocalState, Permanent)
onPile(containing Permanent)
onUnpile(containing Permanent)
onDrop(dropped Permanent)
@@ -115,23 +115,23 @@ type cardImplementation interface {
// default behavior.
type cardImplementationBase struct{}
-func (*cardImplementationBase) spawnTiles(*State, *Player) []*Tile { return nil }
-func (*cardImplementationBase) fullActions(*Unit) []*FullAction { return nil }
-func (*cardImplementationBase) freeActions(Permanent) []*FreeAction { return nil }
+func (*cardImplementationBase) spawnTiles(*LocalState, *Player) []*Tile { return nil }
+func (*cardImplementationBase) fullActions(*Unit) []*FullAction { return nil }
+func (*cardImplementationBase) freeActions(Permanent) []*FreeAction { return nil }
func (*cardImplementationBase) playTargets() TargetDesc { return INVALID_TARGET_DESC }
-func (*cardImplementationBase) stateBasedActions(*State, Permanent) {}
+func (*cardImplementationBase) stateBasedActions(*LocalState, Permanent) {}
func (*cardImplementationBase) additionalSpawnsFor(Permanent, CardType) []*Tile { return nil }
-func (*cardImplementationBase) onEntering(*Tile) {}
-func (*cardImplementationBase) onLeaving(*Tile) {}
-func (*cardImplementationBase) onPlay(*PlayAction) {}
-func (*cardImplementationBase) onETB(*State, Permanent) {}
-func (*cardImplementationBase) onPile(Permanent) {}
-func (*cardImplementationBase) onUnpile(Permanent) {}
-func (*cardImplementationBase) onDrop(Permanent) {}
+func (*cardImplementationBase) onEntering(*Tile) {}
+func (*cardImplementationBase) onLeaving(*Tile) {}
+func (*cardImplementationBase) onPlay(*PlayAction) {}
+func (*cardImplementationBase) onETB(*LocalState, Permanent) {}
+func (*cardImplementationBase) onPile(Permanent) {}
+func (*cardImplementationBase) onUnpile(Permanent) {}
+func (*cardImplementationBase) onDrop(Permanent) {}
// Map of all card implementations
var cardImplementations map[string]cardImplementation