fix(Scripts/Ulduar): Kologarn no longer grips the main tank (#26259)
This commit is contained in:
@@ -702,28 +702,6 @@ struct boss_kologarn_pit_kill_bunny : public NullCreatureAI
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// predicate function to select non main tank target
|
|
||||||
class StoneGripTargetSelector
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StoneGripTargetSelector(Creature* me, Unit const* victim) : _me(me), _victim(victim) {}
|
|
||||||
|
|
||||||
bool operator() (WorldObject* target) const
|
|
||||||
{
|
|
||||||
if (target == _victim && _me->GetThreatMgr().GetThreatListSize() > 1)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (!target->IsPlayer())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Creature* _me;
|
|
||||||
Unit const* _victim;
|
|
||||||
};
|
|
||||||
|
|
||||||
class spell_ulduar_stone_grip_cast_target : public SpellScript
|
class spell_ulduar_stone_grip_cast_target : public SpellScript
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_ulduar_stone_grip_cast_target);
|
PrepareSpellScript(spell_ulduar_stone_grip_cast_target);
|
||||||
@@ -735,18 +713,12 @@ class spell_ulduar_stone_grip_cast_target : public SpellScript
|
|||||||
|
|
||||||
void FilterTargetsInitial(std::list<WorldObject*>& targets)
|
void FilterTargetsInitial(std::list<WorldObject*>& targets)
|
||||||
{
|
{
|
||||||
// Remove "main tank" and non-player targets
|
if (Unit* victim = GetCaster()->GetVictim())
|
||||||
targets.remove_if(StoneGripTargetSelector(GetCaster()->ToCreature(), GetCaster()->GetVictim()));
|
targets.remove_if(Acore::ObjectGUIDCheck(victim->GetGUID(), true));
|
||||||
// Maximum affected targets per difficulty mode
|
|
||||||
uint32 maxTargets = GetSpellInfo()->Id == SPELL_STONE_GRIP ? 1 : 3;
|
|
||||||
|
|
||||||
// Return a random amount of targets based on maxTargets
|
targets.remove_if(Acore::ObjectTypeIdCheck(TYPEID_PLAYER, false));
|
||||||
while (maxTargets < targets.size())
|
|
||||||
{
|
Acore::Containers::RandomResize(targets, GetSpellInfo()->Id == SPELL_STONE_GRIP ? 1 : 3);
|
||||||
std::list<WorldObject*>::iterator itr = targets.begin();
|
|
||||||
advance(itr, urand(0, targets.size() - 1));
|
|
||||||
targets.erase(itr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Register() override
|
void Register() override
|
||||||
|
|||||||
Reference in New Issue
Block a user