refactor(Core/Scripts): Spell To Scripts (#9718)

This commit is contained in:
IntelligentQuantum
2021-12-21 17:43:45 +03:30
committed by GitHub
parent 838c88f45a
commit 11a734bf2b
6 changed files with 103 additions and 31 deletions

View File

@@ -28,6 +28,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
// TODO: this import is not necessary for compilation and marked as unused by the IDE
// however, for some reasons removing it would cause a damn linking issue
@@ -306,10 +307,35 @@ public:
}
};
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;
}
}
SetHitDamage(damage);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pet_dk_gargoyle_strike::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
void AddSC_deathknight_pet_scripts()
{
new npc_pet_dk_ebon_gargoyle();
new npc_pet_dk_ghoul();
new npc_pet_dk_army_of_the_dead();
new npc_pet_dk_dancing_rune_weapon();
RegisterSpellScript(spell_pet_dk_gargoyle_strike);
}