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 committed 2012-06-29 21:53:35 +02:00
1 parent 6e4da3367a
commit e0997874f5
44 files changed
+368 -351

No files matched your search

+16 -13
View File
@@ -262,9 +262,12 @@ class EarthenPowerTargetSelector
public:
EarthenPowerTargetSelector() { }
bool operator() (Unit* target)
bool operator() (WorldObject* target)
{
if (!target->HasAuraWithMechanic(1 << MECHANIC_SNARE))
if (!target->ToUnit())
return true;
if (!target->ToUnit()->HasAuraWithMechanic(1 << MECHANIC_SNARE))
return true;
return false;
@@ -280,14 +283,14 @@ class spell_sha_earthen_power : public SpellScriptLoader
{
PrepareSpellScript(spell_sha_earthen_power_SpellScript);
void FilterTargets(std::list<Unit*>& unitList)
void FilterTargets(std::list<WorldObject*>& unitList)
{
unitList.remove_if(EarthenPowerTargetSelector());
}
void Register()
{
OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_earthen_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_earthen_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
}
};
@@ -313,7 +316,7 @@ class spell_sha_bloodlust : public SpellScriptLoader
return true;
}
void RemoveInvalidTargets(std::list<Unit*>& targets)
void RemoveInvalidTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED));
}
@@ -326,9 +329,9 @@ class spell_sha_bloodlust : public SpellScriptLoader
void Register()
{
OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID);
OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID);
AfterHit += SpellHitFn(spell_sha_bloodlust_SpellScript::ApplyDebuff);
}
};
@@ -355,9 +358,9 @@ class spell_sha_heroism : public SpellScriptLoader
return true;
}
void RemoveInvalidTargets(std::list<Unit*>& targets)
void RemoveInvalidTargets(std::list<WorldObject*>& targets)
{
targets.remove_if (Trinity::UnitAuraCheck(true, SHAMAN_SPELL_EXHAUSTION));
targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_EXHAUSTION));
}
void ApplyDebuff()
@@ -368,9 +371,9 @@ class spell_sha_heroism : public SpellScriptLoader
void Register()
{
OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID);
OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_RAID);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_heroism_SpellScript::RemoveInvalidTargets, EFFECT_2, TARGET_UNIT_CASTER_AREA_RAID);
AfterHit += SpellHitFn(spell_sha_heroism_SpellScript::ApplyDebuff);
}
};