aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2019-10-21 16:43:39 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-18 23:03:00 +0100
commitd3ddb3726aa9d3a069ff15a0f5828c6702e39b91 (patch)
treee75d999d069800c0368aa594f28afe5ddfb9ad49 /src/server/game/AI/ScriptedAI
parentdfb2221552048512b4fda0c7e0c97ecf808106f9 (diff)
Core/AI: 06443e3 followup
cause its not "that" horrible (cherry picked from commit a71c5f4c7f35b074397abfcc9b925e80720f8c75)
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp20
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h2
2 files changed, 17 insertions, 5 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index f5a8710cbe5..c0643792227 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -515,14 +515,26 @@ void BossAI::TeleportCheaters()
}
}
-void BossAI::ForceStopCombatForCreature(uint32 entry, float maxSearchRange /*= 250.0f*/)
+void BossAI::ForceCombatStopForCreatureEntry(uint32 entry, float maxSearchRange /*= 250.0f*/, bool reset /*= true*/)
{
- TC_LOG_WARN("scripts.ai", "BossAI::ForceStopCombatForCreature: called on '%s' with creature entry '%u'. This should be fixed in another way than calling this function. Debug info: %s", me->GetName().c_str(), entry, me->GetDebugInfo().c_str());
+ TC_LOG_DEBUG("scripts.ai", "BossAI::ForceCombatStopForCreatureEntry: called on '%s'. Debug info: %s", me->GetGUID().ToString().c_str(), me->GetDebugInfo().c_str());
+
std::list<Creature*> creatures;
me->GetCreatureListWithEntryInGrid(creatures, entry, maxSearchRange);
- for (Creature* creature : creatures)
- creature->CombatStop();
+ for (Creature* creature : creatures) {
+ creature->CombatStop(true);
+ creature->DoNotReacquireSpellFocusTarget();
+ creature->GetMotionMaster()->Clear(MOTION_PRIORITY_NORMAL);
+
+ if (reset) {
+ creature->LoadCreaturesAddon();
+ creature->SetLootRecipient(nullptr);
+ creature->ResetPlayerDamageReq();
+ creature->SetLastDamagedTime(0);
+ creature->SetCannotReachTarget(false);
+ }
+ }
}
void BossAI::JustSummoned(Creature* summon)
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index 9f39f981415..82617bb97e4 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -338,7 +338,7 @@ class TC_GAME_API BossAI : public ScriptedAI
void TeleportCheaters();
- void ForceStopCombatForCreature(uint32 entry, float maxSearchRange = 250.0f);
+ void ForceCombatStopForCreatureEntry(uint32 entry, float maxSearchRange = 250.0f, bool reset = true);
EventMap events;
SummonList summons;