diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-20 21:13:47 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:51 +0100 |
| commit | 74ae4f091755544906bb2bb38bd360cc4d7b6237 (patch) | |
| tree | 01dc6ae303daaa671edbc2223091a5ffb64e6f1e /go/game/cardImplementations.go | |
| parent | 14f7b0274a20ffc8189d18de5031defcc15e9890 (diff) | |
| download | muhqs-game-74ae4f091755544906bb2bb38bd360cc4d7b6237.tar.gz muhqs-game-74ae4f091755544906bb2bb38bd360cc4d7b6237.zip | |
implement equip action
Diffstat (limited to 'go/game/cardImplementations.go')
| -rw-r--r-- | go/game/cardImplementations.go | 16 |
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 + } } } |
