Keep a cooldown ring honest when a speed-up starts or ends in the middle
An ability ring that is 60 percent full should still be 60 percent full the moment a haste bonus starts, only filling faster. Storing an end time instead of a fill makes the ring jump, and a ring that finishes twice in one frame loses the spare time. Here is a ring that stores the fill and the speed separately.
Why this works
A ring shows how much of the work is done, and that does not change just because the pace does. Keeping the finished part and applying the pace only to new progress means a speed-up can never make the ring jump or lose time.
When not to use it
Do not use it when the wait must end at a fixed, announced moment, such as a daily reward or a timed event for all players. There the end time is the promise, and it should be stored and checked on its own.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- A diagram of every state
- 22 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Keep a cooldown ring honest when a speed-up starts or ends in the middle" (read_entry idle-cooldown-keeps-its-fill-when-speed-changes) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP