aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2021-08-20 03:41:49 +0200
committerGitHub <noreply@github.com>2021-08-20 03:41:49 +0200
commit3e886c55611357581ecb69c671d021d29b715e64 (patch)
tree6ce73038b0778656f44617bc7a4cd0a529a151f4 /src/server/scripts/Spells
parent1ddd9dc19cc1df1a1ab8c6123283999f9dea6760 (diff)
Scripts/Pet: implement Dance Rune Weapon + minor tweaks to npc_pet_mage_mirror_image script
damage is now halved, years ago it wasn't, so we got that going at least stat scaling missing - the low damage might even come from this instead of the aura periodic auras still unknown
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp177
1 files changed, 122 insertions, 55 deletions
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index ff374b5e6ed..f396c45d8b9 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -23,6 +23,7 @@
#include "ScriptMgr.h"
#include "Containers.h"
+#include "CreatureAI.h"
#include "DBCStores.h"
#include "Map.h"
#include "ObjectAccessor.h"
@@ -100,7 +101,14 @@ enum DeathKnightSpells
SPELL_DK_RUNIC_RETURN = 61258,
SPELL_DK_WANDERING_PLAGUE_DAMAGE = 50526,
SPELL_DK_DEATH_COIL_R1 = 47541,
- SPELL_DK_DEATH_GRIP_INITIAL = 49576
+ SPELL_DK_DEATH_GRIP_INITIAL = 49576,
+ SPELL_DK_BLOOD_STRIKE = 45902,
+ SPELL_DK_ICY_TOUCH = 45477,
+ SPELL_DK_PLAGUE_STRIKE = 45462,
+ SPELL_DK_DEATH_STRIKE = 49998,
+ SPELL_DK_HEART_STRIKE = 55050,
+ SPELL_DK_OBLITERATE = 49020,
+ SPELL_DK_RUNE_STRIKE = 56815
};
enum DeathKnightSpellIcons
@@ -109,7 +117,7 @@ enum DeathKnightSpellIcons
DK_ICON_ID_IMPROVED_DEATH_STRIKE = 2751
};
-enum Misc
+enum DeathKnightMisc
{
NPC_DK_GHOUL = 26125,
NPC_DK_DANCING_RUNE_WEAPON = 27893,
@@ -619,58 +627,6 @@ class spell_dk_corpse_explosion : public SpellScript
WorldObject* _target = nullptr;
};
-// 49028 - Dancing Rune Weapon
-class spell_dk_dancing_rune_weapon : public AuraScript
-{
- PrepareAuraScript(spell_dk_dancing_rune_weapon);
-
- bool Validate(SpellInfo const* /*spellInfo*/) override
- {
- if (!sObjectMgr->GetCreatureTemplate(NPC_DK_DANCING_RUNE_WEAPON))
- return false;
- return true;
- }
-
- // This is a port of the old switch hack in Unit.cpp, it's not correct
- void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
- {
- PreventDefaultAction();
- Unit* caster = GetCaster();
- if (!caster)
- return;
-
- Unit* drw = nullptr;
- for (Unit* controlled : caster->m_Controlled)
- {
- if (controlled->GetEntry() == NPC_DK_DANCING_RUNE_WEAPON)
- {
- drw = controlled;
- break;
- }
- }
-
- if (!drw || !drw->GetVictim())
- return;
-
- SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
- if (!spellInfo)
- return;
-
- DamageInfo* damageInfo = eventInfo.GetDamageInfo();
- if (!damageInfo || !damageInfo->GetDamage())
- return;
-
- int32 amount = static_cast<int32>(damageInfo->GetDamage()) / 2;
- drw->SendSpellNonMeleeDamageLog(drw->GetVictim(), spellInfo->Id, amount, spellInfo->GetSchoolMask(), 0, 0, false, 0, false);
- Unit::DealDamage(drw, drw->GetVictim(), amount, nullptr, SPELL_DIRECT_DAMAGE, spellInfo->GetSchoolMask(), spellInfo, true);
- }
-
- void Register() override
- {
- OnEffectProc += AuraEffectProcFn(spell_dk_dancing_rune_weapon::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
- }
-};
-
// -43265 - Death and Decay
class spell_dk_death_and_decay : public AuraScript
{
@@ -2642,6 +2598,116 @@ public:
}
};
+// 51963 - Gargoyle Strike
+class spell_pet_dk_gargoyle_strike : public SpellScript
+{
+ PrepareSpellScript(spell_pet_dk_gargoyle_strike);
+
+ void HandleDamageCalc(SpellEffIndex /*effIndex*/)
+ {
+ int32 damage = 60;
+ if (Unit* caster = GetCaster())
+ {
+ if (caster->GetLevel() >= 60)
+ damage += (caster->GetLevel() - 60) * 4;
+ }
+
+ SetEffectValue(damage);
+ }
+
+ void Register() override
+ {
+ OnEffectLaunchTarget += SpellEffectFn(spell_pet_dk_gargoyle_strike::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
+ }
+};
+
+enum DancingRuneWeaponMisc
+{
+ DATA_INITIAL_TARGET_GUID = 1,
+};
+
+// 49028 - Dancing Rune Weapon
+class spell_dk_dancing_rune_weapon : public AuraScript
+{
+ PrepareAuraScript(spell_dk_dancing_rune_weapon);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({
+ SPELL_DK_BLOOD_STRIKE,
+ SPELL_DK_ICY_TOUCH,
+ SPELL_DK_PLAGUE_STRIKE,
+ SPELL_DK_DEATH_COIL_DAMAGE,
+ SPELL_DK_DEATH_STRIKE,
+ SPELL_DK_HEART_STRIKE,
+ SPELL_DK_OBLITERATE,
+ SPELL_DK_RUNE_STRIKE
+ });
+ }
+
+ void HandleTarget(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* caster = GetCaster();
+ if (!caster)
+ return;
+
+ std::list<Creature*> runeWeapons;
+ caster->GetAllMinionsByEntry(runeWeapons, NPC_DK_DANCING_RUNE_WEAPON);
+ for (Creature* temp : runeWeapons)
+ {
+ if (temp->IsAIEnabled())
+ temp->AI()->SetGUID(GetTarget()->GetGUID(), DATA_INITIAL_TARGET_GUID);
+ temp->GetThreatManager().RegisterRedirectThreat(GetId(), caster->GetGUID(), 100);
+ }
+ }
+
+ bool CheckProc(ProcEventInfo& eventInfo)
+ {
+ if (SpellInfo const* procSpell = eventInfo.GetSpellInfo())
+ {
+ if (procSpell->IsRankOf(sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_STRIKE)) ||
+ procSpell->IsRankOf(sSpellMgr->GetSpellInfo(SPELL_DK_ICY_TOUCH)) ||
+ procSpell->IsRankOf(sSpellMgr->GetSpellInfo(SPELL_DK_PLAGUE_STRIKE)) ||
+ procSpell->IsRankOf(sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_DAMAGE)) ||
+ procSpell->IsRankOf(sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_STRIKE)) ||
+ procSpell->IsRankOf(sSpellMgr->GetSpellInfo(SPELL_DK_HEART_STRIKE)) ||
+ procSpell->IsRankOf(sSpellMgr->GetSpellInfo(SPELL_DK_OBLITERATE)) ||
+ procSpell->IsRankOf(sSpellMgr->GetSpellInfo(SPELL_DK_RUNE_STRIKE)))
+ return true;
+ }
+
+ return false;
+ }
+
+ void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
+ {
+ PreventDefaultAction();
+
+ Unit* owner = GetUnitOwner();
+ if (!owner)
+ return;
+
+ SpellInfo const* procSpell = eventInfo.GetSpellInfo();
+ Unit* runeWeapon = nullptr;
+ for (auto itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end() && !runeWeapon; itr++)
+ if ((*itr)->GetEntry() == NPC_DK_DANCING_RUNE_WEAPON)
+ runeWeapon = *itr;
+
+ if (!runeWeapon)
+ return;
+
+ if (runeWeapon->IsInCombat() && runeWeapon->GetVictim())
+ runeWeapon->CastSpell(runeWeapon->GetVictim(), procSpell->Id, CastSpellExtraArgs(TriggerCastFlags::TRIGGERED_IGNORE_POWER_AND_REAGENT_COST));
+ }
+
+ void Register() override
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_dk_dancing_rune_weapon::HandleTarget, EFFECT_2, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ DoCheckProc += AuraCheckProcFn(spell_dk_dancing_rune_weapon::CheckProc);
+ OnEffectProc += AuraEffectProcFn(spell_dk_dancing_rune_weapon::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
+ }
+};
+
void AddSC_deathknight_spell_scripts()
{
RegisterSpellScript(spell_dk_acclimation);
@@ -2655,7 +2721,6 @@ void AddSC_deathknight_spell_scripts()
RegisterSpellScript(spell_dk_bloodworms);
RegisterSpellScript(spell_dk_butchery);
RegisterSpellScript(spell_dk_corpse_explosion);
- RegisterSpellScript(spell_dk_dancing_rune_weapon);
RegisterSpellScript(spell_dk_death_and_decay);
RegisterSpellScript(spell_dk_death_coil);
RegisterSpellScript(spell_dk_death_gate);
@@ -2699,4 +2764,6 @@ void AddSC_deathknight_spell_scripts()
new spell_dk_raise_ally();
RegisterSpellScript(spell_dk_ghoul_thrash);
new spell_dk_blood_tap();
+ RegisterSpellScript(spell_pet_dk_gargoyle_strike);
+ RegisterSpellScript(spell_dk_dancing_rune_weapon);
}