From 74ae4f091755544906bb2bb38bd360cc4d7b6237 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 20 Feb 2023 21:13:47 +0100 Subject: implement equip action --- go/game/cardImplementations.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'go/game/cardImplementations.go') diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go index 7055fe03..67b52315 100644 --- a/go/game/cardImplementations.go +++ b/go/game/cardImplementations.go @@ -5,8 +5,20 @@ import ( ) func adjustMelee(p Permanent, damage int) { - if u, ok := p.(*Unit); ok && !INVALID_ATTACK(u.Attack) { - u.Attack.attacks[0] += damage + log.Println("adjusting melee") + u, ok := p.(*Unit) + if !ok { + return + } + + if INVALID_ATTACK(u.Attack) { + u.Attack.attacks = append(u.Attack.attacks, 1) + } else { + if u.Attack.attacks[0]+damage == 0 { + u.Attack.attacks = nil + } else { + u.Attack.attacks[0] += damage + } } } -- cgit v1.2.3