Show real decay rate in pearl time remaining - #40
Open
grepsedawk wants to merge 1 commit into
Open
Conversation
The pearl tooltip computed "Time remaining" and "Cost per X" from the base decay amount in config, but EssenceGlue speeds decay up by the prisoner's vote streak (1 + streak * 0.5) through a PearlDecayEvent listener. So a streaked prisoner's pearl drained far faster than the tag claimed. One freed in about 27 hours while reading "2 day", which is what the bug reports kept describing. Lore now asks for the effective decay amount via a preview PearlDecayEvent, the same event the real decay loop fires, so the displayed rate matches what actually happens. ExilePearl stays unaware of EssenceGlue; the event is the seam. The preview flag lets side-effecting listeners (logging, metrics) skip these dry runs while modifiers still adjust the amount. The streak drifts down as the prisoner stays offline, so the timer is a current estimate, not a fixed countdown. That's the honest best we can show without predicting future logins.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Prison pearl tooltips lied about how long a pearl would last. The "Time remaining" and "Cost per X" lines were computed from the base decay amount in config, but EssenceGlue speeds decay up by the prisoner's vote streak (
1 + streak * 0.5) via aPearlDecayEventlistener. A streaked prisoner's pearl drained much faster than the tag claimed. One freed in about 27 hours while reading "2 day", which matches the reports players kept filing.Fix
The lore now asks for the effective decay amount through a preview
PearlDecayEvent, the same event the real decay loop fires. EssenceGlue (and any other modifier) adjusts that preview just like a real tick, so the displayed rate matches reality. ExilePearl stays unaware of EssenceGlue; the event is the seam.PearlDecayEventgets apreviewflag so side-effecting listeners (logging, metrics) can skip dry runs, while modifiers still adjust the amount.ExilePearlApi.getEffectivePearlDecayAmount(pearl)fires the preview and reads the result back.CoreLoreGeneratoruses the effective amount for both the time and cost lines.Caveat
The streak drifts down as the prisoner stays offline, so the timer is a current estimate, not a fixed countdown. That's the honest best we can show without predicting future logins.
Testing
CoreLoreGeneratorTestpasses (9 tests, 0 failures), including a new case asserting a 2x streak multiplier halves the shown time (240 health at 48/day reads 5 days, not 10). Run locally via./gradlew :plugins:exilepearl-paper:test --tests "com.devotedmc.ExilePearl.core.CoreLoreGeneratorTest".