mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Spells: Implement demon hunter talent "Shattered Destiny" (#30536)
This commit is contained in:
3
sql/updates/world/master/2024_12_29_04_world.sql
Normal file
3
sql/updates/world/master/2024_12_29_04_world.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dh_shattered_destiny';
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(388116, 'spell_dh_shattered_destiny');
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "DB2Stores.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellHistory.h"
|
||||
@@ -913,6 +914,51 @@ class spell_dh_glide_timer : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
// 388116 - Shattered Destiny
|
||||
class spell_dh_shattered_destiny : public AuraScript
|
||||
{
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DH_METAMORPHOSIS_TRANSFORM })
|
||||
&& ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } })
|
||||
&& spellInfo->GetEffect(EFFECT_0).IsAura()
|
||||
&& spellInfo->GetEffect(EFFECT_1).IsAura();
|
||||
}
|
||||
|
||||
bool CheckFurySpent(ProcEventInfo const& eventInfo)
|
||||
{
|
||||
Spell const* procSpell = eventInfo.GetProcSpell();
|
||||
if (!procSpell)
|
||||
return false;
|
||||
|
||||
if (!eventInfo.GetActor()->HasAura(SPELL_DH_METAMORPHOSIS_TRANSFORM))
|
||||
return false;
|
||||
|
||||
_furySpent += procSpell->GetPowerTypeCostAmount(POWER_FURY).value_or(0);
|
||||
return _furySpent >= GetEffect(EFFECT_1)->GetAmount();
|
||||
}
|
||||
|
||||
void HandleProc(ProcEventInfo const& /*eventInfo*/)
|
||||
{
|
||||
Aura* metamorphosis = GetTarget()->GetAura(SPELL_DH_METAMORPHOSIS_TRANSFORM);
|
||||
if (!metamorphosis)
|
||||
return;
|
||||
|
||||
int32 requiredFuryAmount = GetEffect(EFFECT_1)->GetAmount();
|
||||
metamorphosis->SetDuration(metamorphosis->GetDuration() + _furySpent / requiredFuryAmount * GetEffect(EFFECT_0)->GetAmount());
|
||||
_furySpent %= requiredFuryAmount;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_dh_shattered_destiny::CheckFurySpent);
|
||||
OnProc += AuraProcFn(spell_dh_shattered_destiny::HandleProc);
|
||||
}
|
||||
|
||||
private:
|
||||
int32 _furySpent = 0;
|
||||
};
|
||||
|
||||
// 391166 - Soul Furnace
|
||||
class spell_dh_soul_furnace : public AuraScript
|
||||
{
|
||||
@@ -1093,6 +1139,7 @@ void AddSC_demon_hunter_spell_scripts()
|
||||
RegisterSpellScript(spell_dh_felblade_cooldown_reset_proc);
|
||||
RegisterSpellScript(spell_dh_furious_gaze);
|
||||
RegisterSpellScript(spell_dh_last_resort);
|
||||
RegisterSpellScript(spell_dh_shattered_destiny);
|
||||
RegisterSpellScript(spell_dh_sigil_of_chains);
|
||||
RegisterSpellScript(spell_dh_tactical_retreat);
|
||||
RegisterSpellScript(spell_dh_vengeful_retreat_damage);
|
||||
|
||||
Reference in New Issue
Block a user