aboutsummaryrefslogtreecommitdiff
path: root/internal/game/ui_combat.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/ui_combat.go')
-rw-r--r--internal/game/ui_combat.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/game/ui_combat.go b/internal/game/ui_combat.go
index ef00fd5..77faae8 100644
--- a/internal/game/ui_combat.go
+++ b/internal/game/ui_combat.go
@@ -2,7 +2,10 @@ package game
import "thehouseoficarus/internal/net"
-func (g *Game) hpBar(sess *net.Session, current, max int) string {
+// renderBar is the shared bar renderer for both HP bars and task-progress bars.
+// lowColor is the color used when the value falls below 40% (160 red for HP,
+// 39 cyan for progress).
+func (g *Game) renderBar(sess *net.Session, current, max, lowColor int) string {
if max <= 0 {
max = 1
}
@@ -21,7 +24,7 @@ func (g *Game) hpBar(sess *net.Session, current, max int) string {
case pct >= 40:
fgColor = 220
default:
- fgColor = 160
+ fgColor = lowColor
}
unicode := sess.Player != nil && sess.Player.OptionBool("unicode")
@@ -29,3 +32,7 @@ func (g *Game) hpBar(sess *net.Session, current, max int) string {
bar := RenderColoredBar(current, max, 10, unicode, style, g.colorMode(sess))
return "[" + bar + "]"
}
+
+func (g *Game) hpBar(sess *net.Session, current, max int) string {
+ return g.renderBar(sess, current, max, 160)
+}