Scripts/Spells: Implement hunter talent Tar Trap (#30846)

This commit is contained in:
Aqua Deus
2025-05-05 01:14:35 +02:00
committed by GitHub
parent fc362147f9
commit e57f0d01fb
2 changed files with 52 additions and 0 deletions

View File

@@ -77,6 +77,9 @@ enum HunterSpells
SPELL_HUNTER_STEADY_SHOT_FOCUS = 77443,
SPELL_HUNTER_T9_4P_GREATNESS = 68130,
SPELL_HUNTER_T29_2P_MARKSMANSHIP_DAMAGE = 394371,
SPELL_HUNTER_TAR_TRAP = 187699,
SPELL_HUNTER_TAR_TRAP_AREATRIGGER = 187700,
SPELL_HUNTER_TAR_TRAP_SLOW = 135299,
SPELL_HUNTER_WILDERNESS_MEDICINE_TALENT = 343242,
SPELL_HUNTER_WILDERNESS_MEDICINE_DISPEL = 384784,
SPELL_ROAR_OF_SACRIFICE_TRIGGERED = 67481
@@ -948,6 +951,51 @@ class spell_hun_tame_beast : public SpellScript
}
};
// 187700 - Tar Trap
// 4436 - AreatriggerId
struct areatrigger_hun_tar_trap : AreaTriggerAI
{
using AreaTriggerAI::AreaTriggerAI;
void OnUnitEnter(Unit* unit) override
{
if (Unit* caster = at->GetCaster())
if (caster->IsValidAttackTarget(unit))
caster->CastSpell(unit, SPELL_HUNTER_TAR_TRAP_SLOW, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR);
}
void OnUnitExit(Unit* unit) override
{
unit->RemoveAurasDueToSpell(SPELL_HUNTER_TAR_TRAP_SLOW, at->GetCasterGuid());
}
};
// 187699 - Tar Trap
// 4435 - AreatriggerId
struct areatrigger_hun_tar_trap_activate : AreaTriggerAI
{
using AreaTriggerAI::AreaTriggerAI;
void OnInitialize() override
{
if (Unit* caster = at->GetCaster())
for (AreaTrigger* other : caster->GetAreaTriggers(SPELL_HUNTER_TAR_TRAP))
other->SetDuration(0);
}
void OnUnitEnter(Unit* unit) override
{
if (Unit* caster = at->GetCaster())
{
if (caster->IsValidAttackTarget(unit))
{
caster->CastSpell(at->GetPosition(), SPELL_HUNTER_TAR_TRAP_AREATRIGGER, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR);
at->Remove();
}
}
}
};
// 67151 - Item - Hunter T9 4P Bonus (Steady Shot)
class spell_hun_t9_4p_bonus : public AuraScript
{
@@ -1079,6 +1127,8 @@ void AddSC_hunter_spell_scripts()
RegisterSpellScript(spell_hun_steady_shot);
RegisterSpellScript(spell_hun_surging_shots);
RegisterSpellScript(spell_hun_tame_beast);
RegisterAreaTriggerAI(areatrigger_hun_tar_trap);
RegisterAreaTriggerAI(areatrigger_hun_tar_trap_activate);
RegisterSpellScript(spell_hun_t9_4p_bonus);
RegisterSpellScript(spell_hun_t29_2p_marksmanship_bonus);
RegisterSpellScript(spell_hun_wilderness_medicine);