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:
@@ -1325,11 +1325,16 @@ namespace Trinity
|
||||
{
|
||||
public:
|
||||
UnitAuraCheck(bool present, uint32 spellId, uint64 casterGUID = 0) : _present(present), _spellId(spellId), _casterGUID(casterGUID) {}
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(Unit* unit) const
|
||||
{
|
||||
return unit->HasAura(_spellId, _casterGUID) == _present;
|
||||
}
|
||||
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
return object->ToUnit() && object->ToUnit()->HasAura(_spellId, _casterGUID) == _present;
|
||||
}
|
||||
|
||||
private:
|
||||
bool _present;
|
||||
uint32 _spellId;
|
||||
|
||||
@@ -1041,7 +1041,9 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
{
|
||||
Trinity::WorldObjectSpellConeTargetCheck check(coneAngle, radius, m_caster, m_spellInfo, selectionType, condList);
|
||||
Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> searcher(m_caster, targets, check, containerTypeMask);
|
||||
SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> > (searcher, containerTypeMask, m_caster, m_caster, radius);
|
||||
SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> >(searcher, containerTypeMask, m_caster, m_caster, radius);
|
||||
|
||||
CallScriptObjectAreaTargetSelectHandlers(targets, effIndex);
|
||||
|
||||
if (!targets.empty())
|
||||
{
|
||||
@@ -1069,8 +1071,6 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
gObjTargets.push_back(gObjTarget);
|
||||
}
|
||||
|
||||
CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex);
|
||||
|
||||
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr)
|
||||
AddUnitTarget(*itr, effMask, false);
|
||||
|
||||
@@ -1217,6 +1217,8 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
gObjTargets.push_back(gObjTarget);
|
||||
}
|
||||
|
||||
CallScriptObjectAreaTargetSelectHandlers(targets, effIndex);
|
||||
|
||||
if (!unitTargets.empty())
|
||||
{
|
||||
// Special target selection for smart heals and energizes
|
||||
@@ -1342,8 +1344,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
Trinity::Containers::RandomResizeList(unitTargets, maxTargets);
|
||||
}
|
||||
|
||||
CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex);
|
||||
|
||||
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr)
|
||||
AddUnitTarget(*itr, effMask, false);
|
||||
}
|
||||
@@ -1359,6 +1359,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
|
||||
Trinity::Containers::RandomResizeList(gObjTargets, maxTargets);
|
||||
}
|
||||
|
||||
for (std::list<GameObject*>::iterator itr = gObjTargets.begin(); itr != gObjTargets.end(); ++itr)
|
||||
AddGOTarget(*itr, effMask);
|
||||
}
|
||||
@@ -1567,7 +1568,8 @@ void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTarg
|
||||
if (Unit* unitTarget = (*itr)->ToUnit())
|
||||
unitTargets.push_back(unitTarget);
|
||||
|
||||
CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex);
|
||||
// Chain primary target is added earlier
|
||||
CallScriptObjectAreaTargetSelectHandlers(targets, effIndex);
|
||||
|
||||
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr)
|
||||
AddUnitTarget(*itr, effMask, false);
|
||||
@@ -7036,15 +7038,15 @@ void Spell::CallScriptAfterHitHandlers()
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex)
|
||||
void Spell::CallScriptObjectAreaTargetSelectHandlers(std::list<WorldObject*>& targets, SpellEffIndex effIndex)
|
||||
{
|
||||
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
|
||||
{
|
||||
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT);
|
||||
std::list<SpellScript::UnitTargetHandler>::iterator hookItrEnd = (*scritr)->OnUnitTargetSelect.end(), hookItr = (*scritr)->OnUnitTargetSelect.begin();
|
||||
std::list<SpellScript::ObjectAreaTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectAreaTargetSelect.end(), hookItr = (*scritr)->OnObjectAreaTargetSelect.begin();
|
||||
for (; hookItr != hookItrEnd; ++hookItr)
|
||||
if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex))
|
||||
(*hookItr).Call(*scritr, unitTargets);
|
||||
(*hookItr).Call(*scritr, targets);
|
||||
|
||||
(*scritr)->_FinishScriptCall();
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ class Spell
|
||||
void CallScriptBeforeHitHandlers();
|
||||
void CallScriptOnHitHandlers();
|
||||
void CallScriptAfterHitHandlers();
|
||||
void CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex);
|
||||
void CallScriptObjectAreaTargetSelectHandlers(std::list<WorldObject*>& targets, SpellEffIndex effIndex);
|
||||
std::list<SpellScript*> m_loadedScripts;
|
||||
|
||||
struct HitTriggerSpell
|
||||
|
||||
@@ -203,50 +203,56 @@ void SpellScript::HitHandler::Call(SpellScript* spellScript)
|
||||
(spellScript->*pHitHandlerScript)();
|
||||
}
|
||||
|
||||
SpellScript::UnitTargetHandler::UnitTargetHandler(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType)
|
||||
SpellScript::ObjectAreaTargetSelectHandler::ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType)
|
||||
: _SpellScript::EffectHook(_effIndex), targetType(_targetType)
|
||||
{
|
||||
pUnitTargetHandlerScript = _pUnitTargetHandlerScript;
|
||||
pObjectAreaTargetSelectHandlerScript = _pObjectAreaTargetSelectHandlerScript;
|
||||
}
|
||||
|
||||
std::string SpellScript::UnitTargetHandler::ToString()
|
||||
std::string SpellScript::ObjectAreaTargetSelectHandler::ToString()
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Index: " << EffIndexToString() << " Target: " << targetType;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
bool SpellScript::UnitTargetHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
|
||||
bool SpellScript::ObjectAreaTargetSelectHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
|
||||
{
|
||||
if (!targetType)
|
||||
return false;
|
||||
return (effIndex == EFFECT_ALL) || (spellEntry->Effects[effIndex].TargetA.GetTarget() == targetType || spellEntry->Effects[effIndex].TargetB.GetTarget() == targetType);
|
||||
|
||||
if (spellEntry->Effects[effIndex].TargetA.GetTarget() != targetType &&
|
||||
spellEntry->Effects[effIndex].TargetB.GetTarget() != targetType)
|
||||
return false;
|
||||
|
||||
// TODO: Smart check if this hook will run for this targetType
|
||||
return true;
|
||||
}
|
||||
|
||||
void SpellScript::UnitTargetHandler::Call(SpellScript* spellScript, std::list<Unit*>& unitTargets)
|
||||
void SpellScript::ObjectAreaTargetSelectHandler::Call(SpellScript* spellScript, std::list<WorldObject*>& targets)
|
||||
{
|
||||
(spellScript->*pUnitTargetHandlerScript)(unitTargets);
|
||||
(spellScript->*pObjectAreaTargetSelectHandlerScript)(targets);
|
||||
}
|
||||
|
||||
bool SpellScript::_Validate(SpellInfo const* entry)
|
||||
{
|
||||
for (std::list<EffectHandler>::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr)
|
||||
for (std::list<EffectHandler>::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr)
|
||||
if (!(*itr).GetAffectedEffectsMask(entry))
|
||||
sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
|
||||
|
||||
for (std::list<EffectHandler>::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr)
|
||||
for (std::list<EffectHandler>::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr)
|
||||
if (!(*itr).GetAffectedEffectsMask(entry))
|
||||
sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
|
||||
|
||||
for (std::list<EffectHandler>::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr)
|
||||
for (std::list<EffectHandler>::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr)
|
||||
if (!(*itr).GetAffectedEffectsMask(entry))
|
||||
sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
|
||||
|
||||
for (std::list<EffectHandler>::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr)
|
||||
for (std::list<EffectHandler>::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr)
|
||||
if (!(*itr).GetAffectedEffectsMask(entry))
|
||||
sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
|
||||
|
||||
for (std::list<UnitTargetHandler>::iterator itr = OnUnitTargetSelect.begin(); itr != OnUnitTargetSelect.end(); ++itr)
|
||||
for (std::list<ObjectAreaTargetSelectHandler>::iterator itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr)
|
||||
if (!(*itr).GetAffectedEffectsMask(entry))
|
||||
sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnUnitTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ class SpellScript : public _SpellScript
|
||||
typedef void(CLASSNAME::*SpellEffectFnType)(SpellEffIndex); \
|
||||
typedef void(CLASSNAME::*SpellHitFnType)(); \
|
||||
typedef void(CLASSNAME::*SpellCastFnType)(); \
|
||||
typedef void(CLASSNAME::*SpellUnitTargetFnType)(std::list<Unit*>&); \
|
||||
typedef void(CLASSNAME::*SpellObjectAreaTargetSelectFnType)(std::list<WorldObject*>&); \
|
||||
|
||||
SPELLSCRIPT_FUNCTION_TYPE_DEFINES(SpellScript)
|
||||
|
||||
@@ -196,15 +196,15 @@ class SpellScript : public _SpellScript
|
||||
SpellHitFnType pHitHandlerScript;
|
||||
};
|
||||
|
||||
class UnitTargetHandler : public _SpellScript::EffectHook
|
||||
class ObjectAreaTargetSelectHandler : public _SpellScript::EffectHook
|
||||
{
|
||||
public:
|
||||
UnitTargetHandler(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType);
|
||||
ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType);
|
||||
std::string ToString();
|
||||
bool CheckEffect(SpellInfo const* spellEntry, uint8 targetType);
|
||||
void Call(SpellScript* spellScript, std::list<Unit*>& unitTargets);
|
||||
void Call(SpellScript* spellScript, std::list<WorldObject*>& targets);
|
||||
private:
|
||||
SpellUnitTargetFnType pUnitTargetHandlerScript;
|
||||
SpellObjectAreaTargetSelectFnType pObjectAreaTargetSelectHandlerScript;
|
||||
uint16 targetType;
|
||||
};
|
||||
|
||||
@@ -213,7 +213,7 @@ class SpellScript : public _SpellScript
|
||||
class CheckCastHandlerFunction : public SpellScript::CheckCastHandler { public: CheckCastHandlerFunction(SpellCheckCastFnType _checkCastHandlerScript) : SpellScript::CheckCastHandler((SpellScript::SpellCheckCastFnType)_checkCastHandlerScript) {} }; \
|
||||
class EffectHandlerFunction : public SpellScript::EffectHandler { public: EffectHandlerFunction(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : SpellScript::EffectHandler((SpellScript::SpellEffectFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \
|
||||
class HitHandlerFunction : public SpellScript::HitHandler { public: HitHandlerFunction(SpellHitFnType _pHitHandlerScript) : SpellScript::HitHandler((SpellScript::SpellHitFnType)_pHitHandlerScript) {} }; \
|
||||
class UnitTargetHandlerFunction : public SpellScript::UnitTargetHandler { public: UnitTargetHandlerFunction(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::UnitTargetHandler((SpellScript::SpellUnitTargetFnType)_pUnitTargetHandlerScript, _effIndex, _targetType) {} }; \
|
||||
class ObjectAreaTargetSelectHandlerFunction : public SpellScript::ObjectAreaTargetSelectHandler { public: ObjectAreaTargetSelectHandlerFunction(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectAreaTargetSelectHandler((SpellScript::SpellObjectAreaTargetSelectFnType)_pObjectAreaTargetSelectHandlerScript, _effIndex, _targetType) {} }; \
|
||||
|
||||
#define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
|
||||
public:
|
||||
@@ -269,8 +269,8 @@ class SpellScript : public _SpellScript
|
||||
|
||||
// example: OnUnitTargetSelect += SpellUnitTargetFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier);
|
||||
// where function is void function(std::list<Unit*>& targetList)
|
||||
HookList<UnitTargetHandler> OnUnitTargetSelect;
|
||||
#define SpellUnitTargetFn(F, I, N) UnitTargetHandlerFunction(&F, I, N)
|
||||
HookList<ObjectAreaTargetSelectHandler> OnObjectAreaTargetSelect;
|
||||
#define SpellObjectAreaTargetSelectFn(F, I, N) ObjectAreaTargetSelectHandlerFunction(&F, I, N)
|
||||
|
||||
// hooks are executed in following order, at specified event of spell:
|
||||
// 1. BeforeCast - executed when spell preparation is finished (when cast bar becomes full) before cast is handled
|
||||
@@ -302,7 +302,7 @@ class SpellScript : public _SpellScript
|
||||
// -shadowstep - explicit target is the unit you want to go behind of
|
||||
// -chain heal - explicit target is the unit to be healed first
|
||||
// -holy nova/arcane explosion - explicit target = NULL because target you are selecting doesn't affect how spell targets are selected
|
||||
// you can determine if spell requires explicit targets by dbc columns:
|
||||
// you can determine if spell requires explicit targets by dbc columns:
|
||||
// - Targets - mask of explicit target types
|
||||
// - ImplicitTargetXX set to TARGET_XXX_TARGET_YYY, _TARGET_ here means that explicit target is used by the effect, so spell needs one too
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
static bool HandleInstanceListBindsCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleInstanceListBindsCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
Player* player = handler->getSelectedPlayer();
|
||||
if (!player)
|
||||
|
||||
@@ -207,7 +207,7 @@ public:
|
||||
}
|
||||
|
||||
// mail case
|
||||
uint32 mailCount;
|
||||
uint32 mailCount = 0;
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT_ITEM);
|
||||
stmt->setUInt32(0, itemId);
|
||||
|
||||
@@ -199,11 +199,10 @@ public:
|
||||
class MarkTargetFilter
|
||||
{
|
||||
public:
|
||||
bool operator()(Unit* target) const
|
||||
bool operator()(WorldObject* target) const
|
||||
{
|
||||
if (target->getPowerType() != POWER_MANA)
|
||||
return true;
|
||||
|
||||
if (Unit* unit = target->ToUnit())
|
||||
return unit->getPowerType() != POWER_MANA;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -217,14 +216,14 @@ class spell_mark_of_kazrogal : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_mark_of_kazrogal_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove_if(MarkTargetFilter());
|
||||
targets.remove_if(MarkTargetFilter());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_mark_of_kazrogal_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_kazrogal_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -707,16 +707,16 @@ class spell_energize_aoe : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end();)
|
||||
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
|
||||
{
|
||||
if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE)
|
||||
++itr;
|
||||
else
|
||||
unitList.erase(itr++);
|
||||
targets.erase(itr++);
|
||||
}
|
||||
unitList.push_back(GetCaster());
|
||||
targets.push_back(GetCaster());
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
@@ -728,8 +728,8 @@ class spell_energize_aoe : public SpellScriptLoader
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_energize_aoe_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_energize_aoe_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ class ConflagrationTargetSelector
|
||||
public:
|
||||
ConflagrationTargetSelector() { }
|
||||
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(WorldObject* unit) const
|
||||
{
|
||||
return unit->GetTypeId() != TYPEID_PLAYER;
|
||||
}
|
||||
@@ -201,12 +201,12 @@ class spell_saviana_conflagration_init : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_saviana_conflagration_init_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove_if (ConflagrationTargetSelector());
|
||||
targets.remove_if(ConflagrationTargetSelector());
|
||||
uint8 maxSize = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 3);
|
||||
if (unitList.size() > maxSize)
|
||||
Trinity::Containers::RandomResizeList(unitList, maxSize);
|
||||
if (targets.size() > maxSize)
|
||||
Trinity::Containers::RandomResizeList(targets, maxSize);
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
@@ -218,7 +218,7 @@ class spell_saviana_conflagration_init : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_saviana_conflagration_init_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_saviana_conflagration_init_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_saviana_conflagration_init_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
+7
-6
@@ -60,9 +60,9 @@ class OrientationCheck : public std::unary_function<Unit*, bool>
|
||||
{
|
||||
public:
|
||||
explicit OrientationCheck(Unit* _caster) : caster(_caster) { }
|
||||
bool operator() (Unit* unit)
|
||||
bool operator()(WorldObject* object)
|
||||
{
|
||||
return !unit->isInFront(caster, 2.5f) || !unit->IsWithinDist(caster, 40.0f);
|
||||
return !object->isInFront(caster, 2.5f) || !object->IsWithinDist(caster, 40.0f);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -76,15 +76,16 @@ class spell_eadric_radiance : public SpellScriptLoader
|
||||
class spell_eadric_radiance_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_eadric_radiance_SpellScript);
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList.remove_if (OrientationCheck(GetCaster()));
|
||||
unitList.remove_if(OrientationCheck(GetCaster()));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ class DistanceCheck
|
||||
public:
|
||||
explicit DistanceCheck(Unit* _caster) : caster(_caster) { }
|
||||
|
||||
bool operator() (Unit* unit)
|
||||
bool operator() (WorldObject* unit) const
|
||||
{
|
||||
if (caster->GetExactDist2d(unit) <= 10.0f)
|
||||
return true;
|
||||
@@ -378,25 +378,25 @@ class spell_bronjahm_soulstorm_targeting : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_bronjahm_soulstorm_targeting_SpellScript);
|
||||
|
||||
void FilterTargetsInitial(std::list<Unit*>& unitList)
|
||||
void FilterTargetsInitial(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove_if (DistanceCheck(GetCaster()));
|
||||
sharedUnitList = unitList;
|
||||
targets.remove_if(DistanceCheck(GetCaster()));
|
||||
sharedTargets = targets;
|
||||
}
|
||||
|
||||
// use the same target for first and second effect
|
||||
void FilterTargetsSubsequent(std::list<Unit*>& unitList)
|
||||
void FilterTargetsSubsequent(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList = sharedUnitList;
|
||||
targets = sharedTargets;
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsInitial, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsInitial, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
}
|
||||
|
||||
std::list<Unit*> sharedUnitList;
|
||||
std::list<WorldObject*> sharedTargets;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
|
||||
@@ -631,9 +631,9 @@ class BloodboltHitCheck
|
||||
public:
|
||||
explicit BloodboltHitCheck(LanaThelAI* ai) : _ai(ai) {}
|
||||
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
return _ai->WasBloodbolted(unit->GetGUID());
|
||||
return _ai->WasBloodbolted(object->GetGUID());
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -661,13 +661,13 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader
|
||||
return GetCaster()->GetEntry() == NPC_BLOOD_QUEEN_LANA_THEL;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& targets)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
uint32 targetCount = (targets.size() + 2) / 3;
|
||||
targets.remove_if (BloodboltHitCheck(static_cast<LanaThelAI*>(GetCaster()->GetAI())));
|
||||
targets.remove_if(BloodboltHitCheck(static_cast<LanaThelAI*>(GetCaster()->GetAI())));
|
||||
Trinity::Containers::RandomResizeList(targets, targetCount);
|
||||
// mark targets now, effect hook has missile travel time delay (might cast next in that time)
|
||||
for (std::list<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
|
||||
for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
|
||||
GetCaster()->GetAI()->SetGUID((*itr)->GetGUID(), GUID_BLOODBOLT);
|
||||
}
|
||||
|
||||
@@ -679,7 +679,7 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_blood_queen_bloodbolt_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_bloodbolt_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_blood_queen_bloodbolt_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
@@ -699,19 +699,19 @@ class spell_blood_queen_pact_of_the_darkfallen : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove_if (Trinity::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN));
|
||||
targets.remove_if(Trinity::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN));
|
||||
|
||||
bool remove = true;
|
||||
std::list<Unit*>::const_iterator itrEnd = unitList.end(), itr, itr2;
|
||||
std::list<WorldObject*>::const_iterator itrEnd = targets.end(), itr, itr2;
|
||||
// we can do this, unitList is MAX 4 in size
|
||||
for (itr = unitList.begin(); itr != itrEnd && remove; ++itr)
|
||||
for (itr = targets.begin(); itr != itrEnd && remove; ++itr)
|
||||
{
|
||||
if (!GetCaster()->IsWithinDist(*itr, 5.0f, false))
|
||||
remove = false;
|
||||
|
||||
for (itr2 = unitList.begin(); itr2 != itrEnd && remove; ++itr2)
|
||||
for (itr2 = targets.begin(); itr2 != itrEnd && remove; ++itr2)
|
||||
if (itr != itr2 && !(*itr2)->IsWithinDist(*itr, 5.0f, false))
|
||||
remove = false;
|
||||
}
|
||||
@@ -721,14 +721,14 @@ class spell_blood_queen_pact_of_the_darkfallen : public SpellScriptLoader
|
||||
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
|
||||
{
|
||||
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN);
|
||||
unitList.clear();
|
||||
targets.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_blood_queen_pact_of_the_darkfallen_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -785,15 +785,15 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg_target : public SpellScriptLo
|
||||
{
|
||||
PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList.remove_if (Trinity::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN));
|
||||
unitList.remove_if(Trinity::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN));
|
||||
unitList.push_back(GetCaster());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1198,34 +1198,34 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargetsInitial(std::list<Unit*>& unitList)
|
||||
void FilterTargetsInitial(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (unitList.empty())
|
||||
if (targets.empty())
|
||||
return;
|
||||
|
||||
// select one random target, with preference of ranged targets
|
||||
uint32 targetsAtRange = 0;
|
||||
uint32 const minTargets = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 10 : 4);
|
||||
unitList.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false));
|
||||
targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false));
|
||||
|
||||
// get target count at range
|
||||
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr, ++targetsAtRange)
|
||||
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr, ++targetsAtRange)
|
||||
if ((*itr)->GetDistance(GetCaster()) < 12.0f)
|
||||
break;
|
||||
|
||||
// set the upper cap
|
||||
if (targetsAtRange < minTargets)
|
||||
targetsAtRange = std::min<uint32>(unitList.size() - 1, minTargets);
|
||||
targetsAtRange = std::min<uint32>(targets.size() - 1, minTargets);
|
||||
|
||||
std::list<Unit*>::const_iterator itr = unitList.begin();
|
||||
std::list<WorldObject*>::const_iterator itr = targets.begin();
|
||||
std::advance(itr, urand(0, targetsAtRange));
|
||||
target = *itr;
|
||||
unitList.clear();
|
||||
unitList.push_back(target);
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
}
|
||||
|
||||
// use the same target for first and second effect
|
||||
void FilterTargetsSubsequent(std::list<Unit*>& unitList)
|
||||
void FilterTargetsSubsequent(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
@@ -1241,12 +1241,12 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_blood_nova_targeting_SpellScript::FilterTargetsSubsequent, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_deathbringer_blood_nova_targeting_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
|
||||
}
|
||||
|
||||
Unit* target;
|
||||
WorldObject* target;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
@@ -1269,20 +1269,20 @@ class spell_deathbringer_boiling_blood : public SpellScriptLoader
|
||||
return GetCaster()->GetTypeId() == TYPEID_UNIT;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove(GetCaster()->getVictim());
|
||||
if (unitList.empty())
|
||||
targets.remove(GetCaster()->getVictim());
|
||||
if (targets.empty())
|
||||
return;
|
||||
|
||||
Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList);
|
||||
unitList.clear();
|
||||
unitList.push_back(target);
|
||||
WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_deathbringer_boiling_blood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_deathbringer_boiling_blood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -416,7 +416,7 @@ class spell_marrowgar_coldflame : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_marrowgar_coldflame_SpellScript);
|
||||
|
||||
void SelectTarget(std::list<Unit*>& targets)
|
||||
void SelectTarget(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.clear();
|
||||
// select any unit but not the tank (by owners threatlist)
|
||||
@@ -438,7 +438,7 @@ class spell_marrowgar_coldflame : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_marrowgar_coldflame_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_marrowgar_coldflame_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -870,26 +870,26 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
|
||||
return GetCaster()->GetTypeId() == TYPEID_UNIT;
|
||||
}
|
||||
|
||||
void SelectTarget(std::list<Unit*>& targetList)
|
||||
void SelectTarget(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (targetList.empty())
|
||||
if (targets.empty())
|
||||
{
|
||||
FinishCast(SPELL_FAILED_NO_VALID_TARGETS);
|
||||
GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update
|
||||
return;
|
||||
}
|
||||
|
||||
Unit* target = Trinity::Containers::SelectRandomContainerElement(targetList);
|
||||
targetList.clear();
|
||||
targetList.push_back(target);
|
||||
WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
_target = target;
|
||||
}
|
||||
|
||||
void SetTarget(std::list<Unit*>& targetList)
|
||||
void SetTarget(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targetList.clear();
|
||||
targets.clear();
|
||||
if (_target)
|
||||
targetList.push_back(_target);
|
||||
targets.push_back(_target);
|
||||
}
|
||||
|
||||
void StartAttack()
|
||||
@@ -912,14 +912,14 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack);
|
||||
OnCast += SpellCastFn(spell_putricide_ooze_channel_SpellScript::CheckTarget);
|
||||
}
|
||||
|
||||
Unit* _target;
|
||||
WorldObject* _target;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
@@ -933,7 +933,7 @@ class ExactDistanceCheck
|
||||
public:
|
||||
ExactDistanceCheck(Unit* source, float dist) : _source(source), _dist(dist) {}
|
||||
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(WorldObject* unit) const
|
||||
{
|
||||
return _source->GetExactDist2d(unit) > _dist;
|
||||
}
|
||||
@@ -952,15 +952,15 @@ class spell_putricide_slime_puddle : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_putricide_slime_puddle_SpellScript);
|
||||
|
||||
void ScaleRange(std::list<Unit*>& targets)
|
||||
void ScaleRange(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if(ExactDistanceCheck(GetCaster(), 2.5f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X)));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1178,13 +1178,13 @@ class spell_putricide_eat_ooze : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_putricide_eat_ooze_SpellScript);
|
||||
|
||||
void SelectTarget(std::list<Unit*>& targets)
|
||||
void SelectTarget(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (targets.empty())
|
||||
return;
|
||||
|
||||
targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
|
||||
Unit* target = targets.front();
|
||||
WorldObject* target = targets.front();
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
}
|
||||
@@ -1211,7 +1211,7 @@ class spell_putricide_eat_ooze : public SpellScriptLoader
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_putricide_eat_ooze_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_eat_ooze_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_eat_ooze_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1458,15 +1458,15 @@ class spell_putricide_mutated_transformation_dmg : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_putricide_mutated_transformation_dmg_SpellScript);
|
||||
|
||||
void FilterTargetsInitial(std::list<Unit*>& unitList)
|
||||
void FilterTargetsInitial(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (Unit* owner = ObjectAccessor::GetUnit(*GetCaster(), GetCaster()->GetCreatorGUID()))
|
||||
unitList.remove(owner);
|
||||
targets.remove(owner);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_mutated_transformation_dmg_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_mutated_transformation_dmg_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -449,23 +449,23 @@ class spell_rotface_ooze_flood : public SpellScriptLoader
|
||||
GetHitUnit()->CastSpell(triggers.back(), uint32(GetEffectValue()), false, NULL, NULL, GetOriginalCaster() ? GetOriginalCaster()->GetGUID() : 0);
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& targetList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
// get 2 targets except 2 nearest
|
||||
targetList.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
|
||||
targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
|
||||
|
||||
// .resize() runs pop_back();
|
||||
if (targetList.size() > 4)
|
||||
targetList.resize(4);
|
||||
if (targets.size() > 4)
|
||||
targets.resize(4);
|
||||
|
||||
while (targetList.size() > 2)
|
||||
targetList.pop_front();
|
||||
while (targets.size() > 2)
|
||||
targets.pop_front();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += 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_SRC_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_ooze_flood_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -490,7 +490,7 @@ class spell_rotface_mutated_infection : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& targets)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
// remove targets with this aura already
|
||||
// tank is not on this list
|
||||
@@ -498,13 +498,13 @@ class spell_rotface_mutated_infection : public SpellScriptLoader
|
||||
if (targets.empty())
|
||||
return;
|
||||
|
||||
Unit* target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
_target = target;
|
||||
}
|
||||
|
||||
void ReplaceTargets(std::list<Unit*>& targets)
|
||||
void ReplaceTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.clear();
|
||||
if (_target)
|
||||
@@ -520,13 +520,13 @@ class spell_rotface_mutated_infection : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
AfterHit += SpellHitFn(spell_rotface_mutated_infection_SpellScript::NotifyTargets);
|
||||
}
|
||||
|
||||
Unit* _target;
|
||||
WorldObject* _target;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
|
||||
@@ -1044,9 +1044,9 @@ class spell_sindragosa_s_fury : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void CountTargets(std::list<Unit*>& unitList)
|
||||
void CountTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
_targetCount = unitList.size();
|
||||
_targetCount = targets.size();
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
@@ -1071,7 +1071,7 @@ class spell_sindragosa_s_fury : public SpellScriptLoader
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_sindragosa_s_fury_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_s_fury_SpellScript::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_s_fury_SpellScript::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY);
|
||||
}
|
||||
|
||||
uint32 _targetCount;
|
||||
@@ -1088,9 +1088,11 @@ class UnchainedMagicTargetSelector
|
||||
public:
|
||||
UnchainedMagicTargetSelector() { }
|
||||
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
return unit->getPowerType() != POWER_MANA;
|
||||
if (Unit* unit = object->ToUnit())
|
||||
return unit->getPowerType() != POWER_MANA;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1103,7 +1105,7 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_sindragosa_unchained_magic_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList.remove_if(UnchainedMagicTargetSelector());
|
||||
uint32 maxSize = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 2);
|
||||
@@ -1113,7 +1115,7 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_unchained_magic_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_unchained_magic_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1296,7 +1298,7 @@ class MysticBuffetTargetFilter
|
||||
public:
|
||||
explicit MysticBuffetTargetFilter(Unit* caster) : _caster(caster) { }
|
||||
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(WorldObject* unit) const
|
||||
{
|
||||
return !unit->IsWithinLOSInMap(_caster);
|
||||
}
|
||||
@@ -1314,14 +1316,14 @@ class spell_sindragosa_mystic_buffet : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_sindragosa_mystic_buffet_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove_if(MysticBuffetTargetFilter(GetCaster()));
|
||||
targets.remove_if(MysticBuffetTargetFilter(GetCaster()));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_sindragosa_mystic_buffet_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_mystic_buffet_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1399,22 +1401,15 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end();)
|
||||
{
|
||||
if ((*itr)->GetTypeId() != TYPEID_PLAYER)
|
||||
unitList.erase(itr++);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
|
||||
if (unitList.empty())
|
||||
targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false));
|
||||
if (targets.empty())
|
||||
return;
|
||||
|
||||
Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList);
|
||||
unitList.clear();
|
||||
unitList.push_back(target);
|
||||
WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
}
|
||||
|
||||
void HandleForcedCast(SpellEffIndex effIndex)
|
||||
@@ -1435,7 +1430,7 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_order_whelp_SpellScript::HandleForcedCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_frostwarden_handler_order_whelp_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frostwarden_handler_order_whelp_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ class HeightDifferenceCheck
|
||||
{
|
||||
}
|
||||
|
||||
bool operator()(Unit* unit) const
|
||||
bool operator()(WorldObject* unit) const
|
||||
{
|
||||
return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse;
|
||||
}
|
||||
@@ -2288,7 +2288,7 @@ class spell_the_lich_king_shadow_trap_periodic : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_the_lich_king_shadow_trap_periodic_SpellScript);
|
||||
|
||||
void CheckTargetCount(std::list<Unit*>& targets)
|
||||
void CheckTargetCount(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (targets.empty())
|
||||
return;
|
||||
@@ -2298,7 +2298,7 @@ class spell_the_lich_king_shadow_trap_periodic : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2322,10 +2322,10 @@ class spell_the_lich_king_quake : public SpellScriptLoader
|
||||
return GetCaster()->GetInstanceScript() != NULL;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetData64(DATA_ARTHAS_PLATFORM)))
|
||||
unitList.remove_if(HeightDifferenceCheck(platform, 5.0f, false));
|
||||
targets.remove_if(HeightDifferenceCheck(platform, 5.0f, false));
|
||||
}
|
||||
|
||||
void HandleSendEvent(SpellEffIndex /*effIndex*/)
|
||||
@@ -2336,7 +2336,7 @@ class spell_the_lich_king_quake : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnEffectHit += SpellEffectFn(spell_the_lich_king_quake_SpellScript::HandleSendEvent, EFFECT_1, SPELL_EFFECT_SEND_EVENT);
|
||||
}
|
||||
};
|
||||
@@ -2363,7 +2363,7 @@ class spell_the_lich_king_ice_burst_target_search : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void CheckTargetCount(std::list<Unit*>& unitList)
|
||||
void CheckTargetCount(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
if (unitList.empty())
|
||||
return;
|
||||
@@ -2371,12 +2371,16 @@ class spell_the_lich_king_ice_burst_target_search : public SpellScriptLoader
|
||||
// if there is at least one affected target cast the explosion
|
||||
GetCaster()->CastSpell(GetCaster(), SPELL_ICE_BURST, true);
|
||||
if (GetCaster()->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
GetCaster()->ToCreature()->SetReactState(REACT_PASSIVE);
|
||||
GetCaster()->AttackStop();
|
||||
GetCaster()->ToCreature()->DespawnOrUnsummon(500);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_ice_burst_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_ice_burst_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2425,7 +2429,7 @@ class ExactDistanceCheck
|
||||
public:
|
||||
ExactDistanceCheck(Unit* source, float dist) : _source(source), _dist(dist) {}
|
||||
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(WorldObject* unit)
|
||||
{
|
||||
return _source->GetExactDist2d(unit) > _dist;
|
||||
}
|
||||
@@ -2444,7 +2448,7 @@ class spell_the_lich_king_defile : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_the_lich_king_defile_SpellScript);
|
||||
|
||||
void CorrectRange(std::list<Unit*>& targets)
|
||||
void CorrectRange(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if(ExactDistanceCheck(GetCaster(), 10.0f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X)));
|
||||
}
|
||||
@@ -2460,8 +2464,8 @@ class spell_the_lich_king_defile : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnHit += SpellHitFn(spell_the_lich_king_defile_SpellScript::ChangeDamageAndGrow);
|
||||
}
|
||||
};
|
||||
@@ -2563,26 +2567,26 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void SelectTarget(std::list<Unit*>& unitList)
|
||||
void SelectTarget(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (unitList.empty())
|
||||
if (targets.empty())
|
||||
return;
|
||||
|
||||
unitList.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id));
|
||||
if (unitList.empty())
|
||||
targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id));
|
||||
if (targets.empty())
|
||||
return;
|
||||
|
||||
_target = Trinity::Containers::SelectRandomContainerElement(unitList);
|
||||
unitList.clear();
|
||||
unitList.push_back(_target);
|
||||
_target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
targets.clear();
|
||||
targets.push_back(_target);
|
||||
GetCaster()->GetAI()->SetGUID(_target->GetGUID());
|
||||
}
|
||||
|
||||
void ReplaceTarget(std::list<Unit*>& unitList)
|
||||
void ReplaceTarget(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.clear();
|
||||
targets.clear();
|
||||
if (_target)
|
||||
unitList.push_back(_target);
|
||||
targets.push_back(_target);
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
@@ -2593,12 +2597,12 @@ class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_valkyr_target_search_SpellScript::ReplaceTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_valkyr_target_search_SpellScript::ReplaceTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_valkyr_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
|
||||
Unit* _target;
|
||||
WorldObject* _target;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
@@ -2775,7 +2779,7 @@ class spell_the_lich_king_vile_spirit_move_target_search : public SpellScriptLoa
|
||||
return GetCaster()->GetTypeId() == TYPEID_UNIT;
|
||||
}
|
||||
|
||||
void SelectTarget(std::list<Unit*>& targets)
|
||||
void SelectTarget(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (targets.empty())
|
||||
return;
|
||||
@@ -2796,11 +2800,11 @@ class spell_the_lich_king_vile_spirit_move_target_search : public SpellScriptLoa
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
|
||||
Unit* _target;
|
||||
WorldObject* _target;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
@@ -2823,7 +2827,7 @@ class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptL
|
||||
return GetCaster()->GetTypeId() == TYPEID_UNIT;
|
||||
}
|
||||
|
||||
void CheckTargetCount(std::list<Unit*>& targets)
|
||||
void CheckTargetCount(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (targets.empty())
|
||||
return;
|
||||
@@ -2840,7 +2844,7 @@ class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptL
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
|
||||
Unit* _target;
|
||||
|
||||
@@ -1187,13 +1187,13 @@ class spell_dreamwalker_summoner : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& targets)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if (Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED));
|
||||
if (targets.empty())
|
||||
return;
|
||||
|
||||
Unit* target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
}
|
||||
@@ -1209,7 +1209,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_dreamwalker_summoner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dreamwalker_summoner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summoner_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1834,15 +1834,15 @@ class DeathPlagueTargetSelector
|
||||
public:
|
||||
explicit DeathPlagueTargetSelector(Unit* caster) : _caster(caster) {}
|
||||
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
if (unit == _caster)
|
||||
if (object == _caster)
|
||||
return true;
|
||||
|
||||
if (unit->GetTypeId() != TYPEID_PLAYER)
|
||||
if (object->GetTypeId() != TYPEID_PLAYER)
|
||||
return true;
|
||||
|
||||
if (unit->HasAura(SPELL_RECENTLY_INFECTED) || unit->HasAura(SPELL_DEATH_PLAGUE_AURA))
|
||||
if (object->ToUnit()->HasAura(SPELL_RECENTLY_INFECTED) || object->ToUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1868,25 +1868,25 @@ class spell_frost_giant_death_plague : public SpellScriptLoader
|
||||
}
|
||||
|
||||
// First effect
|
||||
void CountTargets(std::list<Unit*>& unitList)
|
||||
void CountTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove(GetCaster());
|
||||
_failed = unitList.empty();
|
||||
targets.remove(GetCaster());
|
||||
_failed = targets.empty();
|
||||
}
|
||||
|
||||
// Second effect
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
// Select valid targets for jump
|
||||
unitList.remove_if (DeathPlagueTargetSelector(GetCaster()));
|
||||
if (!unitList.empty())
|
||||
targets.remove_if(DeathPlagueTargetSelector(GetCaster()));
|
||||
if (!targets.empty())
|
||||
{
|
||||
Unit* target = Trinity::Containers::SelectRandomContainerElement(unitList);
|
||||
unitList.clear();
|
||||
unitList.push_back(target);
|
||||
WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
}
|
||||
|
||||
unitList.push_back(GetCaster());
|
||||
targets.push_back(GetCaster());
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
@@ -1900,8 +1900,8 @@ class spell_frost_giant_death_plague : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_frost_giant_death_plague_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_frost_giant_death_plague_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frost_giant_death_plague_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frost_giant_death_plague_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_frost_giant_death_plague_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
|
||||
@@ -1950,9 +1950,11 @@ class spell_icc_harvest_blight_specimen : public SpellScriptLoader
|
||||
class AliveCheck
|
||||
{
|
||||
public:
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
return unit->isAlive();
|
||||
if (Unit* unit = object->ToUnit())
|
||||
return unit->isAlive();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1965,10 +1967,10 @@ class spell_svalna_revive_champion : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_svalna_revive_champion_SpellScript);
|
||||
|
||||
void RemoveAliveTarget(std::list<Unit*>& unitList)
|
||||
void RemoveAliveTarget(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove_if(AliveCheck());
|
||||
Trinity::Containers::RandomResizeList(unitList, 2);
|
||||
targets.remove_if(AliveCheck());
|
||||
Trinity::Containers::RandomResizeList(targets, 2);
|
||||
}
|
||||
|
||||
void Land(SpellEffIndex /*effIndex*/)
|
||||
@@ -1988,7 +1990,7 @@ class spell_svalna_revive_champion : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_svalna_revive_champion_SpellScript::RemoveAliveTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_svalna_revive_champion_SpellScript::RemoveAliveTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY);
|
||||
OnEffectHit += SpellEffectFn(spell_svalna_revive_champion_SpellScript::Land, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_varos_energize_core_area_enemySpellScript)
|
||||
|
||||
void FilterTargets(std::list<Unit*>& targetList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
Creature* varos = GetCaster()->ToCreature();
|
||||
if (!varos)
|
||||
@@ -308,7 +308,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
|
||||
|
||||
float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation();
|
||||
|
||||
for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end();)
|
||||
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
|
||||
{
|
||||
Position pos;
|
||||
(*itr)->GetPosition(&pos);
|
||||
@@ -317,7 +317,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
|
||||
float diff = fabs(orientation - angle);
|
||||
|
||||
if (diff > 1.0f)
|
||||
itr = targetList.erase(itr);
|
||||
itr = targets.erase(itr);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
@@ -325,7 +325,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_varos_energize_core_area_enemySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_varos_energize_core_area_enemySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -344,7 +344,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_varos_energize_core_area_entrySpellScript)
|
||||
|
||||
void FilterTargets(std::list<Unit*>& targetList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
Creature* varos = GetCaster()->ToCreature();
|
||||
if (!varos)
|
||||
@@ -355,7 +355,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
|
||||
|
||||
float orientation = CAST_AI(boss_varos::boss_varosAI, varos->AI())->GetCoreEnergizeOrientation();
|
||||
|
||||
for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end();)
|
||||
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
|
||||
{
|
||||
Position pos;
|
||||
(*itr)->GetPosition(&pos);
|
||||
@@ -364,7 +364,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
|
||||
float diff = fabs(orientation - angle);
|
||||
|
||||
if (diff > 1.0f)
|
||||
itr = targetList.erase(itr);
|
||||
itr = targets.erase(itr);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
@@ -372,7 +372,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_varos_energize_core_area_entrySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_varos_energize_core_area_entrySpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
DoScriptText(SAY_KILL, me);
|
||||
}
|
||||
|
||||
void SpellHitTarget(Unit* target, const SpellInfo* pSpell)
|
||||
void SpellHitTarget(Unit* /*target*/, const SpellInfo* pSpell)
|
||||
{
|
||||
//this part should be in the core
|
||||
if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER)
|
||||
|
||||
@@ -1080,7 +1080,7 @@ class NotVictimFilter
|
||||
{
|
||||
}
|
||||
|
||||
bool operator()(Unit* target)
|
||||
bool operator()(WorldObject* target)
|
||||
{
|
||||
return target != _victim;
|
||||
}
|
||||
@@ -1098,14 +1098,14 @@ class spell_algalon_arcane_barrage : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_algalon_arcane_barrage_SpellScript);
|
||||
|
||||
void SelectTarget(std::list<Unit*>& targets)
|
||||
void SelectTarget(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if(NotVictimFilter(GetCaster()));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_arcane_barrage_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_arcane_barrage_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1118,9 +1118,9 @@ class spell_algalon_arcane_barrage : public SpellScriptLoader
|
||||
class ActiveConstellationFilter
|
||||
{
|
||||
public:
|
||||
bool operator()(Unit* target) const
|
||||
bool operator()(WorldObject* target) const
|
||||
{
|
||||
return target->GetAI()->GetData(0);
|
||||
return target->ToUnit() && target->ToUnit()->GetAI() && target->ToUnit()->GetAI()->GetData(0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1133,7 +1133,7 @@ class spell_algalon_trigger_3_adds : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_algalon_trigger_3_adds_SpellScript);
|
||||
|
||||
void SelectTarget(std::list<Unit*>& targets)
|
||||
void SelectTarget(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if(ActiveConstellationFilter());
|
||||
}
|
||||
@@ -1150,7 +1150,7 @@ class spell_algalon_trigger_3_adds : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_trigger_3_adds_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_trigger_3_adds_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1202,7 +1202,7 @@ class spell_algalon_big_bang : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void CountTargets(std::list<Unit*>& targets)
|
||||
void CountTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
_targetCount = targets.size();
|
||||
}
|
||||
@@ -1215,7 +1215,7 @@ class spell_algalon_big_bang : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_big_bang_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_big_bang_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
AfterCast += SpellCastFn(spell_algalon_big_bang_SpellScript::CheckTargets);
|
||||
}
|
||||
|
||||
|
||||
@@ -472,9 +472,9 @@ class npc_feral_defender : public CreatureScript
|
||||
class SanctumSentryCheck
|
||||
{
|
||||
public:
|
||||
bool operator() (Unit* unit)
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
if (unit->GetEntry() == NPC_SANCTUM_SENTRY)
|
||||
if (object->GetEntry() == NPC_SANCTUM_SENTRY)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -490,14 +490,14 @@ class spell_auriaya_strenght_of_the_pack : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_auriaya_strenght_of_the_pack_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList.remove_if (SanctumSentryCheck());
|
||||
unitList.remove_if(SanctumSentryCheck());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_auriaya_strenght_of_the_pack_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_strenght_of_the_pack_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -516,15 +516,15 @@ class spell_auriaya_sentinel_blast : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_auriaya_sentinel_blast_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList.remove_if (PlayerOrPetCheck());
|
||||
unitList.remove_if(PlayerOrPetCheck());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auriaya_sentinel_blast_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1617,7 +1617,7 @@ class FlameLeviathanPursuedTargetSelector
|
||||
public:
|
||||
explicit FlameLeviathanPursuedTargetSelector(Unit* unit) : _me(unit) {};
|
||||
|
||||
bool operator()(Unit* target) const
|
||||
bool operator()(WorldObject* target) const
|
||||
{
|
||||
//! No players, only vehicles (todo: check if blizzlike)
|
||||
Creature* creatureTarget = target->ToCreature();
|
||||
@@ -1665,7 +1665,7 @@ class spell_pursue : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& targets)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if(FlameLeviathanPursuedTargetSelector(GetCaster()));
|
||||
if (targets.empty())
|
||||
@@ -1681,7 +1681,7 @@ class spell_pursue : public SpellScriptLoader
|
||||
}
|
||||
}
|
||||
|
||||
void FilterTargetsSubsequently(std::list<Unit*>& targets)
|
||||
void FilterTargetsSubsequently(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.clear();
|
||||
if (_target)
|
||||
@@ -1708,12 +1708,12 @@ class spell_pursue : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_pursue_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_pursue_SpellScript::FilterTargetsSubsequently, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pursue_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pursue_SpellScript::FilterTargetsSubsequently, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pursue_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
||||
}
|
||||
|
||||
Unit* _target;
|
||||
WorldObject* _target;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
|
||||
@@ -354,7 +354,7 @@ class StoneGripTargetSelector : public std::unary_function<Unit*, bool>
|
||||
public:
|
||||
StoneGripTargetSelector(Creature* me, Unit const* victim) : _me(me), _victim(victim) {}
|
||||
|
||||
bool operator() (Unit* target)
|
||||
bool operator()(WorldObject* target)
|
||||
{
|
||||
if (target == _victim && _me->getThreatManager().getThreatList().size() > 1)
|
||||
return true;
|
||||
@@ -385,10 +385,10 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargetsInitial(std::list<Unit*>& unitList)
|
||||
void FilterTargetsInitial(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
// Remove "main tank" and non-player targets
|
||||
unitList.remove_if (StoneGripTargetSelector(GetCaster()->ToCreature(), GetCaster()->getVictim()));
|
||||
unitList.remove_if(StoneGripTargetSelector(GetCaster()->ToCreature(), GetCaster()->getVictim()));
|
||||
// Maximum affected targets per difficulty mode
|
||||
uint32 maxTargets = 1;
|
||||
if (GetSpellInfo()->Id == 63981)
|
||||
@@ -397,7 +397,7 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader
|
||||
// Return a random amount of targets based on maxTargets
|
||||
while (maxTargets < unitList.size())
|
||||
{
|
||||
std::list<Unit*>::iterator itr = unitList.begin();
|
||||
std::list<WorldObject*>::iterator itr = unitList.begin();
|
||||
advance(itr, urand(0, unitList.size()-1));
|
||||
unitList.erase(itr);
|
||||
}
|
||||
@@ -406,20 +406,20 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader
|
||||
m_unitList = unitList;
|
||||
}
|
||||
|
||||
void FillTargetsSubsequential(std::list<Unit*>& unitList)
|
||||
void FillTargetsSubsequential(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList = m_unitList;
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_ulduar_stone_grip_cast_target_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
|
||||
// Shared between effects
|
||||
std::list<Unit*> m_unitList;
|
||||
std::list<WorldObject*> m_unitList;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
@@ -598,14 +598,14 @@ class spell_kologarn_stone_shout : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_kologarn_stone_shout_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList.remove_if (PlayerOrPetCheck());
|
||||
unitList.remove_if(PlayerOrPetCheck());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_kologarn_stone_shout_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kologarn_stone_shout_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -950,9 +950,9 @@ class spell_xt002_tympanic_tantrum : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_xt002_tympanic_tantrum_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove_if(PlayerOrPetCheck());
|
||||
targets.remove_if(PlayerOrPetCheck());
|
||||
}
|
||||
|
||||
void RecalculateDamage()
|
||||
@@ -962,8 +962,8 @@ class spell_xt002_tympanic_tantrum : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_xt002_tympanic_tantrum_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnHit += SpellHitFn(spell_xt002_tympanic_tantrum_SpellScript::RecalculateDamage);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -268,10 +268,10 @@ GameObjectAI* GetUlduarAI(GameObject* go)
|
||||
class PlayerOrPetCheck
|
||||
{
|
||||
public:
|
||||
bool operator() (Unit* unit)
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
if (unit->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!unit->ToCreature()->isPet())
|
||||
if (object->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!object->ToCreature()->isPet())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -522,12 +522,12 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
class checkRitualTarget
|
||||
class RitualTargetCheck
|
||||
{
|
||||
public:
|
||||
explicit checkRitualTarget(Unit* _caster) : caster(_caster) { }
|
||||
explicit RitualTargetCheck(Unit* _caster) : caster(_caster) { }
|
||||
|
||||
bool operator() (Unit* unit)
|
||||
bool operator() (WorldObject* unit) const
|
||||
{
|
||||
if (InstanceScript* instance = caster->GetInstanceScript())
|
||||
if (instance->GetData64(DATA_SACRIFICED_PLAYER) == unit->GetGUID())
|
||||
@@ -549,14 +549,14 @@ class spell_paralyze_pinnacle : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_paralyze_pinnacle_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList.remove_if(checkRitualTarget(GetCaster()));
|
||||
unitList.remove_if(RitualTargetCheck(GetCaster()));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_paralyze_pinnacle_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_paralyze_pinnacle_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -518,7 +518,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void CountTargets(std::list<Unit*>& targetList)
|
||||
void CountTargets(std::list<WorldObject*>& targetList)
|
||||
{
|
||||
_targetCount = targetList.size();
|
||||
}
|
||||
@@ -549,7 +549,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -52,10 +52,10 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleTargets(std::list<Unit*>& targetList)
|
||||
void HandleTargets(std::list<WorldObject*>& targetList)
|
||||
{
|
||||
uint8 count = 0;
|
||||
for (std::list<Unit*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
|
||||
for (std::list<WorldObject*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
|
||||
if ((*ihit)->GetGUID() != GetCaster()->GetGUID())
|
||||
if (Player* target = (*ihit)->ToPlayer())
|
||||
if (target->HasAura(GetTriggeringSpell()->Id))
|
||||
@@ -88,7 +88,7 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_capacitus_polarity_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_capacitus_polarity_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_capacitus_polarity_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
|
||||
{
|
||||
if (Unit* owner = GetUnitOwner())
|
||||
amount = CalculatePctU(owner->GetPower(POWER_MANA), 5);
|
||||
|
||||
@@ -349,16 +349,15 @@ class spell_dk_death_pact : public SpellScriptLoader
|
||||
return SPELL_FAILED_NO_PET;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
Unit* unit_to_add = NULL;
|
||||
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
|
||||
for (std::list<WorldObject*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->GetTypeId() == TYPEID_UNIT
|
||||
&& (*itr)->GetOwnerGUID() == GetCaster()->GetGUID()
|
||||
&& (*itr)->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_UNDEAD)
|
||||
if (Unit* unit = (*itr)->ToUnit())
|
||||
if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD)
|
||||
{
|
||||
unit_to_add = (*itr);
|
||||
unit_to_add = unit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -371,7 +370,7 @@ class spell_dk_death_pact : public SpellScriptLoader
|
||||
void Register()
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_dk_death_pact_SpellScript::CheckCast);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_dk_death_pact_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dk_death_pact_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -232,37 +232,37 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (!GetCaster()->ToPlayer()->GetGroup())
|
||||
{
|
||||
unitList.clear();
|
||||
unitList.push_back(GetCaster());
|
||||
targets.clear();
|
||||
targets.push_back(GetCaster());
|
||||
}
|
||||
else
|
||||
{
|
||||
unitList.remove(GetExplTargetUnit());
|
||||
targets.remove(GetExplTargetUnit());
|
||||
std::list<Unit*> tempTargets;
|
||||
for (std::list<Unit*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
|
||||
if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith(*itr))
|
||||
tempTargets.push_back(*itr);
|
||||
for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
|
||||
if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith((*itr)->ToUnit()))
|
||||
tempTargets.push_back((*itr)->ToUnit());
|
||||
|
||||
if (tempTargets.empty())
|
||||
{
|
||||
unitList.clear();
|
||||
targets.clear();
|
||||
FinishCast(SPELL_FAILED_DONT_REPORT);
|
||||
return;
|
||||
}
|
||||
|
||||
Unit* target = Trinity::Containers::SelectRandomContainerElement(tempTargets);
|
||||
unitList.clear();
|
||||
unitList.push_back(target);
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_t10_restoration_4p_bonus_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_t10_restoration_4p_bonus_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -281,14 +281,14 @@ class spell_dru_starfall_aoe : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_dru_starfall_aoe_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove(GetExplTargetUnit());
|
||||
targets.remove(GetExplTargetUnit());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_starfall_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_starfall_aoe_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -341,9 +341,9 @@ class spell_dru_starfall_dummy : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_dru_starfall_dummy_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
Trinity::Containers::RandomResizeList(unitList, 2);
|
||||
Trinity::Containers::RandomResizeList(targets, 2);
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
@@ -366,7 +366,7 @@ class spell_dru_starfall_dummy : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_dru_starfall_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_starfall_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dru_starfall_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -409,7 +409,7 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void CountTargets(std::list<Unit*>& targetList)
|
||||
void CountTargets(std::list<WorldObject*>& targetList)
|
||||
{
|
||||
_targetCount = targetList.size();
|
||||
}
|
||||
@@ -428,7 +428,7 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pal_divine_storm_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -132,14 +132,14 @@ class spell_pri_mind_sear : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_pri_mind_sear_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList.remove_if (Trinity::ObjectGUIDCheck(GetCaster()->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)));
|
||||
unitList.remove_if(Trinity::ObjectGUIDCheck(GetCaster()->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)));
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_pri_mind_sear_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_mind_sear_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -302,15 +302,15 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_warl_seed_of_corruption_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (GetExplTargetUnit())
|
||||
unitList.remove(GetExplTargetUnit());
|
||||
targets.remove(GetExplTargetUnit());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_warr_improved_spell_reflection_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
if (GetCaster())
|
||||
unitList.remove(GetCaster());
|
||||
@@ -85,7 +85,7 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_warr_improved_spell_reflection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_improved_spell_reflection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -224,9 +224,9 @@ class DreamFogTargetSelector
|
||||
public:
|
||||
DreamFogTargetSelector() { }
|
||||
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
return unit->HasAura(SPELL_SLEEP);
|
||||
return object->ToUnit() && object->ToUnit()->HasAura(SPELL_SLEEP);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -239,14 +239,14 @@ class spell_dream_fog_sleep : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_dream_fog_sleep_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& unitList)
|
||||
{
|
||||
unitList.remove_if (DreamFogTargetSelector());
|
||||
unitList.remove_if(DreamFogTargetSelector());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_dream_fog_sleep_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dream_fog_sleep_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -265,10 +265,12 @@ class MarkOfNatureTargetSelector
|
||||
public:
|
||||
MarkOfNatureTargetSelector() { }
|
||||
|
||||
bool operator()(Unit* unit)
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
// return anyone that isn't tagged or already under the influence of Aura of Nature
|
||||
return !(unit->HasAura(SPELL_MARK_OF_NATURE) && !unit->HasAura(SPELL_AURA_OF_NATURE));
|
||||
if (Unit* unit = object->ToUnit())
|
||||
// return anyone that isn't tagged or already under the influence of Aura of Nature
|
||||
return !(unit->HasAura(SPELL_MARK_OF_NATURE) && !unit->HasAura(SPELL_AURA_OF_NATURE));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -290,9 +292,9 @@ class spell_mark_of_nature : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
unitList.remove_if (MarkOfNatureTargetSelector());
|
||||
targets.remove_if(MarkOfNatureTargetSelector());
|
||||
}
|
||||
|
||||
void HandleEffect(SpellEffIndex effIndex)
|
||||
@@ -305,7 +307,7 @@ class spell_mark_of_nature : public SpellScriptLoader
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnUnitTargetSelect += SpellUnitTargetFn(spell_mark_of_nature_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_nature_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_mark_of_nature_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -185,8 +185,7 @@ class ByteBuffer
|
||||
|
||||
ByteBuffer &operator<<(const char *str)
|
||||
{
|
||||
size_t len = 0;
|
||||
if (str && (len = strlen(str)))
|
||||
if (size_t len = (str ? strlen(str) : 0))
|
||||
append((uint8 const*)str, len);
|
||||
append((uint8)0);
|
||||
return *this;
|
||||
|
||||
Reference in New Issue
Block a user