aboutsummaryrefslogtreecommitdiff
path: root/internal/game/ui_combat.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-24 22:55:35 -0400
committerhistoria <[not public]>2026-06-24 22:55:35 -0400
commit15b7e221b799ef107dec44ecdb294026dfd3d059 (patch)
tree3748e464a77f0f082bea1567e9d6990052054961 /internal/game/ui_combat.go
parent9d4b799db4868bcab291b83599ff088763cd4ed6 (diff)
downloadthehouseoficarus-15b7e221b799ef107dec44ecdb294026dfd3d059.tar.gz
refactor: pulled techs out to yaml files, unified numerous combat functions, broke up game object
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)
+}