mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 17:19:07 +00:00
fix(Core/Spells): Master of Elements (#7102)
* Core/Spells: Master of Elements: Proc now also from arcane spells. Properly proc from periodic spells. Fixed #6035. * You shouldn't be there. * Buildfix. * missing sql.
This commit is contained in:
@@ -950,14 +950,43 @@ public:
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return eventInfo.GetDamageInfo()->GetSpellInfo(); // eventInfo.GetSpellInfo()
|
||||
_spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
|
||||
if (!_spellInfo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool selectCaster = false;
|
||||
// Triggered spells cost no mana so we need triggering spellInfo
|
||||
if (SpellInfo const* triggeredByAuraSpellInfo = eventInfo.GetTriggerAuraSpell())
|
||||
{
|
||||
_spellInfo = triggeredByAuraSpellInfo;
|
||||
selectCaster = true;
|
||||
}
|
||||
|
||||
// If spell is periodic, mana amount is divided by tick number
|
||||
if (eventInfo.GetTriggerAuraEffectIndex() >= EFFECT_0)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
if (Unit* target = (selectCaster ? eventInfo.GetActor() : eventInfo.GetActionTarget()))
|
||||
{
|
||||
if (AuraEffect const* aurEff = target->GetAuraEffect(_spellInfo->Id, eventInfo.GetTriggerAuraEffectIndex(), caster->GetGUID()))
|
||||
{
|
||||
ticksModifier = aurEff->GetTotalTicks();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _spellInfo; // eventInfo.GetSpellInfo()
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
int32 mana = int32(eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask()));
|
||||
int32 mana = int32(_spellInfo->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask()) / ticksModifier);
|
||||
mana = CalculatePct(mana, aurEff->GetAmount());
|
||||
|
||||
if (mana > 0)
|
||||
@@ -969,6 +998,10 @@ public:
|
||||
DoCheckProc += AuraCheckProcFn(spell_mage_master_of_elements_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_mage_master_of_elements_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
|
||||
private:
|
||||
SpellInfo const* _spellInfo = nullptr;
|
||||
uint8 ticksModifier = 1;
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
|
||||
Reference in New Issue
Block a user