fix(spell): paladin and dk aggro spell, warrior

This commit is contained in:
Yunfan Li
2023-06-11 15:55:36 +08:00
parent b11fad1a46
commit 33576bd969
21 changed files with 117 additions and 62 deletions

View File

@@ -16,28 +16,42 @@ bool HasAggroValue::Calculate()
if (!target)
return true;
HostileReference *ref = bot->getHostileRefMgr().getFirst();
if (!ref)
return true; // simulate as target is not atacking anybody yet
Unit* victim = target->GetVictim();
while( ref )
{
ThreatMgr *threatManager = ref->GetSource();
Unit *attacker = threatManager->GetOwner();
if (attacker != target) {
ref = ref->next();
continue;
}
Unit *victim = attacker->GetVictim();
if (!victim) {
return true;
}
if ((victim == bot || (victim && victim->ToPlayer() && botAI->IsMainTank(victim->ToPlayer()))) && target == attacker)
return true;
ref = ref->next();
if (!victim) {
return true;
}
if (victim->GetGUID() == bot->GetGUID() || (victim->ToPlayer() && botAI->IsMainTank(victim->ToPlayer()))) {
return true;
}
botAI->TellMaster("target: " + target->GetName() + " victim: " + victim->GetName());
if (victim->ToPlayer() ) {
botAI->TellMaster("victim is mt: " + std::to_string(botAI->IsMainTank(victim->ToPlayer())));
}
return false;
// HostileReference *ref = bot->getHostileRefMgr().getFirst();
// if (!ref)
// return true; // simulate as target is not atacking anybody yet
// while( ref )
// {
// ThreatMgr *threatManager = ref->GetSource();
// Unit *attacker = threatManager->GetOwner();
// if (attacker->GetGUID() != target->GetGUID()) {
// ref = ref->next();
// continue;
// }
// Unit *victim = attacker->GetVictim();
// if (!victim) {
// return true;
// }
// if ((victim->GetGUID() == bot->GetGUID() || (victim && victim->ToPlayer() && botAI->IsMainTank(victim->ToPlayer()))) &&
// target->GetGUID() == attacker->GetGUID())
// return true;
// ref = ref->next();
// }
// Unit* target = GetTarget();
// if (!target)
// return true;

View File

@@ -33,16 +33,13 @@ Unit* PartyMemberValue::FindPartyMember(FindPlayerPredicate& predicate, bool ign
{
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
if (ref->GetSource() != bot)
if (ref->getSubGroup() != bot->GetSubGroup())
{
if (ref->getSubGroup() != bot->GetSubGroup())
{
nearestGroupPlayers.push_back(ref->GetSource()->GetGUID());
}
else
{
nearestGroupPlayers.push_front(ref->GetSource()->GetGUID());
}
nearestGroupPlayers.push_back(ref->GetSource()->GetGUID());
}
else
{
nearestGroupPlayers.push_front(ref->GetSource()->GetGUID());
}
}
} else {
@@ -69,7 +66,7 @@ Unit* PartyMemberValue::FindPartyMember(FindPlayerPredicate& predicate, bool ign
for (ObjectGuid const guid : nearestPlayers)
{
Player* player = botAI->GetPlayer(guid);
if (!player || player == bot)
if (!player)
continue;
if (botAI->IsHeal(player))
@@ -115,7 +112,7 @@ bool PartyMemberValue::IsTargetOfSpellCast(Player* target, SpellEntryPredicate &
for (ObjectGuid const guid : nearestPlayers)
{
Player* player = botAI->GetPlayer(guid);
if (!player || player == bot)
if (!player)
continue;
if (player->IsNonMeleeSpellCast(true))