fix(Core/Unit): start pet combat on contact instead of on attack command (#26463)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: sogladev <sogladev@gmail.com>
This commit is contained in:
@@ -7425,12 +7425,12 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
|
|||||||
// set position before any AI calls/assistance
|
// set position before any AI calls/assistance
|
||||||
//if (IsCreature())
|
//if (IsCreature())
|
||||||
// ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
// ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
||||||
if (creature)
|
// player-controlled creatures (pets, charms) enter combat on contact instead
|
||||||
|
// (melee swing execution or spell launch/hit, see Unit::AtTargetAttacked)
|
||||||
|
if (creature && !IsControlledByPlayer())
|
||||||
{
|
{
|
||||||
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
|
||||||
@@ -7441,7 +7441,6 @@ 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