fix(Core/Unit): restore immediate combat engagement for non-controllable guardians (#26654)
This commit is contained in:
@@ -7425,15 +7425,17 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
|
|||||||
else if (victim->IsCreature())
|
else if (victim->IsCreature())
|
||||||
victim->ToCreature()->UpdateLeashExtensionTime();
|
victim->ToCreature()->UpdateLeashExtensionTime();
|
||||||
|
|
||||||
// set position before any AI calls/assistance
|
// Player-controlled creatures (pets, charms) enter combat on contact instead
|
||||||
//if (IsCreature())
|
// (melee swing execution or spell launch/hit, see Unit::AtTargetAttacked).
|
||||||
// ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
// Non-controllable guardians (e.g. Shaman Elementals, Infernal) have no attack
|
||||||
// player-controlled creatures (pets, charms) enter combat on contact instead
|
// command and must engage immediately so their AI can chase and attack.
|
||||||
// (melee swing execution or spell launch/hit, see Unit::AtTargetAttacked)
|
|
||||||
if (creature && !IsControlledByPlayer())
|
if (creature && (!IsControlledByPlayer() || (IsGuardian() && !IsControllableGuardian())))
|
||||||
{
|
{
|
||||||
EngageWithTarget(victim);
|
EngageWithTarget(victim);
|
||||||
|
|
||||||
|
if (!IsControlledByPlayer())
|
||||||
|
{
|
||||||
creature->SendAIReaction(AI_REACTION_HOSTILE);
|
creature->SendAIReaction(AI_REACTION_HOSTILE);
|
||||||
|
|
||||||
/// @todo: Implement aggro range, detection range and assistance range templates
|
/// @todo: Implement aggro range, detection range and assistance range templates
|
||||||
@@ -7444,6 +7446,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
|
|||||||
|
|
||||||
SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
|
SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// delay offhand weapon attack by 50% of the base attack time
|
// delay offhand weapon attack by 50% of the base attack time
|
||||||
if (HasOffhandWeaponForAttack() && isAttackReady(OFF_ATTACK))
|
if (HasOffhandWeaponForAttack() && isAttackReady(OFF_ATTACK))
|
||||||
|
|||||||
Reference in New Issue
Block a user