Skip to content

Commit 5b4e52b

Browse files
Clamp HP to zero
1 parent 9241894 commit 5b4e52b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

client/src/playback/Actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const ACTION_DEFINITIONS: Record<schema.Action, typeof Action<ActionUnion
9393
const target = round.bodies.getById(this.actionData.id())
9494

9595
// Apply damage to the target
96-
target.hp -= this.actionData.damage()
96+
target.hp = Math.max(target.hp - this.actionData.damage(), 0)
9797
}
9898
},
9999
[schema.Action.SplashAction]: class SplashAction extends Action<schema.SplashAction> {

client/src/playback/Bodies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export default class Bodies {
115115

116116
// Update properties
117117
body.pos = { x: turn.x(), y: turn.y() }
118-
body.hp = turn.health()
118+
body.hp = Math.max(turn.health(), 0)
119119
body.paint = turn.paint()
120120
body.moveCooldown = turn.moveCooldown()
121121
body.actionCooldown = turn.actionCooldown()

0 commit comments

Comments
 (0)