Skip to content

fix(Core/Spells): Fire CAST phase procs for triggered spells - #28609

Merged
Nyeriah merged 5 commits into
azerothcore:masterfrom
Nyeriah:fix/black-magic-triggered-procs
Nov 30, 2026
Merged

Nyeriah merged 5 commits into
azerothcore:masterfrom
Nyeriah:fix/black-magic-triggered-procs

Conversation

@Nyeriah

@Nyeriah Nyeriah commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Changes Proposed:

This PR proposes changes to:

  • Core (units, players, creatures, game systems).
  • Scripts (bosses, spell scripts, creature scripts).
  • Database (SAI, creatures, etc).

Spell::_cast skipped the CAST phase proc for every triggered spell (m_originalCaster && !IsTriggered()). Black Magic (59630) only procs in the CAST phase, so it never procced from harmful spells a script or weapon imbue casts as triggered: Death Coil's damage (47632), Static Shock's Lightning Shield damage (49279) and Flametongue Attack (10444).

The gate is dropped. Aura::GetProcEffectMask already filters triggered spells per aura: an aura only sees them with SPELL_ATTR3_CAN_PROC_FROM_PROCS or PROC_ATTR_TRIGGERED_CAN_PROC, or when the triggered spell has SPELL_ATTR3_NOT_A_PROC. Black Magic has both of the first two. Arcane Potency has neither, so Blizzard ticks still don't consume it, which is what the gate was added for. TrinityCore only requires an original caster here. Allowing just NOT_A_PROC spells would fix Death Coil and Static Shock but not Flametongue Attack, which has no Attr3 bits.

Fingers of Frost (74396) has 2 charges, accepts triggered spells and listened to CAST and HIT. With both phases firing for triggered spells, one Blizzard tick or Arcane Missiles bolt took both charges. Its spell_proc row is now CAST only, as #24942 set it, and spell_mage_fingers_of_frost drops its HIT phase handling. Since charges are now taken at CAST, a triggered tick that misses also takes one.

This re-lands part of #24942, which also dropped this gate and moved 74396 to CAST only. #24990 reverted both, naming "the separated CAST-before-HIT phase and deferred 0-charge aura cleanup" as the cause of a use-after-free. CAST-before-HIT ordering came back in #25647 and is on master, and this PR doesn't bring back the deferred 0-charge cleanup.

CAST phase spell_proc rows that now see triggered spells through their own attributes:

  • Black Magic (59630)
  • Fingers of Frost talent (44543, 44545) and buff (74396)
  • Glyph of Totem of Wrath (63280)
  • Trinket auras with SPELL_ATTR3_CAN_PROC_FROM_PROCS: 38334, 62114, 67667, 67670, 67698, 67752, 71585, 71602, 71645, 75465, 75474
  • Blessed Weapon Coating (45396), which also has SPELL_ATTR3_CAN_PROC_FROM_PROCS. Righteous Weapon Coating (45398) has it too, but its melee and ranged auto attack proc flags only add auto-repeat shots.

Two kinds of triggered casts pass every aura's filter and now reach any CAST phase row: ranged auto-repeat shots (Auto Shot, wand Shoot), and triggered spells with SPELL_ATTR3_NOT_A_PROC (Arcane Missiles bolts, Penance bolts, Lightning Shield damage, Death Coil damage, Tranquility ticks, Starfall stars). These are all the CAST phase rows with charges and without PROC_ATTR_REQ_SPELLMOD or PROC_ATTR_REQ_MANA_COST that such casts can now consume:

  • 28200 (Ascendance, Talisman of Ascendance), 33299 (Coilfang Slave Pens caster trinket), 39530 (Focus): also on wand Shoot and Auto Shot
  • 24389 (Chaos Fire): fire spells only
  • 59887-59891 (Borrowed Time): Penance bolts now take the charge, where the Penance channel never matched its proc flags
  • 4341 (Explodo-Rockets), 18820 (Insight), 31794 (Focused Mind), 37214 (Energized), 37601 (Relentlessness), 43819 (Lucidity)

Rows with PROC_ATTR_REQ_SPELLMOD or PROC_ATTR_REQ_MANA_COST (Arcane Potency, Presence of Mind, Hot Streak, Brain Freeze and the rest) still need a spell that the aura's spellmod applies to or that costs mana.

e2e coverage in e2e/suites/spells/aura/triggered_cast_proc_e2e_test.go: Black Magic procs from Death Coil and from Flametongue Attack on auto-attacks, and one Blizzard tick takes one Fingers of Frost charge.

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
  • I have read and understood the AC guidelines for AI Agentic Engineering

Issues Addressed:

SOURCE:

The changes have been validated through:

Tests Performed:

This PR has been:

  • Tested in-game by the author.
  • Tested in-game by other community members/someone else other than the author/has been live on production servers.
  • This pull request requires further testing and may have edge cases to be tested.

The new e2e tests pass on this branch. With the gate restored, the Flametongue case reports AC#25969 CONFIRMED BUG. With 74396 back at CAST|HIT, one Blizzard tick leaves Fingers of Frost with 0 charges.

How to Test the Changes:

  • This pull request can be tested by following the reproduction steps provided in the linked issue
  • This pull request requires further testing. Provide steps to test your changes. If it requires any specific setup e.g multiple players please specify it as well.
  1. Shaman with a Black Magic weapon and Flametongue Weapon, auto-attacking a Heroic Training Dummy without casting: Black Magic (59626) procs.
  2. Death Knight with a Black Magic weapon casting Death Coil on the dummy: Black Magic procs.
  3. Mage with Fingers of Frost (.aura 74396) channeling Blizzard on the dummy: the channel start takes no charge, each tick takes one, hit or miss.
  4. Mage with Arcane Potency channeling Blizzard: the ticks don't consume Arcane Potency.
  5. Mage with Missile Barrage casting Arcane Missiles, and Arcane Blast with Arcane Potency: charges drop as before.

Known Issues and TODO List:

  • [ ]
  • [ ]

How to Test AzerothCore PRs

When a PR is ready to be tested, it will be marked as [WAITING TO BE TESTED].

You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:

http://www.azerothcore.org/wiki/How-to-test-a-PR

REMEMBER: when testing a PR that changes something generic (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but especially check that the PR does not cause any regression (i.e. introducing new bugs).

For example: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but we should test Y and Z as well.

The CAST phase proc in Spell::_cast skipped every triggered spell, so
auras that opt into triggered procs never saw them. Black Magic never
procced from Flametongue Attack, Static Shock or Death Coil damage.

Aura::GetProcEffectMask already filters triggered spells per aura
(SPELL_ATTR3_CAN_PROC_FROM_PROCS, PROC_ATTR_TRIGGERED_CAN_PROC,
SPELL_ATTR3_NOT_A_PROC), so Blizzard ticks still don't consume Arcane
Potency. This matches TrinityCore, which only requires an original
caster.

Fingers of Frost (74396) relied on the HIT phase for triggered spells.
With both phases firing, each Blizzard tick or Arcane Missiles bolt
consumed two charges, so its proc entry is now CAST phase only, as in
TrinityCore, and the script's HIT-phase handling is dropped.

Closes azerothcore#25969

Co-authored-by: blinkysc <37940565+blinkysc@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 29, 2026 21:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The change updates cast-phase proc handling for triggered casts and adjusts the Fingers of Frost proc hook. It sets SpellPhaseMask for spell 74396. New end-to-end tests cover Black Magic procs from Death Coil and Flametongue Attack, plus Fingers of Frost charge use during Blizzard.

Severity of issue fixed: Low

Merge Risk: Low · up to f9352

The change lets Black Magic proc from triggered harmful spells and fixes Fingers of Frost so one Blizzard tick uses one charge. The only open concern is a rare timing flake in the new e2e test, which can be fixed without touching the core logic. Merge risk is low.

Warning

Some tools did not complete. Review the errors below.

golangci-lint (2.15.0)

level=error msg="[linters_context] typechecking error: build constraints exclude all Go files in /e2e/suites/spells/aura"

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 11ae1aa and f93528c.

Files selected for processing: 5

  • data/sql/updates/pending_db_world/rev_1795981068712132700.sql
  • e2e/README.md
  • e2e/suites/spells/aura/triggered_cast_proc_e2e_test.go
  • src/server/game/Spells/Spell.cpp
  • src/server/scripts/Spells/spell_mage.cpp

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

e2eharness.Preconditionf(t, "Blizzard never cast its tick %d", trigProcSpellBlizzardTick)
}
time.Sleep(400 * time.Millisecond)
if ticks := log.count(trigProcSpellBlizzardTick) - ticks0; ticks != 1 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Read the tick count and charges from the same settled channel state.

Line 392 checks the tick count, and line 396 reads the charges with no wait between them. A tick logged in that gap leaves the charge read stale, so the assertion at line 410 can fail on a correct core. The window is short, so the failure is rare, but it is a test race rather than a core defect.

Move the tick check and the charge read after the channel is stopped and WaitNotChanneling returns, so both observations describe the same final state.

@github-actions github-actions Bot added DB related to the SQL database CORE Related to the core Script Refers to C++ Scripts for the Core file-cpp Used to trigger the matrix build e2e This PR contains a end-to-end test labels Nov 29, 2026
Co-authored-by: Shauren <297439+Shauren@users.noreply.github.com>
Co-authored-by: ariel- <ariel-@users.noreply.github.com>
@Nyeriah

Nyeriah commented Nov 29, 2026 •

Copy link
Copy Markdown
Member Author

Self-review — fix/black-magic-triggered-procs → master

Outcome 1 finding — 1 fixed — final round clean

Reviewed 11f5b61f10 (fix/black-magic-triggered-procs vs upstream/master, merge-base diff — 5 files, +415 −19)

By Claude Code, Opus 5.5 (claude-opus-5-5) — self-review v0.10, 2026-11-29

Checks Tested in-game by the author. e2e on a local Release build of the change: TestAC_25969_*/FlametongueAttack and TestAura_FingersOfFrostTriggeredTickTakesOneCharge pass at 11f5b61f10 (2/2 each; 10/10 Fingers of Frost on earlier revisions). With the !IsTriggered() gate restored, FlametongueAttack reports AC#25969 CONFIRMED BUG; with 74396 at CAST|HIT, Fingers of Frost has 0 charges after one tick. TestAC_25969_*/DeathCoil not run locally (the local auth DB's RBAC blocks death knight creation).

Review details (rounds 10–11)

Intent Let triggered spells fire the CAST-phase proc event in Spell::_cast, so Black Magic (59630) procs from triggered harmful spells (Death Coil damage 47632, Static Shock 49279, Flametongue Attack 10444), and move Fingers of Frost (74396) to CAST phase only so one triggered Blizzard tick takes one charge; e2e coverage for both.

Project rules .agents/docs/self-review-rules.md found and applied

Diff f55450bb7e194e9a698d4b197c8776d3abbf0c96

Metadata 342010edc77ac65d139a23a3d85172a80f3d77c3

Carried forward from black-magic-triggered-procs.SELF-REVIEW-3.md: findings 1–21 fixed. Upstream master was merged in to resolve a conflict in the e2e/README.md inventory row.

Round 10 — 62566e9a63, full (merge base moved to 0643d9d9c7 by the master merge), 1 finding

  1. e2e/suites/spells/aura/triggered_cast_proc_e2e_test.go:253 — comment claimed subtests close a shared cached world DB; each subtest builds its own bot and the harness caches per bot, so the shared DB plumbing was redundant → fixed: removed

Round 11 — 11f5b61f10, round 10 fix, clean

@Nyeriah
Nyeriah merged commit fbb8ff6 into azerothcore:master Nov 30, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE Related to the core DB related to the SQL database e2e This PR contains a end-to-end test file-cpp Used to trigger the matrix build Script Refers to C++ Scripts for the Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Spell] Death Knight - Death Coil & Black Magic

3 participants