Skip to content

Commit

Permalink
Merge pull request #399 from TrinityCore/master
Browse files Browse the repository at this point in the history
Update 12.30.24
  • Loading branch information
KamiliaBlow authored Dec 30, 2024
2 parents f86a067 + ae28344 commit 9e39153
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sql/updates/world/master/2024_12_29_03_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dh_last_resort';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(209258, 'spell_dh_last_resort');
3 changes: 3 additions & 0 deletions sql/updates/world/master/2024_12_29_04_world.sql
Original file line number Diff line number Diff line change
@@ -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');
82 changes: 82 additions & 0 deletions src/server/scripts/Spells/spell_dh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "DB2Stores.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
#include "SpellPackets.h"
Expand Down Expand Up @@ -774,6 +775,40 @@ class spell_dh_furious_gaze : public AuraScript
}
};

// 209258 - Last Resort
class spell_dh_last_resort : public AuraScript
{
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ SPELL_DH_UNCONTAINED_FEL, SPELL_DH_METAMORPHOSIS_VENGEANCE_TRANSFORM })
&& ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
}

void HandleAbsorb(AuraEffect const* /*aurEff*/, DamageInfo const& /*dmgInfo*/, uint32& absorbAmount)
{
Unit* target = GetTarget();
if (target->HasAura(SPELL_DH_UNCONTAINED_FEL))
{
absorbAmount = 0;
return;
}

PreventDefaultAction();

CastSpellExtraArgs castArgs = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR | TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD;

target->CastSpell(target, SPELL_DH_METAMORPHOSIS_VENGEANCE_TRANSFORM, castArgs);
target->CastSpell(target, SPELL_DH_UNCONTAINED_FEL, castArgs);

target->SetHealth(target->CountPctFromMaxHealth(GetEffectInfo(EFFECT_1).CalcValue(target)));
}

void Register() override
{
OnEffectAbsorb += AuraEffectAbsorbOverkillFn(spell_dh_last_resort::HandleAbsorb, EFFECT_0);
}
};

// 188499 - Blade Dance
// 210152 - Death Sweep
class spell_dh_blade_dance : public SpellScript
Expand Down Expand Up @@ -926,6 +961,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
{
Expand Down Expand Up @@ -3914,6 +3994,8 @@ void AddSC_demon_hunter_spell_scripts()
RegisterSpellScript(spell_dh_felblade_charge);
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);
Expand Down

0 comments on commit 9e39153

Please sign in to comment.