mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 01:59:09 +00:00
refactor(Core/Spells): Implement QAston Proc System (#11079)
* . * sql * . * . * 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * Update spell_item.cpp * Update Unit.cpp * 16 * 17 * 18 * 19 * 20 * 21 * Update Unit.cpp * REVERT UltraNIX Commit * 22 * 23 * . * . * . * warrior * warlock * shaman rogue priest paladin mage * spell item * hunter * druid * dk * war * error style * Update rev_1647677899565690722.sql * Update rev_1647677899565690722.sql * Update rev_1647677899565690722.sql * . * DOND DEL ME WAD DO DO * error 2 * . * . * . * FIX * Update SpellInfoCorrections.cpp * Update SpellInfoCorrections.cpp * . * ja genau * Update .gitignore * . * . * ., * . * . * . * . * Update Unit.cpp
This commit is contained in:
committed by
GitHub
parent
5189b43a28
commit
cbd3fd0967
@@ -21,7 +21,11 @@
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "TemporarySummon.h"
|
||||
|
||||
enum HunterSpells
|
||||
{
|
||||
@@ -32,6 +36,26 @@ enum HunterSpells
|
||||
SPELL_HUNTER_PET_SCALING = 62915
|
||||
};
|
||||
|
||||
enum HunterCreatures
|
||||
{
|
||||
NPC_HUNTER_VIPER = 19921
|
||||
};
|
||||
|
||||
enum PetSpellsMisc
|
||||
{
|
||||
SPELL_PET_GUARD_DOG_HAPPINESS = 54445,
|
||||
SPELL_PET_SILVERBACK_RANK_1 = 62800,
|
||||
SPELL_PET_SILVERBACK_RANK_2 = 62801,
|
||||
|
||||
SPELL_PET_SWOOP = 52825,
|
||||
SPELL_PET_CHARGE = 61685,
|
||||
|
||||
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; }
|
||||
@@ -138,7 +162,156 @@ private:
|
||||
uint32 _spellTimer;
|
||||
};
|
||||
|
||||
// 57627 - Charge
|
||||
class spell_pet_charge : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pet_charge);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_PET_SWOOP,
|
||||
SPELL_PET_CHARGE
|
||||
});
|
||||
}
|
||||
|
||||
void HandleDummy(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
// Remove +% AP aura
|
||||
Unit* pet = eventInfo.GetActor();
|
||||
Aura* aura = pet->GetAura(SPELL_PET_SWOOP, pet->GetGUID());
|
||||
if (!aura)
|
||||
aura = pet->GetAura(SPELL_PET_CHARGE, pet->GetGUID());
|
||||
|
||||
if (!aura)
|
||||
return;
|
||||
|
||||
aura->DropCharge(AURA_REMOVE_BY_EXPIRE);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectProc += AuraEffectProcFn(spell_pet_charge::HandleDummy, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// -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((Unit*)nullptr, SPELL_PET_GUARD_DOG_HAPPINESS, true);
|
||||
|
||||
float addThreat = CalculatePct(eventInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster), aurEff->GetAmount());
|
||||
eventInfo.GetProcTarget()->AddThreat(caster, addThreat);
|
||||
}
|
||||
|
||||
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_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)
|
||||
{
|
||||
static uint32 const triggerSpell[2] = { SPELL_PET_SILVERBACK_RANK_1, SPELL_PET_SILVERBACK_RANK_2 };
|
||||
|
||||
PreventDefaultAction();
|
||||
|
||||
uint32 spellId = triggerSpell[GetSpellInfo()->GetRank() - 1];
|
||||
eventInfo.GetActor()->CastSpell((Unit*)nullptr, spellId, true);
|
||||
}
|
||||
|
||||
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_charge);
|
||||
RegisterSpellScript(spell_pet_guard_dog);
|
||||
RegisterSpellScript(spell_pet_silverback);
|
||||
RegisterSpellScript(spell_pet_culling_the_herd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user