Skip to content

fix(DuelReset): Fill druid mana in feral forms - #38

Merged
Helias merged 1 commit into
azerothcore:masterfrom
EricksOliveira:fix/druid-feral-mana-reset
Nov 16, 2026
Merged

Helias merged 1 commit into
azerothcore:masterfrom
EricksOliveira:fix/druid-feral-mana-reset

Conversation

@EricksOliveira

@EricksOliveira EricksOliveira commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Changes Proposed:

  • With DuelReset.HealthMana = 1, a druid who starts a duel in Cat, Bear or Dire Bear Form now gets full mana, like a druid in caster form already did.
  • ResetAllPowers() only fills the active power type. In those forms that's energy or rage, so the mana stayed where it was. After the reset, the druid's mana is now set to max. In forms that already use mana it's already full at that point, so the extra SetPower does nothing.
  • The mana is still saved before the reset, so it goes back to the pre-duel value when the duel ends with a winner, same as before (fled or interrupted duels don't restore anything, for any class).

AI-assisted Pull Requests

Important

Using AI tools to prepare pull requests is allowed, but it must be disclosed and it must follow our AC guidelines for AI Agentic Engineering (link below).

You are expected to fully understand the changes you submit and to be able to explain and justify them when maintainers ask.

  • AI tools (e.g. Claude, ChatGPT, or similar) were used entirely or partially to prepare this pull request. If checked, specify which tools and models below.
    • Tools/models used: Claude Code (Claude Opus 5.5) wrote the change and this description.
  • I have read and understood the AC guidelines for AI Agentic Engineering

Issues Addressed:

SOURCE:

Player::ResetAllPowers() only refills a power when HasActivePowerType(power) is true, and shapeshifting into Cat/Bear/Dire Bear switches the active power to energy/rage.

Tests Performed:

  • Builds and runs on Windows; tested in-game by the author.
  • Druid in Cat Form and in Bear/Dire Bear Form with mana below max: mana goes to max at duel start.
  • After the duel ends with a winner, the druid's mana goes back to the value it had before the duel.
  • Druid in caster form and other classes: same behaviour as before.

How to Test the Changes:

  1. Set DuelReset.HealthMana = 1. With the default DuelReset.Areas = "12;14;809" the module matches the exact subarea, so the reset only runs where the minimap shows exactly "Elwynn Forest", "Durotar" or "Gates of Ironforge" (not in subareas like Goldshire, Crystal Lake, Razor Hill or Valley of Trials). To test anywhere, set DuelReset.Zones = "" instead.
  2. Use two characters, one of them a druid with Cat Form and Bear/Dire Bear Form, and take both to a place where the reset runs (step 1).
  3. There, on the druid, spend about half of the mana (the shift itself also costs mana), shift into Cat Form and start the duel. After the 3 s countdown, shift back out to see the mana (leaving the form is free): it should be at max. Without the fix it stays well below max.
  4. Finish the duel with a winner: the druid's mana should go back to roughly the value it had when the duel started, well below max, instead of staying at max.
  5. Repeat in Bear/Dire Bear Form, and once in caster form to check nothing changed there.

ResetAllPowers only fills the active power type, so a druid in Cat,
Bear or Dire Bear Form started the duel without full mana. Fill the
druid's mana after the reset; the value saved before the duel is still
restored when it ends.

Closes azerothcore#30
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

When duel health reset is enabled, OnPlayerDuelStart now sets each druid's mana to maximum after ResetAllPowers(). This applies to both duel participants.

Changes: Duel Mana Reset

Layer / File(s) Summary
Reset druid mana for both participants
src/DuelReset_scripts.cpp
After ResetAllPowers(), the handler sets each druid's mana to maximum. Other classes retain the existing power-reset behavior.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 6c854

Druids in feral forms will start duels with full mana, as the linked issue requests. Other classes and caster-form druids behave as before, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: druid mana is filled in feral forms (Cat, Bear, Dire Bear) under the DuelReset feature. It matches the raw summary and the PR objectives. The title follows the conventional…
Linked Issues check Passed Issue #30 requires that a druid in Cat or Bear form has mana reset to maximum when a duel starts outside Stormwort, as health already does. At head, src/DuelReset_scripts.cpp in OnPlayerDuelStart call…
Out of Scope Changes check Passed The change affects only the mana handling in the DuelReset.HealthMana path of OnPlayerDuelStart in src/DuelReset_scripts.cpp. The added lines are a druid-only SetPower(POWER_MANA, max) call for each d…
Description check Passed The description follows the repository template. It has Changes Proposed, AI disclosure, Issues Addressed (Closes #30), SOURCE, Tests Performed, and How to Test the Changes. It explains the cause (Res…
Full details: Title check

Explanation

The title names the change: druid mana is filled in feral forms (Cat, Bear, Dire Bear) under the DuelReset feature. It matches the raw summary and the PR objectives. The title follows the conventional commit form and is concise, 46 characters.

Full details: Linked Issues check

Explanation

Issue #30 requires that a druid in Cat or Bear form has mana reset to maximum when a duel starts outside Stormwort, as health already does. At head, src/DuelReset_scripts.cpp in OnPlayerDuelStart calls player->ResetAllPowers() and then, for CLASS_DRUID, calls player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA)) for both players, inside the DuelReset.HealthMana branch. This sets mana to max for druids in any form, including feral forms where ResetAllPowers() refills only energy or rage. Mana is saved with SaveManaBeforeDuel before the reset, and RestoreManaAfterDuel runs on DUEL_WON, so the pre-duel value returns after a winning duel. The author reports in-game testing of Cat and Bear forms, which supports the behavior. Limitation: the repository diff tool could not read the changed blobs, so the base-to-head diff was not read directly. The verdict rests on the head file contents and the PR summary. Tests are manual; the PR adds no automated test, and none is required for this coding objective.

Full details: Out of Scope Changes check

Explanation

The change affects only the mana handling in the DuelReset.HealthMana path of OnPlayerDuelStart in src/DuelReset_scripts.cpp. The added lines are a druid-only SetPower(POWER_MANA, max) call for each duel player, with a comment explaining why. The PR description names no unrelated changes, and the raw summary lists only this file (+6/-0) with no declaration changes. The change connects directly to issue #30. The base-to-head diff could not be read, so the absence of other changed files rests on the PR summary and raw summary, not on a full diff read.

Full details: Description check

Explanation

The description follows the repository template. It has Changes Proposed, AI disclosure, Issues Addressed (Closes #30), SOURCE, Tests Performed, and How to Test the Changes. It explains the cause (ResetAllPowers fills only the active power type), the fix (set mana to max after the reset), and that the pre-duel mana is still restored after a winning duel. Tests cover feral forms, caster form, and other classes, and the test steps are detailed. Minor gaps: the Tests Performed section does not name the exact OS build details beyond Windows, and the template comment about in-game testing is answered briefly. These gaps are not critical.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 475218dd-c0f6-4651-8862-ea69217cdd77
Commits

Reviewing files that changed from the base of the PR and between f2c67d4 and 6c854c0.

Files selected for processing: 1

  • src/DuelReset_scripts.cpp

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

@EricksOliveira

Copy link
Copy Markdown
Contributor Author

Self-review — fix/druid-feral-mana-reset → master

Outcome 9 findings — 9 fixed — final round's single finding fixed

Fixes not re-reviewed finding 9 (PR description, How to Test steps 3–4: exact-value formula removed)

Reviewed 6c854c0 (fix/druid-feral-mana-reset vs master, merge-base diff — 1 file, +6 −0)

By Claude Code (Claude Agent SDK), Opus 5.5 (claude-opus-5-5) — self-review v1.2, 2026-11-16

Tested in-game by the author druid in Cat Form and in Bear/Dire Bear Form gets full mana at duel start;
mana returns to the pre-duel value on DUEL_WON; caster/Moonkin/Tree forms and other classes behave as before

Lint apps/codestyle/codestyle-cpp.py run in the module: no warnings on changed lines (5 pre-existing ones)

Review details (5 rounds)

Intent With DuelReset.HealthMana = 1, a druid who starts a duel in Cat, Bear or Dire Bear Form gets full
mana at duel start, as druids in other forms already do; the mana saved before the duel is still restored when it
ends with a winner. Change stays inside the module.

Project rules .agents/docs/self-review-rules.md (core repo; the module has none) found and applied, with
.agents/docs/code-review.md

Diff b23d92fec36a502e372ff45ade1232b5143ff4c5

Metadata e85d48e5e671cf15be4ae021b0054e7fbc01c212

Procedural: rounds 4 and 5 ran beyond the cap of 3 at the author's request. No reviewer run left files in the
module or core trees (file lists compared).

Round 1 — a156960, 3 findings

  1. commit message — subject fix: Fill druid mana … lacks the (Scope) of type(Scope): Subject → fixed:
    reworded to fix(DuelReset): Fill druid mana in feral forms
  2. src/DuelReset_scripts.cpp:78 — new comment is 116 cols, over the module .editorconfig limit of 80 →
    fixed: split in two lines
  3. PR metadata — title, description and linked issues empty (template asks for Closes, tests, how to test) →
    fixed: PR opened with the template filled and Closes #30 (deferred until then)

Round 2 — 6c854c0, delta (round 1 fixes + reworded subject), clean

Round 3 — 6c854c0, metadata only (PR opened), 3 findings

  1. How to Test 3–5 — restored mana said to equal the value after spending; it's saved at duel start after travel
    and regen, so a tester sees a mismatch → fixed: spend in the area right before the duel
  2. Changes Proposed — said mana is restored "when the duel ends"; only DUEL_WON restores → fixed
  3. How to Test 1 — "allowed areas" hides exact-subarea matching; dueling in Goldshire never resets → fixed:
    explained, with DuelReset.Zones = "" as the test-anywhere option

Round 4 — 6c854c0, metadata only (round 3 fixes), 2 findings

  1. How to Test 3–4 — claimed restored mana is above the post-spend value; the shift costs 35% base mana and
    starts the five-second rule, and mana is hidden in feral forms → fixed: spend about half, shift out to read
  2. How to Test 1 — "open ground" still misleads, both zones have ~30 open-terrain subareas → fixed: minimap
    name must read exactly "Elwynn Forest", "Durotar" or "Gates of Ironforge"

Round 5 — 6c854c0, metadata only (round 4 fixes), 1 finding

  1. How to Test 4 — "(left after spending, minus the shift cost)" reads as an exact value; regen resumes after 5 s
    and the cost isn't visible → fixed: formula dropped, "roughly the value at duel start, well below max"

@EricksOliveira

Copy link
Copy Markdown
Contributor Author

CC @Helias

@Helias
Helias merged commit 5caf8c1 into azerothcore:master Nov 16, 2026
3 checks passed
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.

Duelling outside SW does not reset mana while in druid's feral form.

2 participants