From 45df9bf319d38db916ca983b8c92bb912f5ce9ee Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 8 Feb 2023 17:50:10 +0100 Subject: intermediate commit --- go/game/areaEffect.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'go/game/areaEffect.go') diff --git a/go/game/areaEffect.go b/go/game/areaEffect.go index 8991bc3c..4cba29e9 100644 --- a/go/game/areaEffect.go +++ b/go/game/areaEffect.go @@ -25,3 +25,27 @@ func (e *dynamicAreaEffect) onLeaving(p Permanent) { e._onLeaving(p) } } + +func newGrantFullActionEffect(cardPath string, f ActionFuncPrototype, desc, tag string, +) *dynamicAreaEffect { + onEntering := func(p Permanent) { + if p.Card().Path() != cardPath { + return + } + + u := p.(*Unit) + fa := NewFullAction(u, f, desc) + fa.tag = tag + u.FullActions = append(u.FullActions, fa) + } + + onLeaving := func(p Permanent) { + if p.Card().Path() != cardPath { + return + } + u := p.(*Unit) + u.removeFullAction(tag) + } + + return newDynamicAreaEffect(onEntering, onLeaving) +} -- cgit v1.2.3