diff --git a/data/sql/updates/pending_db_world/rev_1679480684395742200.sql b/data/sql/updates/pending_db_world/rev_1679480684395742200.sql new file mode 100644 index 000000000..70060d238 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1679480684395742200.sql @@ -0,0 +1,16 @@ +-- Risen Ally(30230) +DELETE FROM `creature_template_spell` WHERE `CreatureID` = 30230; +INSERT INTO `creature_template_spell` (`CreatureID`, `Index`, `Spell`, `VerifiedBuild`) VALUES +(30230, 0, 62225, 12340), +(30230, 1, 47480, 12340), +(30230, 2, 47481, 12340), +(30230, 3, 47482, 12340), +(30230, 4, 47484, 12340), +(30230, 5, 47496, 12340); + +UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_pet_dk_risen_ally' WHERE `entry` = 30230; + +-- Thrash +DELETE FROM `spell_script_names` WHERE `spell_id`=47480 AND `ScriptName`='spell_dk_ghoul_thrash'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(47480, 'spell_dk_ghoul_thrash'); diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp index 74dbe3680..b5e638af0 100644 --- a/src/server/scripts/Pet/pet_dk.cpp +++ b/src/server/scripts/Pet/pet_dk.cpp @@ -43,7 +43,10 @@ enum DeathKnightSpells SPELL_DK_DISMISS_GARGOYLE = 50515, SPELL_DK_SANCTUARY = 54661, SPELL_DK_NIGHT_OF_THE_DEAD = 62137, - SPELL_DK_PET_SCALING = 61017 + SPELL_DK_PET_SCALING = 61017, + // Risen Ally + SPELL_DK_RAISE_ALLY = 46619, + SPELL_GHOUL_FRENZY = 62218, }; class npc_pet_dk_ebon_gargoyle : public CreatureScript @@ -255,6 +258,38 @@ public: } }; +class npc_pet_dk_risen_ally : public CreatureScript +{ +public: + npc_pet_dk_risen_ally() : CreatureScript("npc_pet_dk_risen_ally") { } + + struct npc_pet_dk_risen_allyAI : public PossessedAI + { + npc_pet_dk_risen_allyAI(Creature* c) : PossessedAI(c) { } + + void OnCharmed(bool apply) override + { + if (!apply) + { + if (Unit* owner = me->GetCharmerOrOwner()) + { + if (Player* player = owner->ToPlayer()) + { + player->RemoveAurasDueToSpell(SPELL_DK_RAISE_ALLY); // Remove Raise Ally aura + player->RemoveAurasDueToSpell(SPELL_GHOUL_FRENZY); // Remove Frenzy aura + //player->ClearResurrectRequestData(); + } + } + } + } + }; + + CreatureAI* GetAI(Creature* pCreature) const override + { + return new npc_pet_dk_risen_allyAI (pCreature); + } +}; + class npc_pet_dk_army_of_the_dead : public CreatureScript { public: @@ -335,6 +370,7 @@ void AddSC_deathknight_pet_scripts() { new npc_pet_dk_ebon_gargoyle(); new npc_pet_dk_ghoul(); + new npc_pet_dk_risen_ally(); new npc_pet_dk_army_of_the_dead(); new npc_pet_dk_dancing_rune_weapon(); RegisterSpellScript(spell_pet_dk_gargoyle_strike); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index a0f3939e9..046dd925e 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -72,7 +72,11 @@ enum DeathKnightSpells SPELL_DK_UNHOLY_PRESENCE = 48265, SPELL_DK_UNHOLY_PRESENCE_TRIGGERED = 49772, SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1 = 49189, - SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1 = 52284 + SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1 = 52284, + // Risen Ally + SPELL_DK_RAISE_ALLY = 46619, + SPELL_DK_THRASH = 47480, + SPELL_GHOUL_FRENZY = 62218, }; enum DeathKnightSpellIcons @@ -82,7 +86,8 @@ enum DeathKnightSpellIcons enum Misc { - NPC_DK_GHOUL = 26125 + NPC_DK_GHOUL = 26125, + NPC_RISEN_ALLY = 30230 }; // 50526 - Wandering Plague @@ -1496,6 +1501,53 @@ class spell_dk_ghoul_explode : public SpellScript } }; +// 47480 - Thrash +class spell_dk_ghoul_thrash : public SpellScript +{ + PrepareSpellScript(spell_dk_ghoul_thrash); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_GHOUL_FRENZY }); + } + + void CalcDamage(SpellEffIndex /*effIndex*/) + { + /* + Causes more damage per frenzy point: + 1 point : (Attack power * 40 * 0.01 + Attack power * 0.05)-(Attack power * 40 * 0.01 + Attack power * 0.10) damage + 2 points : (Attack power * 40 * 0.01 + Attack power * 0.10)-(Attack power * 40 * 0.01 + Attack power * 0.20) damage + 3 points : (Attack power * 40 * 0.01 + Attack power * 0.15)-(Attack power * 40 * 0.01 + Attack power * 0.30) damage + 4 points : (Attack power * 40 * 0.01 + Attack power * 0.20)-(Attack power * 40 * 0.01 + Attack power * 0.40) damage + 5 points : (Attack power * 40 * 0.01 + Attack power * 0.25)-(Attack power * 40 * 0.01 + Attack power * 0.50) damage + */ + + if (Aura* frenzy = GetCaster()->GetAura(SPELL_GHOUL_FRENZY)) + { + float APBonus = GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK); + float fixedDamageBonus = APBonus * GetEffectValue() * 0.01f; + APBonus *= 0.05f * frenzy->GetStackAmount(); + + SetEffectValue(fixedDamageBonus + urand(int32(APBonus), int32(APBonus * 2.f))); + + if (Unit* caster = GetCaster()) + { + caster->RemoveAurasDueToSpell(SPELL_GHOUL_FRENZY); + + if (Unit* charmer = caster->GetCharmer()) + { + charmer->RemoveAurasDueToSpell(SPELL_GHOUL_FRENZY); + } + } + } + } + + void Register() override + { + OnEffectLaunchTarget += SpellEffectFn(spell_dk_ghoul_thrash::CalcDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } +}; + // 48792 - Icebound Fortitude class spell_dk_icebound_fortitude : public AuraScript { @@ -2184,4 +2236,5 @@ void AddSC_deathknight_spell_scripts() RegisterSpellScript(spell_dk_spell_deflection); RegisterSpellScript(spell_dk_vampiric_blood); RegisterSpellScript(spell_dk_will_of_the_necropolis); + RegisterSpellScript(spell_dk_ghoul_thrash); }