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:
Treeston
2017-07-21 22:59:59 +02:00
parent 1f63554312
commit 331e463de8
3 changed files with 34 additions and 27 deletions

View File

@@ -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);