From 9fdd62fda301e16f012c0ca9df1fc3135e945fd8 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 23 Feb 2019 22:10:12 +0100 Subject: [PATCH] Avoid negative health bar color. Resolves #1751. --- evennia/contrib/health_bar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evennia/contrib/health_bar.py b/evennia/contrib/health_bar.py index c3d4af1c52..5ccfa1acbd 100644 --- a/evennia/contrib/health_bar.py +++ b/evennia/contrib/health_bar.py @@ -90,7 +90,7 @@ def display_meter(cur_value, max_value, # Pick which fill color to use based on how full the bar is fillcolor_index = (float(len(fill_color)) * percent_full) - fillcolor_index = int(round(fillcolor_index)) - 1 + fillcolor_index = max(0, int(round(fillcolor_index)) - 1) fillcolor_code = "|[" + fill_color[fillcolor_index] # Make color codes for empty bar portion and text_color