Skip to content

Comments

QOL changes to enlightenment and fellowship mechanics.#355

Open
Ruggan wants to merge 3 commits intorkroska:masterfrom
Ruggan:enlqol
Open

QOL changes to enlightenment and fellowship mechanics.#355
Ruggan wants to merge 3 commits intorkroska:masterfrom
Ruggan:enlqol

Conversation

@Ruggan
Copy link
Contributor

@Ruggan Ruggan commented Feb 12, 2026

Changes

Enlightenment

  • Players now remain in their fellowship.
  • Players are no longer stripped of buffs.
  • Players are no longer teleported away.
  • Players no longer lose unspent experience.
  • Refactored GetEnlightenmentRatingBonus to use O(1) math instead of a per-enl loop.
  • Removed dead code and cleaned up comment.

Fellowship

  • Level is no longer a factor in XP sharing.

Summary by CodeRabbit

  • Bug Fixes

    • Fellowship XP sharing simplified; fellowship info no longer shows the EvenShare value.
    • Fellowship updates now consistently report shared status to clients.
  • Balance Changes

    • Enlightenment requirements and luminance cost calculation refined; level targets adjusted for prior enlightenments.
    • Enlightenment rating bonus uses a new tiered scaling for more predictable progression.
  • Quality

    • No-op luminance spends are ignored to prevent unnecessary updates.

## Changes
### Enlightenment
- Players now remain in their fellowship.
- Players are no longer stripped of buffs.
- Players are no longer teleported away.
- Players no longer lose unspent experience.
- Refactored `GetEnlightenmentRatingBonus` to use O(1) math instead of a per-enl loop.
- Removed dead code and cleaned up comment.

### Fellowship
- Level is no longer a factor in XP sharing.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Walkthrough

Removes fellowship XP-sharing bookkeeping and stops emitting EvenShare; trims DeveloperCommands output. Large refactor of Enlightenment: recalculates luminance costs, moves many helpers to private, adjusts requirement checks and effects. Adds a zero-amount guard in Player luminance spend.

Changes

Cohort / File(s) Summary
Fellowship / Serialization / Command
Source/ACE.Server/Entity/Fellowship.cs, Source/ACE.Server/Network/GameEvent/Events/GameEventFellowshipFullUpdate.cs, Source/ACE.Server/Command/Handlers/DeveloperCommands.cs
Removed DesiredShareXP field and CalculateXPSharing(); serialization now writes EvenShare as hardcoded true; developer fellow-info command no longer prints EvenShare.
Enlightenment core
Source/ACE.Server/Entity/Enlightenment.cs
Reworked requirement/check flow: added CalculateLuminanceCost, moved many public helpers to private or removed, simplified GetEnlightenmentRatingBonus, adjusted action/visual sequence and requirement order (inventory/luminance checks).
Player luminance
Source/ACE.Server/WorldObjects/Player_Luminance.cs
Added early-return guard in SpendLuminance when amount == 0 to avoid unnecessary processing.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Player as "Player"
participant Enlight as "Enlightenment\n(static logic)"
participant Luminance as "Player_Luminance"
participant Inventory as "Inventory"
participant Action as "ActionChain / UI"
rect rgba(200,200,255,0.5)
Player->>Enlight: RequestEnlightenment(targetLevel)
Enlight->>Inventory: VerifyInventorySpace(player)
Inventory-->>Enlight: OK / Fail
Enlight->>Enlight: CalculateLuminanceCost(targetLevel)
Enlight->>Luminance: VerifyLuminance(player, cost)
Luminance-->>Enlight: OK / Fail
Enlight->>Luminance: SpendLuminance(player, cost)
Enlight->>Enlight: ApplyPerksAndAdjustments(player)
Enlight->>Action: ApplyVisualEffects(PlayScript.LevelUp)
Action-->>Player: ShowEffects / Telemetry
end

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • rkroska

Poem

🐇
I nibbled old flags and cleared the lair,
Shared the light, trimmed the spare,
Codes now tidy, sparks in view,
Hop, level up — a fresh debut ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.93% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'QOL changes to enlightenment and fellowship mechanics' accurately summarizes the main changes: quality-of-life improvements to enlightenment (fellowship retention, buff preservation, no teleport, XP preservation, performance optimization, luminance calculation fix) and fellowship mechanics (level-independent XP sharing).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Source/ACE.Server/Entity/Enlightenment.cs (1)

55-88: ⚠️ Potential issue | 🟡 Minor

Defer the LevelUp VFX until enlightenment actually succeeds.
Right now the effect fires before the movement/luminance checks, so failed attempts still show a success cue.

Suggested fix
-                player.ApplyVisualEffects(PlayScript.LevelUp);
                 var endPos = new ACE.Entity.Position(player.Location);
@@
                 AddPerks(player);
                 if (player.Enlightenment >= 25)
                 {
                     DequipAllItems(player);
                 }
+                player.ApplyVisualEffects(PlayScript.LevelUp);
                 player.SaveBiotaToDatabase();
🧹 Nitpick comments (1)
Source/ACE.Server/Entity/Enlightenment.cs (1)

410-426: Add boundary tests for the new piecewise formula.
Please cover 10/11, 20/21, and 50/51 to ensure the O(1) refactor matches previous behavior.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Source/ACE.Server/Entity/Enlightenment.cs (1)

342-348: ⚠️ Potential issue | 🟠 Major

Pre-existing bug: SpendLuminance for >300 enlightenment doesn't apply the cost modifier from VerifyRequirements.

VerifyRequirements (lines 211–225) computes the luminance cost for >300 enlightenment using a scaling costModifier (1.0 + 0.5 * steps), but SpendLuminance (lines 342–348) just uses targetEnlightenment * baseLumCost without the modifier. This means the player's luminance is verified against the higher modified amount, but only the base amount is actually deducted — the player keeps the difference.

Additionally, VerifyRequirements casts baseLumCost to decimal while SpendLuminance does not, introducing a second inconsistency in numeric precision.

Not introduced by this PR, but since you're actively refactoring enlightenment logic, this is worth fixing now.

🐛 Proposed fix to apply the same cost modifier
             else if (player.Enlightenment + 1 > 300)
             {
-                var baseLumCost = ServerConfig.enl_300_base_lum_cost.Value;
+                var baseLumCost = (decimal)ServerConfig.enl_300_base_lum_cost.Value;
                 var targetEnlightenment = player.Enlightenment + 1;
-                long reqLum300 = targetEnlightenment * baseLumCost;
+
+                int over = targetEnlightenment - 300;
+                int steps = (over - 1) / 50;
+                decimal costModifier = 1.0m + (0.5m * steps);
+
+                long reqLum300 = (long)Math.Ceiling((targetEnlightenment * baseLumCost) * costModifier);
                 return player.SpendLuminance(reqLum300);
             }
🧹 Nitpick comments (1)
Source/ACE.Server/Entity/Enlightenment.cs (1)

409-427: Well-done O(1) refactor — minor comment accuracy nit.

The piecewise math is correct at all tier boundaries (10→10, 20→15, 50→21). AggressiveInlining is appropriate here.

Line 425: the comment says "From 50 and beyond" but enlightenmentAmt == 50 is handled by the <= 50 branch above. The final tier actually starts at 51.

📝 Suggested comment fix
-            // From 50 and beyond: 1 Damage Rating per 10 Enlightenments
+            // From 51 and beyond: 1 Damage Rating per 10 Enlightenments

…lidating and spending luminance. This impacts the 350+ calculation, which was previously validating with a multiplier and then only charging the un-multiplied value.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@Source/ACE.Server/Entity/Enlightenment.cs`:
- Around line 221-225: VerifyLuminance currently only checks
player.BankedLuminance but SpendLuminance will use player.AvailableLuminance
first then fallback to BankedLuminance, causing false negatives; update
VerifyLuminance in Enlightenment.cs to mirror the spend logic by returning true
when player.AvailableLuminance + player.BankedLuminance >= reqLum (or
alternatively call SpendLuminance in a non-destructive "canSpend" mode if such
exists), referencing the Player class properties AvailableLuminance,
BankedLuminance and the SpendLuminance method so the verification matches actual
spending behavior.
🧹 Nitpick comments (1)
Source/ACE.Server/Entity/Enlightenment.cs (1)

46-93: Animation chain: re-verify requirements aren't stale after 14-second delay.

After the 14-second animation delay, only position and luminance are re-checked before spending. Other requirements verified upfront (level, vitae, inventory slots, tokens, etc.) could change during the delay (e.g., player gets vitae from a death in another context, or items are moved). The IsBusy flag mitigates most of these, but consider whether a full re-verification call would be safer here.

Comment on lines 221 to 225
public static bool VerifyLuminance(Player player, long reqLum)
{
if (reqLum <= 0) return true;
return player.BankedLuminance >= reqLum;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

VerifyLuminance only checks BankedLuminance, but SpendLuminance also draws from AvailableLuminance.

VerifyLuminance checks player.BankedLuminance >= reqLum, but Player.SpendLuminance (line 92-104 in Player_Luminance.cs) tries AvailableLuminance first and falls back to BankedLuminance. A player whose luminance sits entirely in AvailableLuminance would fail verification here yet succeed at the actual spend—meaning they'd be blocked with a misleading "not enough luminance" message despite having enough.

Consider aligning the check with the spend logic:

Proposed fix
 public static bool VerifyLuminance(Player player, long reqLum)
 {
     if (reqLum <= 0) return true;
-    return player.BankedLuminance >= reqLum;
+    return (player.BankedLuminance ?? 0) >= reqLum
+        || (player.AvailableLuminance ?? 0) >= reqLum;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public static bool VerifyLuminance(Player player, long reqLum)
{
if (reqLum <= 0) return true;
return player.BankedLuminance >= reqLum;
}
public static bool VerifyLuminance(Player player, long reqLum)
{
if (reqLum <= 0) return true;
return (player.BankedLuminance ?? 0) >= reqLum
|| (player.AvailableLuminance ?? 0) >= reqLum;
}
🤖 Prompt for AI Agents
In `@Source/ACE.Server/Entity/Enlightenment.cs` around lines 221 - 225,
VerifyLuminance currently only checks player.BankedLuminance but SpendLuminance
will use player.AvailableLuminance first then fallback to BankedLuminance,
causing false negatives; update VerifyLuminance in Enlightenment.cs to mirror
the spend logic by returning true when player.AvailableLuminance +
player.BankedLuminance >= reqLum (or alternatively call SpendLuminance in a
non-destructive "canSpend" mode if such exists), referencing the Player class
properties AvailableLuminance, BankedLuminance and the SpendLuminance method so
the verification matches actual spending behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant