Skip to content

Commit

Permalink
Scripts/Priest: Implement Trail of Light (TrinityCore#29096)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyr97 committed Jul 1, 2023
1 parent 2041374 commit 6a3c98a
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sql/updates/world/master/2023_07_01_01_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DELETE FROM `spell_script_names` WHERE `spell_id`=200128;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(200128, 'spell_pri_trail_of_light');

DELETE FROM `spell_proc` WHERE `SpellId` IN (200128);
INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`ProcFlags2`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
(200128,0x00,6,0x00001800,0x00000000,0x00000000,0x00000000,0x0,0x0,0x2,0x2,0x3,0x0,0x0,0,0,0,0); -- Trail of Light

60 changes: 60 additions & 0 deletions src/server/scripts/Spells/spell_priest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ enum PriestSpells
SPELL_PRIEST_STRENGTH_OF_SOUL = 197535,
SPELL_PRIEST_STRENGTH_OF_SOUL_EFFECT = 197548,
SPELL_PRIEST_THE_PENITENT_AURA = 200347,
SPELL_PRIEST_TRAIL_OF_LIGHT_HEAL = 234946,
SPELL_PRIEST_TRINITY = 214205,
SPELL_PRIEST_VAMPIRIC_EMBRACE_HEAL = 15290,
SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL = 64085,
Expand Down Expand Up @@ -1801,6 +1802,64 @@ class spell_pri_t10_heal_2p_bonus : public AuraScript
}
};

// 200128 - Trail of Light
class spell_pri_trail_of_light : public AuraScript
{
PrepareAuraScript(spell_pri_trail_of_light);

bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_PRIEST_TRAIL_OF_LIGHT_HEAL });
}

bool CheckProc(ProcEventInfo& eventInfo)
{
if (_healQueue.empty() || _healQueue.back() != eventInfo.GetActionTarget()->GetGUID())
_healQueue.push(eventInfo.GetActionTarget()->GetGUID());

if (_healQueue.size() > 2)
_healQueue.pop();

if (_healQueue.size() == 2)
return true;

return false;
}

void HandleOnProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
{
Unit* caster = GetTarget();
Unit* oldTarget = ObjectAccessor::GetUnit(*caster, _healQueue.front());
if (!oldTarget)
return;

// Note: old target may not be friendly anymore due to charm and faction change effects.
if (!caster->IsValidAssistTarget(oldTarget))
return;

SpellInfo const* healSpellInfo = sSpellMgr->GetSpellInfo(SPELL_PRIEST_TRAIL_OF_LIGHT_HEAL, DIFFICULTY_NONE);
if (!healSpellInfo)
return;

// Note: distance may be greater than the heal's spell range.
if (!caster->IsWithinDist(oldTarget, healSpellInfo->GetMaxRange(true, caster)))
return;

uint32 healAmount = CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount());

caster->CastSpell(oldTarget, SPELL_PRIEST_TRAIL_OF_LIGHT_HEAL, CastSpellExtraArgs(aurEff).AddSpellBP0(healAmount));
}

void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_pri_trail_of_light::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_pri_trail_of_light::HandleOnProc, EFFECT_0, SPELL_AURA_DUMMY);
}

private:
std::queue<ObjectGuid> _healQueue;
};

// 109142 - Twist of Fate (Shadow)
// 265259 - Twist of Fate (Discipline)
class spell_pri_twist_of_fate : public AuraScript
Expand Down Expand Up @@ -1963,6 +2022,7 @@ void AddSC_priest_spell_scripts()
RegisterSpellScript(spell_pri_spirit_of_redemption);
RegisterSpellScript(spell_pri_shadow_mend);
RegisterSpellScript(spell_pri_shadow_mend_periodic_damage);
RegisterSpellScript(spell_pri_trail_of_light);
RegisterSpellScript(spell_pri_t3_4p_bonus);
RegisterSpellScript(spell_pri_t5_heal_2p_bonus);
RegisterSpellScript(spell_pri_t10_heal_2p_bonus);
Expand Down

0 comments on commit 6a3c98a

Please sign in to comment.