refactor(Core/Spells): QAston proc system (#24233)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
Co-authored-by: QAston <qaston@gmail.com>
Co-authored-by: joschiwald <joschiwald@online.de>
Co-authored-by: ariel- <ariel-@users.noreply.github.com>
Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
Co-authored-by: blinkysc <your-github-email@example.com>
Co-authored-by: Tereneckla <Tereneckla@users.noreply.github.com>
Co-authored-by: Andrew <47818697+Nyeriah@users.noreply.github.com>
This commit is contained in:
blinkysc
2026-02-18 05:31:53 -06:00
committed by GitHub
parent 65a869ea27
commit 4599f26ae9
76 changed files with 22915 additions and 5181 deletions

View File

@@ -23,6 +23,9 @@
#include "CreatureScript.h"
#include "PetDefines.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
enum HunterSpells
{
@@ -33,6 +36,18 @@ enum HunterSpells
SPELL_HUNTER_PET_SCALING = 62915
};
enum PetSpellsMisc
{
SPELL_PET_GUARD_DOG_HAPPINESS = 54445,
SPELL_PET_SILVERBACK_RANK_1 = 62800,
SPELL_PET_SILVERBACK_RANK_2 = 62801,
PET_ICON_ID_GROWL = 201,
PET_ICON_ID_CLAW = 262,
PET_ICON_ID_BITE = 1680,
PET_ICON_ID_SMACK = 473
};
struct npc_pet_hunter_snake_trap : public ScriptedAI
{
npc_pet_hunter_snake_trap(Creature* creature) : ScriptedAI(creature) { _init = false; }
@@ -132,7 +147,131 @@ private:
uint32 _spellTimer;
};
// -53178 - Guard Dog
class spell_pet_guard_dog : public AuraScript
{
PrepareAuraScript(spell_pet_guard_dog);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_PET_GUARD_DOG_HAPPINESS });
}
bool CheckProc(ProcEventInfo& eventInfo)
{
// Growl shares family flags with other spells
// filter by spellIcon instead
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo || spellInfo->SpellIconID != PET_ICON_ID_GROWL)
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
caster->CastSpell(nullptr, SPELL_PET_GUARD_DOG_HAPPINESS, true, nullptr, aurEff);
Unit* target = eventInfo.GetActionTarget();
if (!target->CanHaveThreatList())
return;
SpellInfo const* procSpellInfo = eventInfo.GetSpellInfo();
if (!procSpellInfo)
return;
float addThreat = CalculatePct(static_cast<float>(procSpellInfo->Effects[EFFECT_0].CalcValue(caster)), aurEff->GetAmount());
target->GetThreatMgr().AddThreat(caster, addThreat, SPELL_SCHOOL_MASK_NORMAL, GetSpellInfo());
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_pet_guard_dog::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_pet_guard_dog::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
// -62764 - Silverback
class spell_pet_silverback : public AuraScript
{
PrepareAuraScript(spell_pet_silverback);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_PET_SILVERBACK_RANK_1, SPELL_PET_SILVERBACK_RANK_2 });
}
bool CheckProc(ProcEventInfo& eventInfo)
{
// Growl shares family flags with other spells
// filter by spellIcon instead
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo || spellInfo->SpellIconID != PET_ICON_ID_GROWL)
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
static uint32 const triggerSpell[2] = { SPELL_PET_SILVERBACK_RANK_1, SPELL_PET_SILVERBACK_RANK_2 };
PreventDefaultAction();
uint8 rank = GetSpellInfo()->GetRank();
if (rank > 0 && rank <= 2)
{
uint32 spellId = triggerSpell[rank - 1];
eventInfo.GetActor()->CastSpell(nullptr, spellId, true, nullptr, aurEff);
}
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_pet_silverback::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_pet_silverback::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
// -61680 - Culling the Herd
class spell_pet_culling_the_herd : public AuraScript
{
PrepareAuraScript(spell_pet_culling_the_herd);
bool CheckProc(ProcEventInfo& eventInfo)
{
// Claw, Bite and Smack share FamilyFlags with other spells
// filter by spellIcon instead
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo)
return false;
switch (spellInfo->SpellIconID)
{
case PET_ICON_ID_CLAW:
case PET_ICON_ID_BITE:
case PET_ICON_ID_SMACK:
break;
default:
return false;
}
return true;
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_pet_culling_the_herd::CheckProc);
}
};
void AddSC_hunter_pet_scripts()
{
RegisterCreatureAI(npc_pet_hunter_snake_trap);
RegisterSpellScript(spell_pet_guard_dog);
RegisterSpellScript(spell_pet_silverback);
RegisterSpellScript(spell_pet_culling_the_herd);
}