Fix prompt template to show PL as gauge with max value
This commit is contained in:
parent
7ec5ccb87a
commit
21caa099c8
2 changed files with 10 additions and 10 deletions
|
|
@ -11,8 +11,8 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
# Default prompt templates by mode
|
# Default prompt templates by mode
|
||||||
DEFAULT_TEMPLATES: dict[str, str] = {
|
DEFAULT_TEMPLATES: dict[str, str] = {
|
||||||
"normal": "{stamina_gauge} {pl} > ",
|
"normal": "{stamina_gauge} <{pl}/{max_pl}> ",
|
||||||
"combat": "{stamina_gauge} {pl} vs {opponent} > ",
|
"combat": "{stamina_gauge} <{pl}/{max_pl}> vs {opponent} > ",
|
||||||
"editor": "editor> ",
|
"editor": "editor> ",
|
||||||
"if": "> ",
|
"if": "> ",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ def test_normal_mode_prompt():
|
||||||
)
|
)
|
||||||
result = render_prompt(player)
|
result = render_prompt(player)
|
||||||
# 50% is in 30-59% range, should be yellow
|
# 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():
|
def test_combat_mode_with_opponent():
|
||||||
|
|
@ -48,7 +48,7 @@ def test_combat_mode_with_opponent():
|
||||||
|
|
||||||
result = render_prompt(player)
|
result = render_prompt(player)
|
||||||
# 50% is in 30-59% range, should be yellow
|
# 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():
|
def test_combat_mode_as_defender():
|
||||||
|
|
@ -67,7 +67,7 @@ def test_combat_mode_as_defender():
|
||||||
|
|
||||||
result = render_prompt(player)
|
result = render_prompt(player)
|
||||||
# 50% is in 30-59% range, should be yellow
|
# 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():
|
def test_editor_mode_static_prompt():
|
||||||
|
|
@ -107,7 +107,7 @@ def test_zero_stamina():
|
||||||
)
|
)
|
||||||
result = render_prompt(player)
|
result = render_prompt(player)
|
||||||
# 0% is < 30%, should be red
|
# 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():
|
def test_max_stamina():
|
||||||
|
|
@ -121,7 +121,7 @@ def test_max_stamina():
|
||||||
)
|
)
|
||||||
result = render_prompt(player)
|
result = render_prompt(player)
|
||||||
# 100% is >= 60%, should be green
|
# 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():
|
def test_fractional_percentage():
|
||||||
|
|
@ -135,7 +135,7 @@ def test_fractional_percentage():
|
||||||
)
|
)
|
||||||
result = render_prompt(player)
|
result = render_prompt(player)
|
||||||
# 33% is in 30-59% range, should be yellow
|
# 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():
|
def test_fractional_pl():
|
||||||
|
|
@ -149,7 +149,7 @@ def test_fractional_pl():
|
||||||
)
|
)
|
||||||
result = render_prompt(player)
|
result = render_prompt(player)
|
||||||
# 50% is in 30-59% range, should be yellow
|
# 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():
|
def test_custom_template_overrides_default():
|
||||||
|
|
@ -222,7 +222,7 @@ def test_no_color_support():
|
||||||
)
|
)
|
||||||
result = render_prompt(player)
|
result = render_prompt(player)
|
||||||
# Should have no ANSI codes, just text
|
# Should have no ANSI codes, just text
|
||||||
assert result == "<50%> 200 > "
|
assert result == "<50%> <200/100> "
|
||||||
assert "\033[" not in result
|
assert "\033[" not in result
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue