From 15b7e221b799ef107dec44ecdb294026dfd3d059 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 24 Jun 2026 22:55:35 -0400 Subject: refactor: pulled techs out to yaml files, unified numerous combat functions, broke up game object --- internal/game/ui_combat.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'internal/game/ui_combat.go') 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) +} -- cgit v1.2.3