Fix prompt template to show PL as gauge with max value

This commit is contained in:
Jared Miller 2026-02-14 10:34:20 -05:00
parent 7ec5ccb87a
commit 21caa099c8
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C
2 changed files with 10 additions and 10 deletions

View file

@ -11,8 +11,8 @@ if TYPE_CHECKING:
# Default prompt templates by mode
DEFAULT_TEMPLATES: dict[str, str] = {
"normal": "{stamina_gauge} {pl} > ",
"combat": "{stamina_gauge} {pl} vs {opponent} > ",
"normal": "{stamina_gauge} <{pl}/{max_pl}> ",
"combat": "{stamina_gauge} <{pl}/{max_pl}> vs {opponent} > ",
"editor": "editor> ",
"if": "> ",
}

View file

@ -29,7 +29,7 @@ def test_normal_mode_prompt():
)
result = render_prompt(player)
# 50% is in 30-59% range, should be yellow
assert result == "\033[33m<50%>\033[0m 200 > "
assert result == "\033[33m<50%>\033[0m <200/100> "
def test_combat_mode_with_opponent():
@ -48,7 +48,7 @@ def test_combat_mode_with_opponent():
result = render_prompt(player)
# 50% is in 30-59% range, should be yellow
assert result == "\033[33m<50%>\033[0m 200 vs Vegeta > "
assert result == "\033[33m<50%>\033[0m <200/100> vs Vegeta > "
def test_combat_mode_as_defender():
@ -67,7 +67,7 @@ def test_combat_mode_as_defender():
result = render_prompt(player)
# 50% is in 30-59% range, should be yellow
assert result == "\033[33m<50%>\033[0m 200 vs Vegeta > "
assert result == "\033[33m<50%>\033[0m <200/100> vs Vegeta > "
def test_editor_mode_static_prompt():
@ -107,7 +107,7 @@ def test_zero_stamina():
)
result = render_prompt(player)
# 0% is < 30%, should be red
assert result == "\033[31m<0%>\033[0m 200 > "
assert result == "\033[31m<0%>\033[0m <200/100> "
def test_max_stamina():
@ -121,7 +121,7 @@ def test_max_stamina():
)
result = render_prompt(player)
# 100% is >= 60%, should be green
assert result == "\033[32m<100%>\033[0m 200 > "
assert result == "\033[32m<100%>\033[0m <200/100> "
def test_fractional_percentage():
@ -135,7 +135,7 @@ def test_fractional_percentage():
)
result = render_prompt(player)
# 33% is in 30-59% range, should be yellow
assert result == "\033[33m<33%>\033[0m 200 > "
assert result == "\033[33m<33%>\033[0m <200/100> "
def test_fractional_pl():
@ -149,7 +149,7 @@ def test_fractional_pl():
)
result = render_prompt(player)
# 50% is in 30-59% range, should be yellow
assert result == "\033[33m<50%>\033[0m 200 > "
assert result == "\033[33m<50%>\033[0m <200/100> "
def test_custom_template_overrides_default():
@ -222,7 +222,7 @@ def test_no_color_support():
)
result = render_prompt(player)
# Should have no ANSI codes, just text
assert result == "<50%> 200 > "
assert result == "<50%> <200/100> "
assert "\033[" not in result