mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/PlayerAI: Some adjustments:
- Add a 2 second delay before the AI begins using spells. This should provide opportunity for counterplay before that rogue activates cloak and goes on an unstoppable rampage among your healers. (Sorry, guys.) - Stopped the AI from attacking invalid targets under some conditions. It should now properly leash back and follow the charmer if we try to select an invalid target. - Stopped the AI from constantly re-creating the follow movement generator (and thus spamming movesplines).
This commit is contained in:
@@ -57,26 +57,6 @@ enum Events
|
||||
class BlackheartCharmedPlayerAI : public SimpleCharmedPlayerAI
|
||||
{
|
||||
using SimpleCharmedPlayerAI::SimpleCharmedPlayerAI;
|
||||
Unit* SelectAttackTarget() const override
|
||||
{
|
||||
if (Unit* charmer = me->GetCharmer())
|
||||
{
|
||||
std::list<Player*> targets;
|
||||
for (ThreatReference const* ref : charmer->GetThreatManager().GetUnsortedThreatList())
|
||||
{
|
||||
if (Player* victim = ref->GetVictim()->ToPlayer())
|
||||
if (me->IsValidAttackTarget(victim))
|
||||
targets.push_back(victim);
|
||||
}
|
||||
if (targets.empty())
|
||||
return nullptr;
|
||||
|
||||
auto it = targets.begin();
|
||||
std::advance(it, urand(0, targets.size() - 1));
|
||||
return *it;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
void OnCharmed(bool apply) override
|
||||
{
|
||||
SimpleCharmedPlayerAI::OnCharmed(apply);
|
||||
|
||||
Reference in New Issue
Block a user