Skip to content

fix(Reset): Despawn summons of duel-reset spells - #39

Merged
Helias merged 2 commits into
azerothcore:masterfrom
EricksOliveira:fix/19-duel-reset-dragonling-summons
Nov 19, 2026
Merged

Helias merged 2 commits into
azerothcore:masterfrom
EricksOliveira:fix/19-duel-reset-dragonling-summons

Conversation

@EricksOliveira

@EricksOliveira EricksOliveira commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Changes Proposed:

  • When the duel reset makes a spell ready again (at duel start, or at duel end after the old cooldowns are put back), the creatures the player summoned with that spell now despawn. That stops players from stacking Mechanical Dragonlings with /duel and /forfeit.
  • ResetSpellCooldowns now returns the spells it reset, and the new RemoveSpellSummons in src/DuelReset.cpp does the despawn. Only creatures from the spell's own SPELL_EFFECT_SUMMON effects count, only the player's own summons are touched, and the player's pet (Player::GetPet) is kept.
  • The fix stays in the module. Checking for an existing summon in the core would change every summon in the game, outside duels too.
  • The old summon goes away when the reset runs, so it's already gone before the trinket is used again.
  • Class spells count too (e.g. Summon Gargoyle). Any summon of a reset spell goes, so totems, Feral Spirit, Shadowfiend and Force of Nature also despawn at the reset.
  • Known gaps: summons made through a triggered spell (e.g. Mirror Image) aren't covered, and the search only looks about 533 yards (one grid) around the player.

Issues Addressed:

SOURCE:

Item 4396 casts spell 4073, which summons creature 2678 (Spell.dbc).

Tests Performed:

  • Builds on Windows (MSVC, Visual Studio 2026) with -DMODULES=static, no warnings in the module.
  • Tested in-game with the Mechanical Dragonling (item 4396): used in a duel and then /forfeit, it despawns at duel end. Used before a duel, it despawns when the duel starts. Using it again summons just one.
  • Not tested yet: Mithril and Arcanite Dragonling, Summon Gargoyle, pets, a third player's summons, and the cases where nothing should despawn.
  • Made with help from Claude Code (Claude Opus 5.5).

How to Test the Changes:

  1. Keep DuelReset.Cooldowns = 1 and use two characters in an area allowed by DuelReset.Zones / DuelReset.Areas. The one using the trinket needs level 30+ and Engineering 200 (.setskill 202 200).
  2. Give it the Mechanical Dragonling (.additem 4396), equip it, start a duel and use it.
  3. /forfeit. The dragonling despawns and the trinket is ready.
  4. Repeat steps 2 and 3 a few times, using the trinket only inside the duel. There's never more than one dragonling.
  5. Use the trinket outside a duel, then start a duel. The old dragonling despawns when the duel starts. If you use it again in that duel and /forfeit, that one stays and the trinket goes back to the cooldown it had before the duel, since the module puts that cooldown back.
  6. Check that a hunter pet or warlock demon stays after the duel, and that a third player's dragonling nearby isn't touched (same setup as step 1).
  7. Duel outside the allowed areas, or with DuelReset.Cooldowns = 0. Nothing despawns.

With cooldown reset, a player could stack several Mechanical
Dragonlings by using the trinket in a duel and forfeiting.

When the duel reset leaves a spell ready (duel start, or duel end
after cooldowns are restored), the creatures that spell summons
directly and the player still has nearby now despawn. The player's
pet (Player::GetPet) is kept.

Closes azerothcore#19
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: 235ca23c-75c0-4348-a02d-a7c054fdbc3a
Commits

Reviewing files that changed from the base of the PR and between 7a8d884 and b6b7e69.

Files selected for processing: 3

  • src/DuelReset.cpp
  • src/DuelReset.h
  • src/DuelReset_scripts.cpp

No actionable comments were generated in the recent review.

Walkthrough

The cooldown reset now returns the IDs of spells whose cooldowns it clears. Duel reset handling uses those IDs to remove eligible temporary summons owned by the player.

Changes: Cooldown Summon Cleanup

Layer / File(s) Summary
Collect reset spell IDs
src/DuelReset.h, src/DuelReset.cpp
ResetSpellCooldowns now returns the IDs of spells whose cooldowns it removes.
Remove eligible temporary summons
src/DuelReset.cpp, src/DuelReset_scripts.cpp
After cooldown resets, duel handling passes spell IDs to RemoveSpellSummons. The method checks cooldown state, spell data, summon entries, ownership, and recorded creating spell before unsummoning matching non-pet temporary summons.

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: gozzim

Merge Risk: Minimal · previous review 7a8d8

This change despawns a player's own temporary summons from spells that the duel reset makes ready again. Pets, other players' summons and triggered-spell summons are left alone. No concrete defect was found in the reviewed code. Only the Mechanical Dragonling has been tested in-game, so other summon spells are unverified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: duel-reset spells now despawn the summons they created. It uses the conventional fix(scope) prefix and matches the objectives and the code summary, which add RemoveSpe…
Linked Issues check Passed Issue #19 requires that a Mechanical Dragonling summoned before a duel is replaced, not accumulated, after repeated /duel and /forfeit cycles. At head, DuelReset::ResetSpellCooldowns returns the IDs o…
Out of Scope Changes check Passed All changes sit in src/DuelReset.cpp, src/DuelReset.h and src/DuelReset_scripts.cpp and serve the duel-reset summon despawn. The ResetSpellCooldowns return-value change and the RemoveSpellSummons help…
Description check Passed The description follows the repository template and covers all required sections. It states the changes, links issue #19 with "Closes #19", gives a source (Spell.dbc item 4396 to spell 4073 to creatur…
Full details: Title check

Explanation

The title names the main change: duel-reset spells now despawn the summons they created. It uses the conventional fix(scope) prefix and matches the objectives and the code summary, which add RemoveSpellSummons and return spell IDs from ResetSpellCooldowns.

Full details: Linked Issues check

Explanation

Issue #19 requires that a Mechanical Dragonling summoned before a duel is replaced, not accumulated, after repeated /duel and /forfeit cycles. At head, DuelReset::ResetSpellCooldowns returns the IDs of spells whose cooldowns it clears (src/DuelReset.cpp). RestoreCooldownStateAfterDuel calls RemoveSpellSummons after restoring cooldowns. RemoveSpellSummons skips spells that are on cooldown again, reads direct SPELL_EFFECT_SUMMON entries, and calls UnSummon() only on the player's own non-pet TempSummon entries whose UNIT_CREATED_BY_SPELL is 0 or matches the reset spell. The duel-start path is handled in DuelReset_scripts.cpp per the supplied summary. Code evidence supports the despawn at duel end and at duel start. The author's in-game tests cover the Mechanical Dragonling case. I did not independently verify the DuelReset_scripts.cpp call site, because the diff was unavailable and I did not read that file.

Full details: Out of Scope Changes check

Explanation

All changes sit in src/DuelReset.cpp, src/DuelReset.h and src/DuelReset_scripts.cpp and serve the duel-reset summon despawn. The ResetSpellCooldowns return-value change and the RemoveSpellSummons helper are needed for that purpose. Class summons (totems, Feral Spirit, Shadowfiend, Force of Nature, Summon Gargoyle) also despawn under the same logic. The issue explicitly asks for the same handling for other 'summon X npc to assist you' trinkets, so this extension is connected to #19. Pets are kept by the IsPet() check and the GetPet cooldown logic is unchanged. The core is not modified. The 533-yard search limit and the triggered-spell gap are stated limitations, not out-of-scope changes.

Full details: Description check

Explanation

The description follows the repository template and covers all required sections. It states the changes, links issue #19 with "Closes #19", gives a source (Spell.dbc item 4396 to spell 4073 to creature 2678), lists the build and in-game tests with the untested cases, and provides step-by-step testing instructions. The author also discloses AI assistance. Minor gaps remain: the Tests Performed section does not name the OS beyond Windows, and the SOURCE section is brief. These are non-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: 0c5a9cdb-39fc-4a09-95db-7ca4e89fc01b
Commits

Reviewing files that changed from the base of the PR and between f2c67d4 and 7a8d884.

Files selected for processing: 3

  • src/DuelReset.cpp
  • src/DuelReset.h
  • 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/19-duel-reset-dragonling-summons → master

Outcome 5 findings — 5 fixed — round cap reached (3 rounds)

Fixes not re-reviewed: PR "How to Test the Changes" steps 1, 2, 4, 5 and 6, reworded after round 3 (findings 4, 5)

Reviewed 7a8d884 (fix/19-duel-reset-dragonling-summons vs origin/master of azerothcore/mod-duel-reset,
merge-base diff — 3 files, +68 −5)

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

Build core + module, -DSCRIPTS=static -DMODULES=static, MSVC (Visual Studio 18 2026), RelWithDebInfo: OK, no
warnings in module files — built at 7b6d92a; 7a8d884 differs only in line wrapping and one comment
(token-identical code)

Linters module CI greps (trailing blank, tab, LOG_…GetCounter, triple newline) clean; codestyle-cpp.py only
the 5 pre-existing warnings on unchanged lines (DuelReset.cpp 89/198/216, DuelReset_scripts.cpp 55/95)

In-game testing author tested Mechanical Dragonling (item 4396) at duel end (/forfeit) and at duel start: the
old dragonling despawns, reuse summons exactly one. Not tested yet: items 10576/16022, Summon Gargoyle (49206), the
player's pet staying, a third player's summons, area outside the whitelist, DuelReset.Cooldowns = 0, interrupted
or fled duel

Review details (3 rounds)

Intent Fix mod-duel-reset#19: the module's cooldown reset at duel start and at duel end lets a player stack
Mechanical Dragonlings (use the trinket in a duel, forfeit); the player's creatures summoned by a spell now despawn
when the reset leaves that spell ready again.

Project rules .agents/docs/self-review-rules.md (core) found and applied: pinned review (round 1 fixes
committed by amend before round 2), in-game testing asked of the author

Diff 4bb5b5880521b5f108e9a866a247cadbbd001031

Metadata faee03c958308c6bcc491c9d2a1f941bf6ded61f

The module is its own git repo (modules/mod-duel-reset); the core checkout has no changes.

Round 1 — 7b6d92a, 3 findings

  1. commit 7b6d92a title — fix: … lacks the type(Scope): scope the template and module history use →
    fixed: fix(Reset): Despawn summons of duel-reset spells
  2. commit 7b6d92a body — claimed all summons of the spell despawn and "controlled pets are kept", but only direct
    SPELL_EFFECT_SUMMON creatures are matched and only Player::GetPet is kept → fixed: body reworded
  3. src/DuelReset.h:19, src/DuelReset.cpp (6 lines), src/DuelReset_scripts.cpp:65-66 — new lines over the
    module .editorconfig max_line_length = 80 → fixed: new lines wrapped, pre-existing ones untouched

Round 2 — 7a8d884, round 1 fixes and new commit message, clean

Round 3 — 7a8d884, PR #39 title and description only (diff unchanged), 2 findings

  1. PR test steps 1, 2, 6 — item 4396 needs level 30, Engineering 200 and must be equipped; an ordinary test
    character can't use it → fixed: setup added (.setskill 202 200, equip, same for the third player)
  2. PR test step 4 — "use it again" outside the duel puts the trinket on cooldown, which the next duel end restores,
    so that duel's dragonling stays and repeating step 3 doesn't give its stated result → fixed: repeats only use
    the trinket inside the duel; step 5 now states the restored-cooldown case

@EricksOliveira

Copy link
Copy Markdown
Contributor Author

CC @Helias

@Helias
Helias merged commit 3d143ee into azerothcore:master Nov 19, 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.

Players can summon multiple Mechanical Dragonlings using the engineering trinket and /duel

2 participants