Scripts/Spells: fix wrath of the astromancer and stop the startup error.

This commit is contained in:
Kandera
2012-07-06 10:21:00 -04:00
parent 6a83cd453c
commit 2bcc29136a
2 changed files with 13 additions and 37 deletions
@@ -0,0 +1 @@
UPDATE `spell_script_names` SET `spell_id` = 42787 WHERE `spell_id` = 42784;
@@ -501,9 +501,9 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
public: public:
spell_astromancer_wrath_of_the_astromancer() : SpellScriptLoader("spell_astromancer_wrath_of_the_astromancer") { } spell_astromancer_wrath_of_the_astromancer() : SpellScriptLoader("spell_astromancer_wrath_of_the_astromancer") { }
class spell_astromancer_wrath_of_the_astromancer_SpellScript : public SpellScript class spell_astromancer_wrath_of_the_astromancer_AuraScript : public AuraScript
{ {
PrepareSpellScript(spell_astromancer_wrath_of_the_astromancer_SpellScript); PrepareAuraScript(spell_astromancer_wrath_of_the_astromancer_AuraScript);
bool Validate(SpellInfo const* /*SpellEntry*/) bool Validate(SpellInfo const* /*SpellEntry*/)
{ {
@@ -512,50 +512,25 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
return true; return true;
} }
bool Load() void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
_targetCount = 0; // Final heal only on duration end
return true; if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
}
void CountTargets(std::list<WorldObject*>& targetList)
{
_targetCount = targetList.size();
}
void HandleDummy(SpellEffIndex /* effIndex */)
{
if (Unit* caster = GetOriginalCaster())
if (Unit* target = GetHitUnit())
{
if (!target->isAlive() || !_targetCount)
return; return;
int32 damage = 10000 / _targetCount; Unit* target = GetUnitOwner();
target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_1].CalcValue(),false);
SpellNonMeleeDamage damageInfo(caster, target, GetSpellInfo()->Id, GetSpellInfo()->SchoolMask);
damageInfo.damage = damage;
caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &damageInfo.absorb, &damageInfo.resist, GetSpellInfo());
caster->DealDamageMods(target, damageInfo.damage, &damageInfo.absorb);
caster->SendSpellNonMeleeDamageLog(&damageInfo);
caster->DealSpellDamage(&damageInfo, false);
} }
}
private:
int32 _targetCount;
void Register() void Register()
{ {
OnEffectHitTarget += SpellEffectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); AfterEffectRemove += AuraEffectRemoveFn(spell_astromancer_wrath_of_the_astromancer_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS);
} }
}; };
SpellScript* GetSpellScript() const AuraScript* GetAuraScript() const
{ {
return new spell_astromancer_wrath_of_the_astromancer_SpellScript(); return new spell_astromancer_wrath_of_the_astromancer_AuraScript();
} }
}; };