Give each running power-up its own HUD indicator - #127
Conversation
Both HUDs listed a running power-up as one line of text, "<label>: <n>s", which identified it only by name and stepped down once a second. Each power-up now gets an indicator carrying the symbol it is drawn with on the grid and a meter that drains with its timer - filled in the power-up's own color in the graphical UI, block characters in the text UI. getActivePowerUpStatuses() hands over plain data (symbol, color, seconds left, fraction of the duration left) rather than a formatted string, so each renderer presents an indicator in its own idiom and gameplay stays out of the UI. Closes #72 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Self-review (posted as a comment rather than as a Review object, because the reviews API is not available to this session; each finding is anchored below as The change does what it says: src/textui/textrenderer.py:166 — src/ophidian.py:869 — docstring line break splits "power-up" as "power / -up". A wrapping artifact in the new tests/rendering/test_hud_and_banner.py:175 — meter geometry and the power-up's color are restated as literals in the tests. This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). |
formatDurationMeter now clamps the cell count instead of trusting the fraction it is given, so a value outside 0..1 can't collapse the empty half of the bar and change its width. The pygame meter tests derive their sample points from POWER_UP_INDICATOR_METER_WIDTH and their expected color from the registry, rather than restating both as pixel literals. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Summary
"<label>: <n>s"text line that identified a power-up only by name and stepped down once a second.Ophidian.getActivePowerUpStatuses()now returns records of plain data (symbol,color,secondsRemaining,durationSeconds,fractionRemaining) instead of(label, seconds)tuples, so nothing is pre-formatted by gameplay and each renderer presents an indicator in its own idiom. The UI/gameplay decoupling asked for in PR Add text-based UI option with clean architecture, comprehensive testing, CI/CD verification, and performance optimizations #95 is preserved.fractionRemainingis what makes activation and expiry read smoothly: it falls continuously across frames where the whole seconds beside it only change once a second, and it returns to a full meter when an already-running power-up is collected again. Animated transitions beyond that are left to Add Menu Transitions and Animations #79, which is scoped to animations.getPowerUpColor()andgetPowerUpTextSymbol()were added alongside the existinggetPowerUpHudLabel(), so the HUD is not made to read a registry dictionary directly nor to hold aPowerUpentity that has already been removed from the board.config.graywas added for the unfilled track of a HUD meter.README.mdwas updated to describe what an indicator shows.Test plan
python -m pytest— 231 passed (223 before, 8 added)fractionRemainingmid-run and after a refresh, the text meter's format and its full/empty ends, the graphical meter being drawn and drainingpython -m compileall srcblackandautoflake(viaformat.sh) report no changesCloses #72
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).