From f3fbec98d733d8a1a79a9eef169b4b779af7b1a5 Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Mon, 29 Jan 2024 13:18:26 -0600 Subject: [PATCH] clamp hp to zero --- game/game.go | 1 + 1 file changed, 1 insertion(+) diff --git a/game/game.go b/game/game.go index 48013fd..ddc6113 100644 --- a/game/game.go +++ b/game/game.go @@ -191,6 +191,7 @@ func (g *Match) Shoot(id player.ID, self bool) error { if live { target.hp -= g.damage if target.hp <= 0 { + target.hp = 0 // in case it goes negative // If the target is the challenger, the match is over as well. if target == &g.players[1] { g.round = 3