diff options
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{}, |
