fix(Creature/Core): Boss phased reset (#7828)

Co-authored-by: Si1ker <Si1ker@users.noreply.github.com>
Co-authored-by: lineagedr <lineagedr@users.noreply.github.com>
Co-authored-by: Footman <footman@hotmail.de>
This commit is contained in:
Silker
2021-09-16 06:32:36 -06:00
committed by GitHub
parent fd229f75e1
commit 4dc642d530
6 changed files with 97 additions and 3 deletions

View File

@@ -1921,6 +1921,36 @@ void Creature::DespawnOrUnsummon(uint32 msTimeToDespawn /*= 0*/)
ForcedDespawn(msTimeToDespawn);
}
void Creature::DespawnOnEvade()
{
SetVisible(false);
AI()->SummonedCreatureDespawnAll();
RemoveEvadeAuras();
float x, y, z, o;
GetRespawnPosition(x, y, z, &o);
SetHomePosition(x, y, z, o);
SetPosition(x, y, z, o);
if (IsFalling())
{
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING);
}
StopMoving();
}
void Creature::RespawnOnEvade()
{
SetVisible(true);
UpdateMovementFlags();
AI()->Reset();
AI()->JustReachedHome();
if (IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
{
GetVehicleKit()->Reset(true);
}
}
void Creature::InitializeReactState()
{
if ((IsTotem() || IsTrigger() || IsCritter() || IsSpiritService()) && GetAIName() != "SmartAI" && !GetScriptId())

View File

@@ -257,6 +257,8 @@ public:
void RemoveCorpse(bool setSpawnTime = true, bool skipVisibility = false);
void DespawnOrUnsummon(uint32 msTimeToDespawn = 0);
void DespawnOnEvade();
void RespawnOnEvade();
[[nodiscard]] time_t const& GetRespawnTime() const { return m_respawnTime; }
[[nodiscard]] time_t GetRespawnTimeEx() const;