Scripts/Spells: Implement demon hunter talent "Inner Demon" (#30562)

This commit is contained in:
Aqua Deus
2025-01-14 19:35:30 +01:00
committed by GitHub
parent dc5307dfa0
commit 62ffded9f2
3 changed files with 85 additions and 0 deletions

View File

@@ -24,6 +24,7 @@
#include "AreaTrigger.h"
#include "AreaTriggerAI.h"
#include "DB2Stores.h"
#include "PathGenerator.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "Spell.h"
@@ -127,6 +128,9 @@ enum DemonHunterSpells
SPELL_DH_ILLIDANS_GRASP = 205630,
SPELL_DH_ILLIDANS_GRASP_DAMAGE = 208618,
SPELL_DH_ILLIDANS_GRASP_JUMP_DEST = 208175,
SPELL_DH_INNER_DEMON_BUFF = 390145,
SPELL_DH_INNER_DEMON_DAMAGE = 390137,
SPELL_DH_INNER_DEMON_TALENT = 389693,
SPELL_DH_INFERNAL_STRIKE_CAST = 189110,
SPELL_DH_INFERNAL_STRIKE_IMPACT_DAMAGE = 189112,
SPELL_DH_INFERNAL_STRIKE_JUMP = 189111,
@@ -806,6 +810,64 @@ class spell_dh_furious_gaze : public AuraScript
}
};
// Called by 162264 - Metamorphosis
class spell_dh_inner_demon : public AuraScript
{
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_DH_INNER_DEMON_TALENT, SPELL_DH_INNER_DEMON_BUFF });
}
bool Load() override
{
return GetUnitOwner()->HasAura(SPELL_DH_INNER_DEMON_TALENT); // This spell has a proc, but is just a copypaste from spell 390145 (also don't have a 5s cooldown)
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
{
Unit* target = GetTarget();
target->CastSpell(target, SPELL_DH_INNER_DEMON_BUFF, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
});
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_dh_inner_demon::OnApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
// 390139 - Inner Demon
// ID - 26749
struct at_dh_inner_demon : AreaTriggerAI
{
using AreaTriggerAI::AreaTriggerAI;
void OnInitialize() override
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(at->GetSpellId(), DIFFICULTY_NONE);
if (!spellInfo)
return;
Unit* caster = at->GetCaster();
if (!caster)
return;
Position destPos = at->GetFirstCollisionPosition(spellInfo->GetEffect(EFFECT_0).CalcValue(caster) + at->GetMaxSearchRadius(), at->GetRelativeAngle(caster));
PathGenerator path(at);
path.CalculatePath(destPos.GetPositionX(), destPos.GetPositionY(), destPos.GetPositionZ(), false);
at->InitSplines(path.GetPath());
}
void OnRemove() override
{
if (Unit* caster = at->GetCaster())
caster->CastSpell(caster->GetPosition(), SPELL_DH_INNER_DEMON_DAMAGE, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR);
}
};
// 209258 - Last Resort
class spell_dh_last_resort : public AuraScript
{
@@ -1253,6 +1315,8 @@ void AddSC_demon_hunter_spell_scripts()
RegisterSpellScript(spell_dh_felblade_cooldown_reset_proc);
RegisterSpellScript(spell_dh_fiery_brand);
RegisterSpellScript(spell_dh_furious_gaze);
RegisterSpellScript(spell_dh_inner_demon);
RegisterAreaTriggerAI(at_dh_inner_demon);
RegisterSpellScript(spell_dh_last_resort);
RegisterSpellScript(spell_dh_restless_hunter);
RegisterSpellScript(spell_dh_shattered_destiny);