Pet attack (fix shadowfiend)

This commit is contained in:
Yunfan Li
2024-02-08 00:36:16 +08:00
parent 5e2497bf7e
commit 9e78a0b36a
11 changed files with 95 additions and 22 deletions

View File

@@ -4,6 +4,7 @@
#include "GenericTriggers.h"
#include "BattlegroundWS.h"
#include "CreatureAI.h"
#include "ObjectGuid.h"
#include "Playerbots.h"
#include "SharedDefines.h"
@@ -34,6 +35,25 @@ bool HasPetTrigger::IsActive() {
return (AI_VALUE(Unit*, "pet target")) && !AI_VALUE2(bool, "mounted", "self target");;
}
bool PetAttackTrigger::IsActive()
{
Guardian* pet = bot->GetGuardianPet();
if (!pet) {
return false;
}
Unit* target = AI_VALUE(Unit*, "current target");
if (!target) {
return false;
}
if (pet->GetVictim() == target && pet->GetCharmInfo()->IsCommandAttack()) {
return false;
}
if (bot->GetMap()->IsDungeon() && bot->GetGroup() && !target->IsInCombat()) {
return false;
}
return true;
}
bool HighManaTrigger::IsActive()
{
return AI_VALUE2(bool, "has mana", "self target") && AI_VALUE2(uint8, "mana", "self target") < 65;