Core/SpellScripts: Changed OnUnitTargetSelect hook to OnObjectAreaTargetSelect, it will now work with WorldObject instead of only Units and call it even for empty target lists

This commit is contained in:
Shauren
2012-06-29 21:53:35 +02:00
parent 6e4da3367a
commit e0997874f5
44 changed files with 368 additions and 351 deletions
@@ -602,14 +602,14 @@ class spell_gothik_shadow_bolt_volley : public SpellScriptLoader
{
PrepareSpellScript(spell_gothik_shadow_bolt_volley_SpellScript);
void FilterTargets(std::list<Unit*>& unitList)
void FilterTargets(std::list<WorldObject*>& targets)
{
unitList.remove_if(Trinity::UnitAuraCheck(false, SPELL_SHADOW_MARK));
targets.remove_if(Trinity::UnitAuraCheck(false, SPELL_SHADOW_MARK));
}
void Register()
{
OnUnitTargetSelect += SpellUnitTargetFn(spell_gothik_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gothik_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
@@ -456,10 +456,10 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void HandleTargets(std::list<Unit*>& targetList)
void HandleTargets(std::list<WorldObject*>& targets)
{
uint8 count = 0;
for (std::list<Unit*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
for (std::list<WorldObject*>::iterator ihit = targets.begin(); ihit != targets.end(); ++ihit)
if ((*ihit)->GetGUID() != GetCaster()->GetGUID())
if (Player* target = (*ihit)->ToPlayer())
if (target->HasAura(GetTriggeringSpell()->Id))
@@ -498,7 +498,7 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_thaddius_pos_neg_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
OnUnitTargetSelect += SpellUnitTargetFn(spell_thaddius_pos_neg_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_thaddius_pos_neg_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};