fix(Core/Creature): Creatures should skip confused targets (#21410)
This commit is contained in:
@@ -328,7 +328,7 @@ HostileReference* ThreatContainer::SelectNextVictim(Creature* attacker, HostileR
|
|||||||
Unit* cvUnit = currentVictim->getTarget();
|
Unit* cvUnit = currentVictim->getTarget();
|
||||||
if (!attacker->CanCreatureAttack(cvUnit)) // pussywizard: if currentVictim is not valid => don't compare the threat with it, just take the highest threat valid target
|
if (!attacker->CanCreatureAttack(cvUnit)) // pussywizard: if currentVictim is not valid => don't compare the threat with it, just take the highest threat valid target
|
||||||
currentVictim = nullptr;
|
currentVictim = nullptr;
|
||||||
else if (cvUnit->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || cvUnit->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) // pussywizard: no 10%/30% if currentVictim is immune to damage or has auras breakable by damage
|
else if (cvUnit->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || cvUnit->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE) || cvUnit->HasUnitState(UNIT_STATE_CONFUSED)) // pussywizard: no 10%/30% if currentVictim is immune to damage or has auras breakable by damage
|
||||||
currentVictim = nullptr;
|
currentVictim = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,7 +345,7 @@ HostileReference* ThreatContainer::SelectNextVictim(Creature* attacker, HostileR
|
|||||||
|
|
||||||
// pussywizard: don't go to threat comparison if this ref is immune to damage or has aura breakable on damage (second choice target)
|
// pussywizard: don't go to threat comparison if this ref is immune to damage or has aura breakable on damage (second choice target)
|
||||||
// pussywizard: if this is the last entry on the threat list, then all targets are second choice, set bool to true and loop threat list again, ignoring this section
|
// pussywizard: if this is the last entry on the threat list, then all targets are second choice, set bool to true and loop threat list again, ignoring this section
|
||||||
if (!noPriorityTargetFound && (target->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE) || target->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, attacker->GetGUID())))
|
if (!noPriorityTargetFound && (target->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE) || target->HasUnitState(UNIT_STATE_CONFUSED) || target->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, attacker->GetGUID())))
|
||||||
{
|
{
|
||||||
if (iter != lastRef)
|
if (iter != lastRef)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-19
@@ -110,25 +110,7 @@ public:
|
|||||||
|
|
||||||
bool CanAIAttack(Unit const* target) const override
|
bool CanAIAttack(Unit const* target) const override
|
||||||
{
|
{
|
||||||
if (target->IsCreature() && !secondPhase)
|
return !(target->IsCreature() && !secondPhase);
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (me->GetThreatMgr().GetThreatListSize() > 1)
|
|
||||||
{
|
|
||||||
ThreatContainer::StorageType::const_iterator lastRef = me->GetThreatMgr().GetOnlineContainer().GetThreatList().end();
|
|
||||||
--lastRef;
|
|
||||||
if (Unit* lastTarget = (*lastRef)->getTarget())
|
|
||||||
{
|
|
||||||
if (lastTarget != target)
|
|
||||||
{
|
|
||||||
return !target->HasAura(SPELL_CONFLAGRATION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
|
|||||||
@@ -153,24 +153,6 @@ struct boss_jindo : public BossAI
|
|||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanAIAttack(Unit const* target) const override
|
|
||||||
{
|
|
||||||
if (me->GetThreatMgr().GetThreatListSize() > 1)
|
|
||||||
{
|
|
||||||
ThreatContainer::StorageType::const_iterator lastRef = me->GetThreatMgr().GetOnlineContainer().GetThreatList().end();
|
|
||||||
--lastRef;
|
|
||||||
if (Unit* lastTarget = (*lastRef)->getTarget())
|
|
||||||
{
|
|
||||||
if (lastTarget != target)
|
|
||||||
{
|
|
||||||
return !target->HasAura(SPELL_HEX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TaskScheduler _scheduler;
|
TaskScheduler _scheduler;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -51,24 +51,6 @@ struct boss_nethermancer_sepethrea : public BossAI
|
|||||||
{
|
{
|
||||||
boss_nethermancer_sepethrea(Creature* creature) : BossAI(creature, DATA_NETHERMANCER_SEPRETHREA) { }
|
boss_nethermancer_sepethrea(Creature* creature) : BossAI(creature, DATA_NETHERMANCER_SEPRETHREA) { }
|
||||||
|
|
||||||
bool CanAIAttack(Unit const* target) const override
|
|
||||||
{
|
|
||||||
if (me->GetThreatMgr().GetThreatListSize() > 1)
|
|
||||||
{
|
|
||||||
ThreatContainer::StorageType::const_iterator lastRef = me->GetThreatMgr().GetOnlineContainer().GetThreatList().end();
|
|
||||||
--lastRef;
|
|
||||||
if (Unit* lastTarget = (*lastRef)->getTarget())
|
|
||||||
{
|
|
||||||
if (lastTarget != target)
|
|
||||||
{
|
|
||||||
return !target->HasAura(SPELL_DRAGONS_BREATH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
{
|
{
|
||||||
_JustEngagedWith();
|
_JustEngagedWith();
|
||||||
|
|||||||
Reference in New Issue
Block a user