Scripts/Spells: Convert code from Spell::EffectDummy to spell scripts.
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "naxxramas.h"
|
||||
|
||||
//Stalagg
|
||||
@@ -87,7 +86,9 @@ enum ThaddiusSpells
|
||||
SPELL_POSITIVE_CHARGE = 28062,
|
||||
SPELL_POSITIVE_CHARGE_STACK = 29659,
|
||||
SPELL_NEGATIVE_CHARGE = 28085,
|
||||
SPELL_NEGATIVE_CHARGE_STACK = 29660
|
||||
SPELL_NEGATIVE_CHARGE_STACK = 29660,
|
||||
SPELL_POSITIVE_POLARITY = 28059,
|
||||
SPELL_NEGATIVE_POLARITY = 28084,
|
||||
};
|
||||
|
||||
enum Events
|
||||
@@ -503,6 +504,41 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
class spell_thaddius_polarity_shift : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_thaddius_polarity_shift() : SpellScriptLoader("spell_thaddius_polarity_shift") { }
|
||||
|
||||
class spell_thaddius_polarity_shift_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_thaddius_polarity_shift_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_POLARITY) || !sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_POLARITY))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, NULL, NULL, caster->GetGUID());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_thaddius_polarity_shift_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_thaddius_polarity_shift_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class achievement_polarity_switch : public AchievementCriteriaScript
|
||||
{
|
||||
public:
|
||||
@@ -520,5 +556,6 @@ void AddSC_boss_thaddius()
|
||||
new mob_stalagg();
|
||||
new mob_feugen();
|
||||
new spell_thaddius_pos_neg_charge();
|
||||
new spell_thaddius_polarity_shift();
|
||||
new achievement_polarity_switch();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user