summaryrefslogtreecommitdiff
path: root/src/server/game/AI/CreatureAI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/AI/CreatureAI.cpp')
-rw-r--r--src/server/game/AI/CreatureAI.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 12698c35dc..f21e93230e 100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
@@ -50,9 +50,9 @@ AISpellInfoType* GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i];
* @param WorldObject target The target of the speech, in case it has elements such as $n, where the target's name will be referrenced.
* @param Milliseconds delay Delay until the creature says the text line. Creatures will talk immediately by default.
*/
-void CreatureAI::Talk(uint8 id, WorldObject const* target /*= nullptr*/, Milliseconds delay /*= 0s*/)
+void CreatureAI::Talk(uint8 id, WorldObject const* target /*= nullptr*/, Milliseconds delay /*= 0ms*/)
{
- if (delay > Seconds::zero())
+ if (delay > 0ms)
{
ObjectGuid targetGuid;
@@ -83,29 +83,19 @@ WorldObject* CreatureAI::GetSummoner() const
inline bool IsValidCombatTarget(Creature* source, Player* target)
{
if (target->IsGameMaster())
- {
return false;
- }
if (!source->IsInWorld() || !target->IsInWorld())
- {
return false;
- }
if (!source->IsAlive() || !target->IsAlive())
- {
return false;
- }
if (!source->InSamePhase(target))
- {
return false;
- }
- if (source->HasUnitState(UNIT_STATE_IN_FLIGHT) || target->HasUnitState(UNIT_STATE_IN_FLIGHT))
- {
+ if (source->IsInFlight() || target->IsInFlight())
return false;
- }
return true;
}
@@ -182,7 +172,7 @@ void CreatureAI::MoveInLineOfSight(Unit* who)
if (me->IsMoveInLineOfSightDisabled())
if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || // nothing more to do, return
!who->IsInCombat() || // if not in combat, nothing more to do
- !me->IsWithinDist(who, ATTACK_DISTANCE, true, false)) // if in combat and in dist - neutral to all can actually assist other creatures
+ !me->IsWithinDist(who, ATTACK_DISTANCE, true, false, false)) // if in combat and in dist - neutral to all can actually assist other creatures
return;
if (me->HasReactState(REACT_AGGRESSIVE) && me->CanStartAttack(who))