Scripts/Spells: Convert code from Spell::EffectDummy to spell scripts.
This commit is contained in:
1 parent
d55c8c7cc4
commit
c517806a23
24 files changed
+4446
-2965
No files matched your search
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_warl_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
@@ -99,15 +98,7 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_IMP))
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_IMP))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -172,9 +163,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R1))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R2))
|
||||
if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R1) || !sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R2))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -267,7 +256,8 @@ public:
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetCaster()->CastSpell(GetCaster(), GetEffectValue(), true);
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastSpell(caster, GetEffectValue(), true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -293,7 +283,8 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
{
|
||||
unitList.remove(GetTargetUnit());
|
||||
if (GetTargetUnit())
|
||||
unitList.remove(GetTargetUnit());
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -308,6 +299,147 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
enum Soulshatter
|
||||
{
|
||||
SPELL_SOULSHATTER = 32835,
|
||||
};
|
||||
|
||||
class spell_warl_soulshatter : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warl_soulshatter() : SpellScriptLoader("spell_warl_soulshatter") { }
|
||||
|
||||
class spell_warl_soulshatter_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warl_soulshatter_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SOULSHATTER))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (target->CanHaveThreatList() && target->getThreatManager().getThreat(caster) > 0.0f)
|
||||
{
|
||||
sLog->outString("THREATREDUCTION");
|
||||
caster->CastSpell(target, SPELL_SOULSHATTER, true);
|
||||
} else
|
||||
sLog->outString("can have threat? %b . threat number? %f ",target->CanHaveThreatList(),target->getThreatManager().getThreat(caster));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warl_soulshatter_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warl_soulshatter_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum LifeTap
|
||||
{
|
||||
SPELL_LIFE_TAP_RANK_6 = 11689,
|
||||
SPELL_LIFE_TAP_RANK_7 = 27222,
|
||||
SPELL_LIFE_TAP_RANK_8 = 57946,
|
||||
SPELL_LIFE_TAP_ENERGIZE = 31818,
|
||||
SPELL_LIFE_TAP_ENERGIZE_2 = 32553,
|
||||
ICON_ID_IMPROVED_LIFE_TAP = 208,
|
||||
ICON_ID_MANA_FEED = 1982,
|
||||
};
|
||||
|
||||
class spell_warl_life_tap : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warl_life_tap() : SpellScriptLoader("spell_warl_life_tap") { }
|
||||
|
||||
class spell_warl_life_tap_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warl_life_tap_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_6) || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_7)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_8) || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE_2))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
SpellInfo const* spellInfo = GetSpellInfo();
|
||||
float spFactor = 0.0f;
|
||||
int32 damage = int32(GetEffectValue() + (6.3875 * spellInfo->BaseLevel));
|
||||
switch (spellInfo->Id)
|
||||
{
|
||||
case SPELL_LIFE_TAP_RANK_6: spFactor = 0.2f; break;
|
||||
case SPELL_LIFE_TAP_RANK_7:
|
||||
case SPELL_LIFE_TAP_RANK_8: spFactor = 0.5f; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
int32 mana = int32(damage + (caster->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor));
|
||||
|
||||
// Shouldn't Appear in Combat Log
|
||||
target->ModifyHealth(-damage);
|
||||
|
||||
// Improved Life Tap mod
|
||||
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, ICON_ID_IMPROVED_LIFE_TAP, 0))
|
||||
AddPctN(mana, aurEff->GetAmount());
|
||||
|
||||
caster->CastCustomSpell(target, SPELL_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false);
|
||||
|
||||
// Mana Feed
|
||||
int32 manaFeedVal = 0;
|
||||
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, ICON_ID_MANA_FEED, 0))
|
||||
manaFeedVal = aurEff->GetAmount();
|
||||
|
||||
if (manaFeedVal > 0)
|
||||
{
|
||||
ApplyPctN(manaFeedVal, mana);
|
||||
caster->CastCustomSpell(caster, SPELL_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
if ((int32(GetCaster()->GetHealth()) > int32(GetSpellInfo()->Effects[EFFECT_0].CalcValue() + (6.3875 * GetSpellInfo()->BaseLevel))))
|
||||
{
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
return SPELL_FAILED_FIZZLE;
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warl_life_tap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnCheckCast += SpellCheckCastFn(spell_warl_life_tap_SpellScript::CheckCast);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_warl_life_tap_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_warlock_spell_scripts()
|
||||
{
|
||||
new spell_warl_banish();
|
||||
@@ -316,4 +448,6 @@ void AddSC_warlock_spell_scripts()
|
||||
new spell_warl_everlasting_affliction();
|
||||
new spell_warl_ritual_of_doom_effect();
|
||||
new spell_warl_seed_of_corruption();
|
||||
new spell_warl_soulshatter();
|
||||
new spell_warl_life_tap();
|
||||
}
|
||||
Reference in new issue
Block a user