From 5898ef394b5ee99a1c7bf75b6dfcaf039eb00945 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 4 Sep 2025 20:01:27 +0200 Subject: implement power_to_the_people! --- go/game/cardImplementations.go | 17 +++++++++++++---- go/game/cardImplementations_test.go | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) (limited to 'go') diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go index 926a3cad..1f7af599 100644 --- a/go/game/cardImplementations.go +++ b/go/game/cardImplementations.go @@ -794,6 +794,14 @@ func (*patricianImpl) freeActions(p Permanent) []*FreeAction { return []*FreeAction{m, a, ar, d, r} } +type powerToThePeopleImpl struct{ cardImplementationBase } + +func (*powerToThePeopleImpl) onPlay(a *PlayAction) { + p := a.Controller() + n := len(p.gameState.OwnUnits(p)) + p.gainResource(n) +} + type recycleImpl struct{ cardImplementationBase } func (*recycleImpl) playTargets() TargetDesc { @@ -856,9 +864,10 @@ func init() { "kraken/tides_change!": &tidesChangeImpl{}, "kraken/unholy_cannonball": &unholyCannonballImpl{}, - "exp1/illusion": &illusionImpl{}, - "exp1/illusionist": &illusionistImpl{}, - "exp1/patrician": &patricianImpl{}, - "exp1/recycle!": &recycleImpl{}, + "exp1/illusion": &illusionImpl{}, + "exp1/illusionist": &illusionistImpl{}, + "exp1/patrician": &patricianImpl{}, + "exp1/power_to_the_people!": &powerToThePeopleImpl{}, + "exp1/recycle!": &recycleImpl{}, } } diff --git a/go/game/cardImplementations_test.go b/go/game/cardImplementations_test.go index f75e4d80..b3ac5811 100644 --- a/go/game/cardImplementations_test.go +++ b/go/game/cardImplementations_test.go @@ -325,3 +325,24 @@ func TestRecycle(t *testing.T) { t.Fatal("Hand does not contain one cards") } } + +func TestPowerToThePeople(t *testing.T) { + s, _, player, _ := newMockState() + player.Resource = 3 + + for y := range 2 { + for x := range 2 { + s.addNewUnit(NewCard("base/archer"), Position{x, y}, player) + } + } + + c := NewCard("exp1/power_to_the_people!") + player.Hand.AddCard(c) + a := NewPlayAction(player, c) + + s.declareAction(a) + s.stack.pop() + if player.Resource != 4 { + t.Fatal("Not gained 4 resource") + } +} -- cgit v1.2.3