Skip to content

Make passive drift work and split the meditation ceiling between users - #62

Merged
XxFran10xX merged 1 commit into
mainfrom
fix/passive-drift-accumulates
Oct 20, 2026
Merged

XxFran10xX merged 1 commit into
mainfrom
fix/passive-drift-accumulates

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

Why

Players reported that resonance never seems to fall and that sharing a shrine doesn't split anything. Both are real.

Drift never applied. The tick runs once a second, so -0.02/h is a step of about 0.0000056. addResonance ignores changes below 0.0001, and values are rounded to two decimals, so every step was thrown away. On Main, characters who meditated to 100 cerrith were still at exactly 100.0 after hours online. Equilibrium drift (tranquility decay 0.03/h, passive corruption 0.05/h) had the same problem.

Sharing only split one sit. Meditation capped resonance at the circle's total stored aura. The 1/n user split applied to a single sit, and the running total reset when you stood up, so every sharer could still reach the full total by sitting again.

Changes

  • ResonanceSession carries the per-second drift remainder for each element and for equilibrium, and applies it in whole hundredths. It's kept in memory only, so drift runs while the character is online and offline time doesn't count. At current rates, -0.02/h is 0.01 every 30 online minutes.
  • The resonance tick saves the profile only when a value actually moves. It used to save every mage's profile every second. Profiles are still flushed when a character session ends.
  • The meditation ceiling is now the sitter's share: for each element, each artifact's usable aura divided by its own users in the last 7 days, summed across the ring. It's taken when the sit starts, so re-sitting gains nothing past it. Two sharers on a 100-aura artifact top out at 50 each.
  • Nobody loses resonance when someone joins. Characters already above their share keep it until decay lowers it.
  • MeditationCircle.elementPower is gone; its three callers use MeditationSitYield.elementShare.

Also ships with the next release: #61 (cast drift mana_divisor 100), already merged and already set in Main's live config.

Gameplay effect

  • Resonance and tranquility now actually decay while online: 0.48 resonance and 0.72 tranquility per online day at Main's rates. Corrupted characters now drift deeper at 0.05/h (compounding), as configured.
  • Sharing an artifact now splits it.

Tests

  • New unit tests: real-time drift (1,800 one-second ticks give 0.01), limits, saving only on change, share maths, muffled and empty artifacts, and the stand-up-and-re-sit case.
  • Local mvn verify on Windows: everything touched passes, with 100% coverage on the changed classes. The only failures are the existing Windows-only gear-ownership and profile-case tests (POSIX fsync and case-insensitive paths); Linux CI is the authority.
  • Dev: see the test comment below.

🤖 Generated with Claude Code

Resonance decay and equilibrium drift were lost every tick: the per-second
step (0.02/h is about 0.0000056) fell below the 0.0001 change threshold and
the two-decimal rounding. ResonanceSession now carries the remainder and
applies it in whole hundredths, only while the character is online. Profiles
are saved when a value actually moves instead of every second.

Meditation capped resonance at the circle's total stored aura, and the 1/n
user split only applied within one sit, so standing up and sitting again got
every sharer to the full total. The ceiling is now the sitter's share: each
artifact's usable aura divided by its users in the last 7 days, summed per
element. Characters already above their share keep it until decay lowers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c0634e57-66ce-4b2e-9c7c-0111d4c528bb
📥 Commits

Reviewing files that changed from the base of the PR and between 497d903 and e504ad7.

📒 Files selected for processing: 12
  • src/main/java/net/tfminecraft/magic/meditation/MeditationCeiling.java
  • src/main/java/net/tfminecraft/magic/meditation/MeditationCircle.java
  • src/main/java/net/tfminecraft/magic/meditation/MeditationSession.java
  • src/main/java/net/tfminecraft/magic/meditation/MeditationSitYield.java
  • src/main/java/net/tfminecraft/magic/service/EquilibriumService.java
  • src/main/java/net/tfminecraft/magic/service/ResonanceService.java
  • src/main/java/net/tfminecraft/magic/session/ResonanceSession.java
  • src/main/resources/config.yml
  • src/test/java/net/tfminecraft/magic/DomainTest.java
  • src/test/java/net/tfminecraft/magic/MeditationCircleTest.java
  • src/test/java/net/tfminecraft/magic/MeditationSessionTest.java
  • src/test/java/net/tfminecraft/magic/SessionServiceTest.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Meditation resonance limits now correctly use each sitter’s share of available elemental aura, rather than the circle’s total.
    • Resonance and equilibrium changes now apply smoothly in small increments, respecting configured boundaries and clearing stale drift when appropriate.
    • Resonance eligibility and meditation caps now account for usable artefacts, active users, muffled auras and previously consumed shares.
  • Documentation

    • Configuration comments now clarify how meditation elemental shares are calculated.

Meditation gain limits now use each sitter’s share of usable elemental fill. Passive resonance and equilibrium changes accumulate until they reach whole-hundredth increments, with drift cleared at specified boundary conditions.

Changes: Meditation elemental shares

Layer / File(s) Summary
Calculate and store sitter shares
src/main/java/net/tfminecraft/magic/meditation/MeditationSitYield.java, src/main/java/net/tfminecraft/magic/meditation/MeditationCircle.java, src/test/java/net/tfminecraft/magic/DomainTest.java, src/test/java/net/tfminecraft/magic/MeditationCircleTest.java, src/main/resources/config.yml
Yield snapshots aggregate usable elemental fill from pedestal items and divide it by active user counts. MeditationSitYield stores shares with normalised element keys. Tests cover share calculation and lookup. The config comments describe the share-based ceiling.
Apply shares to meditation caps
src/main/java/net/tfminecraft/magic/meditation/MeditationCeiling.java, src/main/java/net/tfminecraft/magic/meditation/MeditationCircle.java, src/main/java/net/tfminecraft/magic/meditation/MeditationSession.java, src/test/java/net/tfminecraft/magic/MeditationCircleTest.java, src/test/java/net/tfminecraft/magic/MeditationSessionTest.java
Resonance eligibility, reward limits, and capped-element checks use the sitter’s elemental share. Tests cover eligibility and limits across sessions.

Passive resonance and equilibrium drift

Layer / File(s) Summary
Accumulate and apply drift
src/main/java/net/tfminecraft/magic/session/ResonanceSession.java
ResonanceSession stores pending drift and applies signed whole-hundredth changes. Resonance uses existing setters; equilibrium drift respects a supplied floor. The session also exposes methods to clear drift.
Use drift from session services
src/main/java/net/tfminecraft/magic/service/EquilibriumService.java, src/main/java/net/tfminecraft/magic/service/ResonanceService.java, src/test/java/net/tfminecraft/magic/SessionServiceTest.java
The services delegate drift updates to ResonanceSession and clear drift at specified terminal conditions. Tests cover thresholds, bounds, drift clearing, and persistence.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Suggested reviewers: drefvelin, ryanbarlow97

Merge Risk: ⚪ Minimal · up to e504a

The reviewed share and drift changes have no established merge-blocking issue; merge after normal checks.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size:L 100-499 effective changed lines (tests excluded in mixed PRs). label Oct 20, 2026
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@XxFran10xX

Copy link
Copy Markdown
Contributor Author

Dev test (TFMCDev01, 2026-10-20, jar built from e504ad7)

Two real-character bots (ShareA, ShareB) on an 8-pedestal ring with one cerrith artifact filled to 60. They hit orbs by aiming at the orb particles. Results are from aura.log credits and magic resonance get:

Step Expected Result
ShareA alone (only user) share 60, 4 per hit 0 → 60 in 4s, "Meditation complete"
ShareB at 35 (2 users) share 30, sit refused "Nothing to gain from meditating here"
ShareB from 20 2 per hit, stops at 30 20 → 30 in 2s, "Meditation complete"
ShareB sits again nothing past 30 refused, still 30
ShareA sits again (above new share) refused, keeps 60 refused, still 60

Drift with seconds_per_hour: 36 for 2 minutes (≈3.3 in-game hours; config restored after):

t (s) 0 30 60 90 120
cerrith (-0.02/h) 50 49.99 49.97 49.95 49.94
equilibrium (corrupt, 0.05/h compounding) -0.84 -0.89 -0.91 -0.96 -1.01

No Magic warnings or errors in the log.

@XxFran10xX
XxFran10xX marked this pull request as ready for review October 20, 2026 08:51
@XxFran10xX
XxFran10xX merged commit 7b89ba5 into main Oct 20, 2026
4 checks passed
@XxFran10xX
XxFran10xX deleted the fix/passive-drift-accumulates branch October 20, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant