aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Examples/example_spell.cpp8
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp10
2 files changed, 18 insertions, 0 deletions
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp
index 028d016330c..2ac16878d13 100644
--- a/src/server/scripts/Examples/example_spell.cpp
+++ b/src/server/scripts/Examples/example_spell.cpp
@@ -99,6 +99,12 @@ class spell_ex_5581 : public SpellScriptLoader
sLog->outString("Spell just finished hitting target!");
}
+ void FilterTargets(std::list<Unit*>& /*targetList*/)
+ {
+ // usually you want this call for Area Target spells
+ sLog->outString("Spell is about to add targets from targetList to final targets!");
+ }
+
// register functions used in spell script - names of these functions do not matter
void Register()
{
@@ -118,6 +124,8 @@ class spell_ex_5581 : public SpellScriptLoader
OnHit += SpellHitFn(spell_ex_5581SpellScript::HandleOnHit);
// bind handler to AfterHit event of the spell
AfterHit += SpellHitFn(spell_ex_5581SpellScript::HandleAfterHit);
+ // bind handler to OnUnitTargetSelect event of the spell
+ //OnUnitTargetSelect += SpellUnitTargetFn(spell_ex_5581SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER);
}
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
index 3141961782e..efe33f6bd74 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
@@ -463,9 +463,19 @@ class spell_rotface_ooze_flood : public SpellScriptLoader
GetHitUnit()->CastSpell(list.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : 0);
}
+ void FilterTargets(std::list<Unit*>& targetList)
+ {
+ // get 2 targets except 2 nearest
+ targetList.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
+ targetList.resize(4);
+ while (targetList.size() > 2)
+ targetList.pop_front();
+ }
+
void Register()
{
OnEffect += SpellEffectFn(spell_rotface_ooze_flood_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_ooze_flood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_AREA_ENTRY_SRC);
}
};