mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Scripts/Spells: Implement hunter talent Binding Shot (#31074)
This commit is contained in:
@@ -25,11 +25,13 @@
|
||||
#include "AreaTriggerAI.h"
|
||||
#include "CellImpl.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Pet.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellScript.h"
|
||||
#include "TaskScheduler.h"
|
||||
|
||||
enum HunterSpells
|
||||
{
|
||||
@@ -42,6 +44,11 @@ enum HunterSpells
|
||||
SPELL_HUNTER_ASPECT_OF_THE_FOX = 1219162,
|
||||
SPELL_HUNTER_ASPECT_OF_THE_TURTLE_PACIFY_AURA = 205769,
|
||||
SPELL_HUNTER_BINDING_SHOT = 109248,
|
||||
SPELL_HUNTER_BINDING_SHOT_IMMUNE = 117553,
|
||||
SPELL_HUNTER_BINDING_SHOT_MARKER = 117405,
|
||||
SPELL_HUNTER_BINDING_SHOT_STUN = 117526,
|
||||
SPELL_HUNTER_BINDING_SHOT_VISUAL = 117614,
|
||||
SPELL_HUNTER_BINDING_SHOT_VISUAL_ARROW = 118306,
|
||||
SPELL_HUNTER_CONCUSSIVE_SHOT = 5116,
|
||||
SPELL_HUNTER_EMERGENCY_SALVE_TALENT = 459517,
|
||||
SPELL_HUNTER_EMERGENCY_SALVE_DISPEL = 459521,
|
||||
@@ -217,6 +224,93 @@ class spell_hun_aspect_of_the_turtle : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
// 109248 - Binding Shot
|
||||
class spell_hun_binding_shot : public SpellScript
|
||||
{
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_HUNTER_BINDING_SHOT_VISUAL_ARROW });
|
||||
}
|
||||
|
||||
void HandleCast()
|
||||
{
|
||||
GetCaster()->CastSpell(GetExplTargetDest()->GetPosition(), SPELL_HUNTER_BINDING_SHOT_VISUAL_ARROW, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCast += SpellCastFn(spell_hun_binding_shot::HandleCast);
|
||||
}
|
||||
};
|
||||
|
||||
// 109248 - Binding Shot
|
||||
// Id - 1524
|
||||
struct at_hun_binding_shot : AreaTriggerAI
|
||||
{
|
||||
using AreaTriggerAI::AreaTriggerAI;
|
||||
|
||||
void OnInitialize() override
|
||||
{
|
||||
if (Unit* caster = at->GetCaster())
|
||||
for (AreaTrigger* other : caster->GetAreaTriggers(SPELL_HUNTER_BINDING_SHOT))
|
||||
other->SetDuration(0);
|
||||
}
|
||||
|
||||
void OnCreate(Spell const* /*creatingSpell*/) override
|
||||
{
|
||||
_scheduler.Schedule(1s, [this](TaskContext task)
|
||||
{
|
||||
for (ObjectGuid const& guid : at->GetInsideUnits())
|
||||
{
|
||||
Unit* unit = ObjectAccessor::GetUnit(*at, guid);
|
||||
if (!unit->HasAura(SPELL_HUNTER_BINDING_SHOT_MARKER))
|
||||
continue;
|
||||
|
||||
unit->CastSpell(at->GetPosition(), SPELL_HUNTER_BINDING_SHOT_VISUAL, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR);
|
||||
}
|
||||
|
||||
task.Repeat(1s);
|
||||
});
|
||||
}
|
||||
|
||||
void OnUnitEnter(Unit* unit) override
|
||||
{
|
||||
if (Unit* caster = at->GetCaster())
|
||||
{
|
||||
if (caster->IsValidAttackTarget(unit) && !unit->HasAura(SPELL_HUNTER_BINDING_SHOT_IMMUNE, caster->GetGUID()))
|
||||
{
|
||||
caster->CastSpell(unit, SPELL_HUNTER_BINDING_SHOT_MARKER, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR);
|
||||
unit->CastSpell(at->GetPosition(), SPELL_HUNTER_BINDING_SHOT_VISUAL, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnUnitExit(Unit* unit) override
|
||||
{
|
||||
unit->RemoveAurasDueToSpell(SPELL_HUNTER_BINDING_SHOT_MARKER, at->GetCasterGuid());
|
||||
|
||||
if (at->IsRemoved())
|
||||
return;
|
||||
|
||||
if (Unit* caster = at->GetCaster())
|
||||
{
|
||||
if (caster->IsValidAttackTarget(unit) && !unit->HasAura(SPELL_HUNTER_BINDING_SHOT_IMMUNE, caster->GetGUID()))
|
||||
{
|
||||
caster->CastSpell(unit, SPELL_HUNTER_BINDING_SHOT_STUN, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR);
|
||||
caster->CastSpell(unit, SPELL_HUNTER_BINDING_SHOT_IMMUNE, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnUpdate(uint32 diff) override
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
|
||||
private:
|
||||
TaskScheduler _scheduler;
|
||||
};
|
||||
|
||||
// 204089 - Bullseye
|
||||
class spell_hun_bullseye : public AuraScript
|
||||
{
|
||||
@@ -1345,6 +1439,8 @@ void AddSC_hunter_spell_scripts()
|
||||
RegisterSpellScript(spell_hun_aspect_cheetah);
|
||||
RegisterSpellScript(spell_hun_aspect_of_the_fox);
|
||||
RegisterSpellScript(spell_hun_aspect_of_the_turtle);
|
||||
RegisterSpellScript(spell_hun_binding_shot);
|
||||
RegisterAreaTriggerAI(at_hun_binding_shot);
|
||||
RegisterSpellScript(spell_hun_bullseye);
|
||||
RegisterSpellScript(spell_hun_cobra_sting);
|
||||
RegisterSpellScript(spell_hun_concussive_shot);
|
||||
|
||||
Reference in New Issue
Block a user