diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-08 12:44:07 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:48 +0100 |
| commit | 5dae3b7e97669bc6ad5dfc61bbb1903aeb03aaf3 (patch) | |
| tree | 62ce4be85d1014d797cfadbebe38e6a11872dbf3 /go/game/card.go | |
| parent | bb7810a4bb0ee1a3c21de67e857ca41596646da3 (diff) | |
| download | muhqs-game-5dae3b7e97669bc6ad5dfc61bbb1903aeb03aaf3.tar.gz muhqs-game-5dae3b7e97669bc6ad5dfc61bbb1903aeb03aaf3.zip | |
intermediate commit
* detect tokens and do not add them to pile of cards
* only add spells not already in exile to their owners discard pile
* add the played card to onPlay callback
Diffstat (limited to 'go/game/card.go')
| -rw-r--r-- | go/game/card.go | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/go/game/card.go b/go/game/card.go index c1c74490..a6abffd1 100644 --- a/go/game/card.go +++ b/go/game/card.go @@ -80,7 +80,7 @@ type cardImplementation interface { onEntering(*Tile) onLeaving(*Tile) - onPlay(*State, *Player, *Targets) + onPlay(*State, *Card, *Player, *Targets) onPile(containing Permanent) onUnpile(containing Permanent) onDrop(dropped Permanent) @@ -98,12 +98,12 @@ func (*cardImplementationBase) freeActions(Permanent) []*FreeAction { return nil func (*cardImplementationBase) stateBasedActions(*State, Permanent) {} -func (*cardImplementationBase) onEntering(*Tile) {} -func (*cardImplementationBase) onLeaving(*Tile) {} -func (*cardImplementationBase) onPlay(*State, *Player, *Targets) {} -func (*cardImplementationBase) onPile(Permanent) {} -func (*cardImplementationBase) onUnpile(Permanent) {} -func (*cardImplementationBase) onDrop(Permanent) {} +func (*cardImplementationBase) onEntering(*Tile) {} +func (*cardImplementationBase) onLeaving(*Tile) {} +func (*cardImplementationBase) onPlay(*State, *Card, *Player, *Targets) {} +func (*cardImplementationBase) onPile(Permanent) {} +func (*cardImplementationBase) onUnpile(Permanent) {} +func (*cardImplementationBase) onDrop(Permanent) {} // Map of all card implementations var cardImplementations map[string]cardImplementation @@ -312,6 +312,17 @@ func (c *Card) IsPermanent() bool { c.Type == CardTypes.Potion } +func (c *Card) IsToken() bool { + if v, found := c.Values["token"]; found { + b, ok := v.(bool) + if !ok { + log.Fatalf("Invalid value for %s token value: %v", c.Name, v) + } + return b + } + return false +} + func (c *Card) IsBuyable() bool { return c.BuyCost != NOT_BUYABLE } |
