Hello, I’m looking for a way to script any spell to do some extra damage like for example the same thing as doing .damage xxx ingame to a something or cast another spell when you cast it.
Any Help is Appreciated.
EDIT:
Here is what im working with atm.
#include “ScriptPCH.h”
#include “Player.h”
#include “ScriptMgr.h”
#include “SpellHistory.h”
#include “SpellScript.h”
#include “SpellAuraEffects.h”
class Test_Spell : public SpellScriptLoader
{
public:
Test_Spell() : SpellScriptLoader(“Test_Spell”) { }
class Test_Spell_SpellScript : public SpellScript
{
PrepareSpellScript(Test_Spell_SpellScript);
void HandleDummy(SpellEffIndex)
{
SpellInfo const* spellInfo = GetSpellInfo();
CleanDamage const* cleanDamage = NULL;
uint32 damage = 1000;
Unit* caster = GetCaster();
Unit* target = GetExplTargetUnit();
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
return;
caster->ToUnit()->DealDamage(target, damage, cleanDamage, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE, spellInfo, true);
}
void Register()
{
OnEffectHit += SpellEffectFn(Test_Spell_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript * GetSpellScript() const
{
return new Test_Spell_SpellScript();
}
};
void AddSC_test_spell_scripts()
{
new Test_Spell;
}