diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-20 21:13:47 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:50:11 +0200 |
| commit | 2c1c5090b59079f4ce74ac40985ea993a5389a39 (patch) | |
| tree | b45670325db1a4a5e82203e67e572c79dd699466 /go/game/cardImplementations.go | |
| parent | 50b9a042435b324be281b78ceb87dd63fd24acba (diff) | |
| download | muhqs-game-2c1c5090b59079f4ce74ac40985ea993a5389a39.tar.gz muhqs-game-2c1c5090b59079f4ce74ac40985ea993a5389a39.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 + } } } |
