aboutsummaryrefslogtreecommitdiff
path: root/go/game/cardImplementations.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/game/cardImplementations.go')
-rw-r--r--go/game/cardImplementations.go16
1 files changed, 14 insertions, 2 deletions
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
+ }
}
}