Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 53651 - Light's Beacon - Beacon of Light
- class spell_pal_light_s_beacon : public SpellScriptLoader
- {
- public:
- spell_pal_light_s_beacon() : SpellScriptLoader("spell_pal_light_s_beacon") { }
- class spell_pal_light_s_beacon_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_pal_light_s_beacon_AuraScript);
- bool Validate(SpellInfo const* /*spellInfo*/) override
- {
- if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_1)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_2)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_3)
- || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_LIGHT))
- return false;
- return true;
- }
- bool CheckProc(ProcEventInfo& eventInfo)
- {
- if (GetTarget()->HasAura(SPELL_PALADIN_BEACON_OF_LIGHT, eventInfo.GetActor()->GetGUID()))
- return false;
- return true;
- }
- void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
- {
- PreventDefaultAction();
- SpellInfo const* procSpell = eventInfo.GetSpellInfo();
- if (!procSpell)
- return;
- HealInfo* healInfo = eventInfo.GetHealInfo();
- if (!healInfo || !healInfo->GetHeal())
- return;
- uint32 healSpellId = procSpell->IsRankOf(sSpellMgr->AssertSpellInfo(SPELL_PALADIN_HOLY_LIGHT)) ? SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_1 : SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_3;
- uint32 heal = CalculatePct(healInfo->GetHeal(), aurEff->GetAmount());
- Unit* beaconTarget = GetCaster();
- if (!beaconTarget || !beaconTarget->HasAura(SPELL_PALADIN_BEACON_OF_LIGHT, eventInfo.GetActor()->GetGUID()))
- return;
- /// @todo: caster must be the healed unit to perform distance checks correctly
- /// but that will break animation on clientside
- /// caster in spell packets must be the healing unit
- eventInfo.GetActor()->CastCustomSpell(healSpellId, SPELLVALUE_BASE_POINT0, heal, beaconTarget, true, nullptr, aurEff);
- }
- void Register() override
- {
- DoCheckProc += AuraCheckProcFn(spell_pal_light_s_beacon_AuraScript::CheckProc);
- OnEffectProc += AuraEffectProcFn(spell_pal_light_s_beacon_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
- }
- };
- AuraScript* GetAuraScript() const override
- {
- return new spell_pal_light_s_beacon_AuraScript();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement