clamp hp to zero

This commit is contained in:
Branden J Brown 2024-01-29 13:18:26 -06:00
parent a3bf457fd6
commit f3fbec98d7
1 changed files with 1 additions and 0 deletions

View File

@ -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