diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-09-08 15:38:07 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-09-08 15:41:45 +0200 |
| commit | a3ca136cd776ff0089dc33e401d1fc474dc17138 (patch) | |
| tree | 1968a8ff318c7f021e2cc94df5a057eeee39b099 /go/game/cardImplementations.go | |
| parent | ee605fa7fa48803756b0c3216afc4bd692ec144a (diff) | |
| download | muhqs-game-a3ca136cd776ff0089dc33e401d1fc474dc17138.tar.gz muhqs-game-a3ca136cd776ff0089dc33e401d1fc474dc17138.zip | |
support explicitly winning and implement Approach Supremacy!
Diffstat (limited to 'go/game/cardImplementations.go')
| -rw-r--r-- | go/game/cardImplementations.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go index 0780d6f9..0af99570 100644 --- a/go/game/cardImplementations.go +++ b/go/game/cardImplementations.go @@ -741,6 +741,33 @@ func (*unholyCannonballImpl) onPlay(a *PlayAction) { // ====== Exp1 Set ====== +type approachSupremacyImpl struct { + cardImplementationBase + cast map[*Player]int +} + +// Use an additionalPlayCost function to track the times the spell was cast. +// Since no real additional costs exists the function always returns true. +func (impl *approachSupremacyImpl) additionalPlayCosts(a *PlayAction) ActionCostFunc { + return func(*LocalState) bool { + p := a.Controller() + if _, found := impl.cast[p]; !found { + impl.cast[p] = 1 + } else { + impl.cast[p] += 1 + } + return true + } +} + +// Win the game if the spell resolves and was cast three or more times +func (impl *approachSupremacyImpl) onPlay(a *PlayAction) { + p := a.Controller() + if impl.cast[p] >= 3 { + p.win() + } +} + type backupImpl struct{ cardImplementationBase } func (*backupImpl) onPlay(a *PlayAction) { @@ -911,6 +938,7 @@ func init() { "kraken/tides_change!": &tidesChangeImpl{}, "kraken/unholy_cannonball": &unholyCannonballImpl{}, + "exp1/approach_supremacy!": &approachSupremacyImpl{cast: make(map[*Player]int)}, "exp1/backup!": &backupImpl{}, "exp1/illusion": &illusionImpl{}, "exp1/illusionist": &illusionistImpl{}, |
