diff options
| author | treeston <treeston.mmoc@gmail.com> | 2016-01-13 15:33:17 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2016-03-22 22:56:43 +0100 |
| commit | e2f2c70ba4ee0205dbe7f6ebb81e79dd0872d9e8 (patch) | |
| tree | 462105f4bd862b5b2d0a761aa6c5912151bda68a /src/server/game/AI | |
| parent | 78885769cbc52940993064b34f347e50c018dd52 (diff) | |
Merge branch '3.3.5-bossboundary' into 3.3.5-base (PR #16089)
(cherry picked from commit 5b8b8c653039ec2add0b3a66468abb85e6f35054)
Diffstat (limited to 'src/server/game/AI')
| -rw-r--r-- | src/server/game/AI/CoreAI/GuardAI.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/CoreAI/GuardAI.h | 2 | ||||
| -rw-r--r-- | src/server/game/AI/CoreAI/PassiveAI.cpp | 6 | ||||
| -rw-r--r-- | src/server/game/AI/CoreAI/PassiveAI.h | 6 | ||||
| -rw-r--r-- | src/server/game/AI/CoreAI/PetAI.h | 2 | ||||
| -rw-r--r-- | src/server/game/AI/CoreAI/TotemAI.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/CoreAI/TotemAI.h | 2 | ||||
| -rw-r--r-- | src/server/game/AI/CreatureAI.cpp | 108 | ||||
| -rw-r--r-- | src/server/game/AI/CreatureAI.h | 25 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 60 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedCreature.h | 15 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedEscortAI.h | 2 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h | 2 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.h | 2 |
17 files changed, 149 insertions, 93 deletions
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index 176dd41fdae..c7d618a9918 100644 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -43,7 +43,7 @@ bool GuardAI::CanSeeAlways(WorldObject const* obj) return false; } -void GuardAI::EnterEvadeMode() +void GuardAI::EnterEvadeMode(EvadeReason /*why*/) { if (!me->IsAlive()) { diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h index 01d54e47b9a..63f2750a5d4 100644 --- a/src/server/game/AI/CoreAI/GuardAI.h +++ b/src/server/game/AI/CoreAI/GuardAI.h @@ -31,7 +31,7 @@ class GuardAI : public ScriptedAI static int Permissible(Creature const* creature); bool CanSeeAlways(WorldObject const* obj) override; - void EnterEvadeMode() override; + void EnterEvadeMode(EvadeReason /*why*/) override; void JustDied(Unit* killer) override; }; #endif diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp index 1a6af99b11d..f283afe77a8 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.cpp +++ b/src/server/game/AI/CoreAI/PassiveAI.cpp @@ -26,7 +26,7 @@ NullCreatureAI::NullCreatureAI(Creature* c) : CreatureAI(c) { me->SetReactState( void PassiveAI::UpdateAI(uint32) { if (me->IsInCombat() && me->getAttackers().empty()) - EnterEvadeMode(); + EnterEvadeMode(EVADE_REASON_NO_HOSTILES); } void PossessedAI::AttackStart(Unit* target) @@ -64,11 +64,11 @@ void CritterAI::DamageTaken(Unit* /*done_by*/, uint32&) me->SetControlled(true, UNIT_STATE_FLEEING); } -void CritterAI::EnterEvadeMode() +void CritterAI::EnterEvadeMode(EvadeReason why) { if (me->HasUnitState(UNIT_STATE_FLEEING)) me->SetControlled(false, UNIT_STATE_FLEEING); - CreatureAI::EnterEvadeMode(); + CreatureAI::EnterEvadeMode(why); } void TriggerAI::IsSummonedBy(Unit* summoner) diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h index 28a73cff5de..bd72cd7fbe7 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.h +++ b/src/server/game/AI/CoreAI/PassiveAI.h @@ -41,7 +41,7 @@ class PossessedAI : public CreatureAI void MoveInLineOfSight(Unit*) override { } void AttackStart(Unit* target) override; void UpdateAI(uint32) override; - void EnterEvadeMode() override { } + void EnterEvadeMode(EvadeReason /*why*/) override { } void JustDied(Unit*) override; void KilledUnit(Unit* victim) override; @@ -57,7 +57,7 @@ class NullCreatureAI : public CreatureAI void MoveInLineOfSight(Unit*) override { } void AttackStart(Unit*) override { } void UpdateAI(uint32) override { } - void EnterEvadeMode() override { } + void EnterEvadeMode(EvadeReason /*why*/) override { } void OnCharmed(bool /*apply*/) override { } static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; } @@ -69,7 +69,7 @@ class CritterAI : public PassiveAI explicit CritterAI(Creature* c) : PassiveAI(c) { } void DamageTaken(Unit* done_by, uint32& /*damage*/) override; - void EnterEvadeMode() override; + void EnterEvadeMode(EvadeReason why) override; }; class TriggerAI : public NullCreatureAI diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index 9f220e64bfb..9c33baa9a9f 100644 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -47,7 +47,7 @@ class PetAI : public CreatureAI // void MoveInLineOfSight(Unit* /*who*/) override { } // CreatureAI interferes with returning pets void MoveInLineOfSight_Safe(Unit* /*who*/) { } // CreatureAI interferes with returning pets - void EnterEvadeMode() override { } // For fleeing, pets don't use this type of Evade mechanic + void EnterEvadeMode(EvadeReason /*why*/) override { } // For fleeing, pets don't use this type of Evade mechanic private: bool _isVisible(Unit*) const; diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index 3c34ea88e39..48459ce0cd1 100644 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -40,7 +40,7 @@ TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid() void TotemAI::MoveInLineOfSight(Unit* /*who*/) { } -void TotemAI::EnterEvadeMode() +void TotemAI::EnterEvadeMode(EvadeReason /*why*/) { me->CombatStop(true); } diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h index fdde303c7b2..e1d1618037f 100644 --- a/src/server/game/AI/CoreAI/TotemAI.h +++ b/src/server/game/AI/CoreAI/TotemAI.h @@ -33,7 +33,7 @@ class TotemAI : public CreatureAI void MoveInLineOfSight(Unit* who) override; void AttackStart(Unit* victim) override; - void EnterEvadeMode() override; + void EnterEvadeMode(EvadeReason /*why*/) override; void UpdateAI(uint32 diff) override; static int Permissible(Creature const* creature); diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index e94f5a037a3..8ef8940e89f 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -26,6 +26,7 @@ #include "MapReference.h" #include "Player.h" #include "CreatureTextMgr.h" +#include "Language.h" //Disable CreatureAI when charmed void CreatureAI::OnCharmed(bool /*apply*/) @@ -164,9 +165,9 @@ void CreatureAI::TriggerAlert(Unit const* who) const me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS); } -void CreatureAI::EnterEvadeMode() +void CreatureAI::EnterEvadeMode(EvadeReason why) { - if (!_EnterEvadeMode()) + if (!_EnterEvadeMode(why)) return; TC_LOG_DEBUG("entities.unit", "Creature %u enters evade mode.", me->GetEntry()); @@ -241,14 +242,14 @@ bool CreatureAI::UpdateVictim() } else if (me->getThreatManager().isThreatListEmpty()) { - EnterEvadeMode(); + EnterEvadeMode(EVADE_REASON_NO_HOSTILES); return false; } return true; } -bool CreatureAI::_EnterEvadeMode() +bool CreatureAI::_EnterEvadeMode(EvadeReason /*why*/) { if (!me->IsAlive()) return false; @@ -271,6 +272,105 @@ bool CreatureAI::_EnterEvadeMode() return true; } +#define BOUNDARY_VISUALIZE_CREATURE 15425 +#define BOUNDARY_VISUALIZE_CREATURE_SCALE 0.25f +#define BOUNDARY_VISUALIZE_STEP_SIZE 1 +#define BOUNDARY_VISUALIZE_FAILSAFE_LIMIT 750 +#define BOUNDARY_VISUALIZE_SPAWN_HEIGHT 5 +int32 CreatureAI::VisualizeBoundary(uint32 duration, Unit* owner, bool fill) const +{ + typedef std::pair<int32, int32> coordinate; + + if (!owner) + return -1; + + if (!_boundary || _boundary->empty()) + return LANG_CREATURE_MOVEMENT_NOT_BOUNDED; + + std::queue<coordinate> Q; + std::unordered_set<coordinate> alreadyChecked; + std::unordered_set<coordinate> outOfBounds; + + Position startPosition = owner->GetPosition(); + if (!CheckBoundary(&startPosition)) // fall back to creature position + { + startPosition = me->GetPosition(); + if (!CheckBoundary(&startPosition)) + { + startPosition = me->GetHomePosition(); + if (!CheckBoundary(&startPosition)) // fall back to creature home position + return LANG_CREATURE_NO_INTERIOR_POINT_FOUND; + } + } + float spawnZ = startPosition.GetPositionZ() + BOUNDARY_VISUALIZE_SPAWN_HEIGHT; + + bool boundsWarning = false; + Q.push({ 0,0 }); + while (!Q.empty()) + { + coordinate front = Q.front(); + bool hasOutOfBoundsNeighbor = false; + for (coordinate off : std::initializer_list<coordinate>{{1,0}, {0,1}, {-1,0}, {0,-1}}) + { + coordinate next(front.first + off.first, front.second + off.second); + if (next.first > BOUNDARY_VISUALIZE_FAILSAFE_LIMIT || next.first < -BOUNDARY_VISUALIZE_FAILSAFE_LIMIT || next.second > BOUNDARY_VISUALIZE_FAILSAFE_LIMIT || next.second < -BOUNDARY_VISUALIZE_FAILSAFE_LIMIT) + { + boundsWarning = true; + continue; + } + if (alreadyChecked.find(next) == alreadyChecked.end()) // never check a coordinate twice + { + Position nextPos(startPosition.GetPositionX() + next.first*BOUNDARY_VISUALIZE_STEP_SIZE, startPosition.GetPositionY() + next.second*BOUNDARY_VISUALIZE_STEP_SIZE, startPosition.GetPositionZ()); + if (CheckBoundary(&nextPos)) + Q.push(next); + else + { + outOfBounds.insert(next); + hasOutOfBoundsNeighbor = true; + } + alreadyChecked.insert(next); + } + else + if (outOfBounds.find(next) != outOfBounds.end()) + hasOutOfBoundsNeighbor = true; + } + if (fill || hasOutOfBoundsNeighbor) + if (TempSummon* point = owner->SummonCreature(BOUNDARY_VISUALIZE_CREATURE, Position(startPosition.GetPositionX() + front.first*BOUNDARY_VISUALIZE_STEP_SIZE, startPosition.GetPositionY() + front.second*BOUNDARY_VISUALIZE_STEP_SIZE, spawnZ), TEMPSUMMON_TIMED_DESPAWN, duration * IN_MILLISECONDS)) + { + point->SetObjectScale(BOUNDARY_VISUALIZE_CREATURE_SCALE); + point->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_STUNNED | UNIT_FLAG_IMMUNE_TO_NPC); + if (!hasOutOfBoundsNeighbor) + point->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + Q.pop(); + } + return boundsWarning ? LANG_CREATURE_MOVEMENT_MAYBE_UNBOUNDED : 0; +} + +bool CreatureAI::CheckBoundary(Position* who) const +{ + if (!who) + who = me; + + if (_boundary) + for (CreatureBoundary::const_iterator it = _boundary->begin(); it != _boundary->end(); ++it) + if (!(*it)->IsWithinBoundary(who)) + return false; + + return true; +} + +bool CreatureAI::CheckInRoom() +{ + if (CheckBoundary()) + return true; + else + { + EnterEvadeMode(EVADE_REASON_BOUNDARY); + return false; + } +} + Creature* CreatureAI::DoSummon(uint32 entry, const Position& pos, uint32 despawnTime, TempSummonType summonType) { return me->SummonCreature(entry, pos, summonType, despawnTime); diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index 0a2cce723dc..3b7c489e018 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -21,6 +21,7 @@ #include "Creature.h" #include "UnitAI.h" +#include "AreaBoundary.h" #include "Common.h" class WorldObject; @@ -63,6 +64,7 @@ enum SCEquip EQUIP_UNEQUIP = 0 }; +typedef std::set<AreaBoundary const*> CreatureBoundary; class CreatureAI : public UnitAI { protected: @@ -77,10 +79,20 @@ class CreatureAI : public UnitAI Creature* DoSummon(uint32 entry, WorldObject* obj, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); Creature* DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); + bool CheckBoundary(Position* who = nullptr) const; + void SetBoundary(CreatureBoundary const* boundary) { _boundary = boundary; CheckInRoom(); } public: + enum EvadeReason + { + EVADE_REASON_NO_HOSTILES, // the creature's threat list is empty + EVADE_REASON_BOUNDARY, // the creature has moved outside its evade boundary + EVADE_REASON_SEQUENCE_BREAK, // this is a boss and the pre-requisite encounters for engaging it are not defeated yet + EVADE_REASON_OTHER + }; + void Talk(uint8 id, WorldObject const* whisperTarget = nullptr); - explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), m_MoveInLineOfSight_locked(false) { } + explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), _boundary(nullptr), m_MoveInLineOfSight_locked(false) { } virtual ~CreatureAI() { } @@ -96,7 +108,7 @@ class CreatureAI : public UnitAI virtual bool CanRespawn() { return true; } // Called for reaction at stopping attack at no attackers or targets - virtual void EnterEvadeMode(); + virtual void EnterEvadeMode(EvadeReason why = EVADE_REASON_OTHER); // Called for reaction at enter to combat if not in combat yet (enemy can be NULL) virtual void EnterCombat(Unit* /*victim*/) { } @@ -174,10 +186,17 @@ class CreatureAI : public UnitAI virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; } + // intended for encounter design/debugging. do not use for other purposes. expensive. + int32 VisualizeBoundary(uint32 duration, Unit* owner=nullptr, bool fill=false) const; + virtual bool CheckInRoom(); + CreatureBoundary const* GetBoundary() const { return _boundary; } + protected: virtual void MoveInLineOfSight(Unit* /*who*/); - bool _EnterEvadeMode(); + bool _EnterEvadeMode(EvadeReason why = EVADE_REASON_OTHER); + + CreatureBoundary const* _boundary; private: bool m_MoveInLineOfSight_locked; diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index c2ddd1e9e8e..0e6836ca538 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -23,6 +23,7 @@ #include "Cell.h" #include "CellImpl.h" #include "ObjectMgr.h" +#include "AreaBoundary.h" // Spell summary for ScriptedAI::SelectSpell struct TSpellSummary @@ -98,7 +99,6 @@ bool SummonList::HasEntry(uint32 entry) const ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature), IsFleeing(false), - _evadeCheckCooldown(2500), _isCombatMovementAllowed(true) { _isHeroic = me->GetMap()->IsHeroic(); @@ -394,7 +394,7 @@ enum NPCs // Hacklike storage used for misc creatures that are expected to evade of outside of a certain area. // It is assumed the information is found elswehere and can be handled by the core. So far no luck finding such information/way to extract it. -bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff) +/*bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff) { if (_evadeCheckCooldown <= diff) _evadeCheckCooldown = 2500; @@ -438,15 +438,16 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff) EnterEvadeMode(); return true; -} +}*/ // BossAI - for instanced bosses BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature), instance(creature->GetInstanceScript()), summons(creature), - _boundary(instance ? instance->GetBossBoundary(bossId) : NULL), _bossId(bossId) { + if (instance) + SetBoundary(instance->GetBossBoundary(bossId)); scheduler.SetValidator([this] { return !me->HasUnitState(UNIT_STATE_CASTING); @@ -483,7 +484,7 @@ void BossAI::_EnterCombat() // bosses do not respawn, check only on enter combat if (!instance->CheckRequiredBosses(_bossId)) { - EnterEvadeMode(); + EnterEvadeMode(EVADE_REASON_SEQUENCE_BREAK); return; } instance->SetBossState(_bossId, IN_PROGRESS); @@ -507,55 +508,6 @@ void BossAI::TeleportCheaters() target->NearTeleportTo(x, y, z, 0); } -bool BossAI::CheckBoundary(Unit* who) -{ - if (!GetBoundary() || !who) - return true; - - for (BossBoundaryMap::const_iterator itr = GetBoundary()->begin(); itr != GetBoundary()->end(); ++itr) - { - switch (itr->first) - { - case BOUNDARY_N: - if (who->GetPositionX() > itr->second) - return false; - break; - case BOUNDARY_S: - if (who->GetPositionX() < itr->second) - return false; - break; - case BOUNDARY_E: - if (who->GetPositionY() < itr->second) - return false; - break; - case BOUNDARY_W: - if (who->GetPositionY() > itr->second) - return false; - break; - case BOUNDARY_NW: - if (who->GetPositionX() + who->GetPositionY() > itr->second) - return false; - break; - case BOUNDARY_SE: - if (who->GetPositionX() + who->GetPositionY() < itr->second) - return false; - break; - case BOUNDARY_NE: - if (who->GetPositionX() - who->GetPositionY() > itr->second) - return false; - break; - case BOUNDARY_SW: - if (who->GetPositionX() - who->GetPositionY() < itr->second) - return false; - break; - default: - break; - } - } - - return true; -} - void BossAI::JustSummoned(Creature* summon) { summons.Summon(summon); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 87c1a63d4e4..d3e20e8b886 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -260,8 +260,6 @@ struct ScriptedAI : public CreatureAI void SetCombatMovement(bool allowMovement); bool IsCombatMovementAllowed() const { return _isCombatMovementAllowed; } - bool EnterEvadeIfOutOfCombatArea(uint32 const diff); - // return true for heroic mode. i.e. // - for dungeon in mode 10-heroic, // - for raid in mode 10-Heroic @@ -329,7 +327,6 @@ struct ScriptedAI : public CreatureAI private: Difficulty _difficulty; - uint32 _evadeCheckCooldown; bool _isCombatMovementAllowed; bool _isHeroic; }; @@ -341,7 +338,6 @@ class BossAI : public ScriptedAI virtual ~BossAI() { } InstanceScript* const instance; - BossBoundaryMap const* GetBoundary() const { return _boundary; } void JustSummoned(Creature* summon) override; void SummonedCreatureDespawn(Creature* summon) override; @@ -368,16 +364,6 @@ class BossAI : public ScriptedAI void _JustReachedHome() { me->setActive(false); } void _DespawnAtEvade(); - virtual bool CheckInRoom() - { - if (CheckBoundary(me)) - return true; - - EnterEvadeMode(); - return false; - } - - bool CheckBoundary(Unit* who); void TeleportCheaters(); EventMap events; @@ -385,7 +371,6 @@ class BossAI : public ScriptedAI TaskScheduler scheduler; private: - BossBoundaryMap const* const _boundary; uint32 const _bossId; }; diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index cd2288364c1..6e8a2def3e3 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -184,7 +184,7 @@ void npc_escortAI::ReturnToLastPoint() me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z); } -void npc_escortAI::EnterEvadeMode() +void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/) { me->RemoveAllAuras(); me->DeleteThreatList(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index 3b7428e2b9e..673f3e671a0 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -66,7 +66,7 @@ struct npc_escortAI : public ScriptedAI void ReturnToLastPoint(); - void EnterEvadeMode() override; + void EnterEvadeMode(EvadeReason /*why*/ = EVADE_REASON_OTHER) override; void UpdateAI(uint32 diff) override; // the "internal" update, calls UpdateEscortAI() virtual void UpdateEscortAI(uint32 diff); // used when it's needed to add code in update (abilities, scripted events, etc) diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 3fbd6b9a834..583e99b9d10 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -176,7 +176,7 @@ void FollowerAI::JustRespawned() Reset(); } -void FollowerAI::EnterEvadeMode() +void FollowerAI::EnterEvadeMode(EvadeReason /*why*/) { me->RemoveAllAuras(); me->DeleteThreatList(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h index f3919ea63bc..d1c976b45c8 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h @@ -46,7 +46,7 @@ class FollowerAI : public ScriptedAI void MoveInLineOfSight(Unit*) override; - void EnterEvadeMode() override; + void EnterEvadeMode(EvadeReason /*why*/ = EVADE_REASON_OTHER) override; void JustDied(Unit*) override; diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 001fd259996..2dec1d0fc4c 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -408,7 +408,7 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data) MovepointReached(Data); } -void SmartAI::EnterEvadeMode() +void SmartAI::EnterEvadeMode(EvadeReason /*why*/) { if (!me->IsAlive() || me->IsInEvadeMode()) return; diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 8454ea3b484..3abe1e5774c 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -79,7 +79,7 @@ class SmartAI : public CreatureAI void EnterCombat(Unit* enemy) override; // Called for reaction at stopping attack at no attackers or targets - void EnterEvadeMode() override; + void EnterEvadeMode(EvadeReason why = EVADE_REASON_OTHER) override; // Called when the creature is killed void JustDied(Unit* killer) override; |
