Scripts/Spells: Fixed crash in Druid T10 4P Restoration set bonus
Closes #1399 Closes #1507
This commit is contained in:
@@ -224,19 +224,38 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader
|
|||||||
{
|
{
|
||||||
PrepareSpellScript(spell_dru_t10_restoration_4p_bonus_SpellScript);
|
PrepareSpellScript(spell_dru_t10_restoration_4p_bonus_SpellScript);
|
||||||
|
|
||||||
|
bool Load()
|
||||||
|
{
|
||||||
|
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
void FilterTargets(std::list<Unit*>& unitList)
|
void FilterTargets(std::list<Unit*>& unitList)
|
||||||
{
|
{
|
||||||
unitList.remove(GetTargetUnit());
|
if (!GetCaster()->ToPlayer()->GetGroup())
|
||||||
std::list<Unit*> tempTargets;
|
{
|
||||||
std::list<Unit*>::iterator end = unitList.end(), itr = unitList.begin();
|
unitList.clear();
|
||||||
for (; itr != end; ++itr)
|
unitList.push_back(GetCaster());
|
||||||
if (GetCaster()->IsInRaidWith(*itr))
|
}
|
||||||
tempTargets.push_back(*itr);
|
else
|
||||||
|
{
|
||||||
|
unitList.remove(GetTargetUnit());
|
||||||
|
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);
|
||||||
|
|
||||||
itr = tempTargets.begin();
|
if (tempTargets.empty())
|
||||||
std::advance(itr, urand(0, tempTargets.size()-1));
|
{
|
||||||
unitList.clear();
|
unitList.clear();
|
||||||
unitList.push_back(*itr);
|
FinishCast(SPELL_FAILED_DONT_REPORT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list<Unit*>::const_iterator it2 = tempTargets.begin();
|
||||||
|
std::advance(it2, urand(0, tempTargets.size() - 1));
|
||||||
|
unitList.clear();
|
||||||
|
unitList.push_back(*it2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Register()
|
void Register()
|
||||||
|
|||||||
Reference in New Issue
Block a user