mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 02:46:33 +01:00
Scripts/Spells: fixed hunter Improved Steady Shot talent
This commit is contained in:
7
sql/updates/world/cata_classic/2024_11_28_00_world.sql
Normal file
7
sql/updates/world/cata_classic/2024_11_28_00_world.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_hun_improved_steady_shot';
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(-53221, 'spell_hun_improved_steady_shot');
|
||||
|
||||
DELETE FROM `spell_proc` WHERE `SpellId`= -53221;
|
||||
INSERT INTO `spell_proc` (`SpellId`, `SpellFamilyName`, `SpellTypeMask`, `SpellPhaseMask`) VALUES
|
||||
(-53221, 9, 0x1, 0x1);
|
||||
@@ -22,7 +22,73 @@
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellScript.h"
|
||||
#include "Unit.h"
|
||||
|
||||
namespace Scripts::Spells::Hunter
|
||||
{
|
||||
enum HunterSpells
|
||||
{
|
||||
SPELL_HUN_IMPROVED_STEADY_SHOT_TRIGGERED = 53220
|
||||
};
|
||||
|
||||
enum HunterSpellFamilies
|
||||
{
|
||||
SPELL_FAMILY_HUN_STEADY_SHOT = 0x1
|
||||
};
|
||||
|
||||
// -53221 - Improved Steady Shot
|
||||
class spell_hun_improved_steady_shot : public AuraScript
|
||||
{
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_HUN_IMPROVED_STEADY_SHOT_TRIGGERED });
|
||||
}
|
||||
|
||||
// If a ranged spell with spell_family_hunter is being cast, check if it's a steady shot ability. If not, reset the counter back to zero
|
||||
bool CheckEffectProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
|
||||
{
|
||||
if (!eventInfo.GetSpellInfo() || eventInfo.GetSpellInfo()->IsAutoRepeatRangedSpell() || !eventInfo.GetSpellInfo()->IsRangedWeaponSpell())
|
||||
return false;
|
||||
|
||||
if (!eventInfo.GetSpellInfo()->SpellFamilyFlags.HasFlag(0, SPELL_FAMILY_HUN_STEADY_SHOT, 0, 0))
|
||||
{
|
||||
_steadyShotCount = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Increment the steady shot counter. If the counter is at 2 or higher, trigger the haste bonus spell cast and reset the counter back to zero
|
||||
void HandleEffectProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
++_steadyShotCount;
|
||||
if (_steadyShotCount >= 2)
|
||||
{
|
||||
eventInfo.GetActor()->CastSpell(nullptr, SPELL_HUN_IMPROVED_STEADY_SHOT_TRIGGERED, CastSpellExtraArgs(TRIGGERED_FULL_MASK)
|
||||
.SetTriggeringAura(aurEff)
|
||||
.AddSpellBP0(aurEff->GetAmount()));
|
||||
|
||||
_steadyShotCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoCheckEffectProc += AuraCheckEffectProcFn(spell_hun_improved_steady_shot::CheckEffectProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
OnEffectProc += AuraEffectProcFn(spell_hun_improved_steady_shot::HandleEffectProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
|
||||
private:
|
||||
uint8 _steadyShotCount = 0;
|
||||
};
|
||||
}
|
||||
|
||||
void AddSC_hunter_spell_scripts()
|
||||
{
|
||||
using namespace Scripts::Spells::Hunter;
|
||||
RegisterSpellScript(spell_hun_improved_steady_shot);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user