mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 17:49:10 +00:00
[Core/Spells]: Fix glyph of arcane shot not refunding mana. (#7395)
* [Core/Spells]: Fix glyph of arcane shot not refunding mana. * chore: add newline at the end of file * Update rev_1629141434760979400.sql * Update spell_hunter.cpp * Update rev_1629141434760979400.sql * Update spell_hunter.cpp * Update data/sql/updates/pending_db_world/rev_1629141434760979400.sql Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -52,7 +52,8 @@ enum HunterSpells
|
||||
SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 = 64418,
|
||||
SPELL_HUNTER_VICIOUS_VIPER = 61609,
|
||||
SPELL_HUNTER_VIPER_ATTACK_SPEED = 60144,
|
||||
SPELL_DRAENEI_GIFT_OF_THE_NAARU = 59543
|
||||
SPELL_DRAENEI_GIFT_OF_THE_NAARU = 59543,
|
||||
SPELL_HUNTER_GLYPH_OF_ARCANE_SHOT = 61389
|
||||
};
|
||||
|
||||
// Ours
|
||||
@@ -1229,6 +1230,71 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// 56841 - Glyph of Arcane Shot
|
||||
class spell_hun_glyph_of_arcane_shot : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_hun_glyph_of_arcane_shot() : SpellScriptLoader("spell_hun_glyph_of_arcane_shot") {}
|
||||
|
||||
class spell_hun_glyph_of_arcane_shot_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_hun_glyph_of_arcane_shot_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_HUNTER_GLYPH_OF_ARCANE_SHOT });
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
if (Unit* procTarget = eventInfo.GetProcTarget())
|
||||
{
|
||||
// Find Serpent Sting, Viper Sting, Scorpid Sting, Wyvern Sting
|
||||
const auto found = std::find_if(std::begin(procTarget->GetAppliedAuras()), std::end(procTarget->GetAppliedAuras()),
|
||||
[&](std::pair<uint32, AuraApplication*> pair)
|
||||
{
|
||||
Aura const* aura = pair.second->GetBase();
|
||||
return ((aura->GetCasterGUID() == GetTarget()->GetGUID())
|
||||
&& aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_HUNTER
|
||||
&& aura->GetSpellInfo()->SpellFamilyFlags.HasFlag(0xC000, 0x1080));
|
||||
});
|
||||
|
||||
if (found != std::end(procTarget->GetAppliedAuras()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
SpellInfo const* procSpell = eventInfo.GetSpellInfo();
|
||||
if (!procSpell)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int32 mana = procSpell->CalcPowerCost(GetTarget(), procSpell->GetSchoolMask());
|
||||
ApplyPct(mana, aurEff->GetAmount());
|
||||
|
||||
GetTarget()->CastCustomSpell(SPELL_HUNTER_GLYPH_OF_ARCANE_SHOT, SPELLVALUE_BASE_POINT0, mana, GetTarget());
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_hun_glyph_of_arcane_shot_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_hun_glyph_of_arcane_shot_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
{
|
||||
return new spell_hun_glyph_of_arcane_shot_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_hunter_spell_scripts()
|
||||
{
|
||||
// Ours
|
||||
@@ -1238,6 +1304,7 @@ void AddSC_hunter_spell_scripts()
|
||||
new spell_hun_animal_handler();
|
||||
new spell_hun_generic_scaling();
|
||||
new spell_hun_taming_the_beast();
|
||||
new spell_hun_glyph_of_arcane_shot();
|
||||
|
||||
// Theirs
|
||||
new spell_hun_aspect_of_the_beast();
|
||||
|
||||
Reference in New Issue
Block a user