Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2025-05-02 16:50:45 +08:00
138 changed files with 4062 additions and 3707 deletions

View File

@@ -1938,17 +1938,8 @@ bool Creature::CanStartAttack(Unit const* who) const
if (!_IsTargetAcceptable(who))
return false;
// pussywizard: at this point we are either hostile to who or friendly to who->getAttackerForHelper()
// pussywizard: if who is in combat and has an attacker, help him if the distance is right (help because who is hostile or help because attacker is friendly)
bool assist = false;
if (who->IsEngaged() && IsWithinDist(who, ATTACK_DISTANCE))
if (Unit* victim = who->getAttackerForHelper())
if (IsWithinDistInMap(victim, sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS)))
assist = true;
if (!assist)
if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false)) // pussywizard: +m_combatDistance for turrets and similar
return false;
if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false)) // pussywizard: +m_combatDistance for turrets and similar
return false;
if (!CanCreatureAttack(who))
return false;
@@ -1956,6 +1947,9 @@ bool Creature::CanStartAttack(Unit const* who) const
if (HasUnitState(UNIT_STATE_STUNNED))
return false;
if (!IsHostileTo(who))
return false;
return IsWithinLOSInMap(who);
}
@@ -2538,6 +2532,9 @@ bool Creature::CanAssistTo(Unit const* u, Unit const* enemy, bool checkfaction /
{
if (GetFaction() != u->GetFaction())
return false;
if (!RespondsToCallForHelp())
return false;
}
else
{