From e8f44219976edf8cf57cbd9e964f66fe9d145a9c Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 2 Feb 2023 00:13:30 +0100 Subject: change unit attack representation and implement sword --- go/game/cardImplementations.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'go/game/cardImplementations.go') diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go index 8024e4fc..b20b46bc 100644 --- a/go/game/cardImplementations.go +++ b/go/game/cardImplementations.go @@ -46,10 +46,27 @@ func (impl *missionaryImplementation) fullAction(u *Unit) []*FullAction { return []*FullAction{NewFullAction(u, resolvePrototype, "put faith ...")} } +type swordImplementation struct { + cardImplementationBase +} + +func (*swordImplementation) onPile(p Permanent) { + if u, ok := p.(*Unit); ok && !INVALID_ATTACK(u.Attack) { + u.Attack.attacks[0] += 1 + } +} + +func (*swordImplementation) onDrop(p Permanent) { + if u, ok := p.(*Unit); ok && !INVALID_ATTACK(u.Attack) { + u.Attack.attacks[0] -= 1 + } +} + func init() { cardImplementations = map[string]cardImplementation{ "base/advisor": &advisorImplementation{}, "base/missionary": &missionaryImplementation{}, + "base/sword": &swordImplementation{}, "misc/farmer": &farmerImplementation{}, } -- cgit v1.2.3