Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 12.30.24 #399

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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"
Expand Down Expand Up @@ -727,6 +728,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 @@ -879,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
{
Expand Down Expand Up @@ -1058,6 +1138,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
Loading