Core/Auras: Implement SpellAuraInterruptFlags2::StartOfEncounter (#28938)

Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
Teleqraph
2023-05-06 20:56:01 +02:00
committed by GitHub
parent ca66da1c97
commit 15135ce16f
5 changed files with 17 additions and 3 deletions

View File

@@ -481,6 +481,10 @@ inline void Battleground::_ProcessJoin(uint32 diff)
SetStatus(STATUS_IN_PROGRESS);
SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FOURTH]);
for (auto const& [guid, _] : GetPlayers())
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->AtStartOfEncounter();
// Remove preparation
if (isArena())
{

View File

@@ -536,6 +536,14 @@ void Unit::MonsterMoveWithSpeed(float x, float y, float z, float speed, bool gen
GetMotionMaster()->LaunchMoveSpline(std::move(initializer), 0, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE);
}
void Unit::AtStartOfEncounter()
{
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::StartOfEncounter);
if (IsAlive())
Unit::ProcSkillsAndAuras(this, nullptr, PROC_FLAG_ENCOUNTER_START, PROC_FLAG_NONE, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_NONE, PROC_HIT_NONE, nullptr, nullptr, nullptr);
}
void Unit::UpdateSplineMovement(uint32 t_diff)
{
if (movespline->Finalized())

View File

@@ -2017,6 +2017,9 @@ class TC_GAME_API Unit : public WorldObject
virtual void AtEngage(Unit* /*target*/) {}
virtual void AtDisengage() {}
public:
void AtStartOfEncounter();
private:
void UpdateSplineMovement(uint32 t_diff);

View File

@@ -409,8 +409,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
instance->DoOnPlayers([](Player* player)
{
if (player->IsAlive())
Unit::ProcSkillsAndAuras(player, nullptr, PROC_FLAG_ENCOUNTER_START, PROC_FLAG_NONE, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_NONE, PROC_HIT_NONE, nullptr, nullptr, nullptr);
player->AtStartOfEncounter();
});
break;
}

View File

@@ -124,7 +124,7 @@ enum class SpellAuraInterruptFlags2 : uint32
Jump = 0x00000020,
ChangeSpec = 0x00000040,
AbandonVehicle = 0x00000080, // Implemented in Unit::_ExitVehicle
StartOfEncounter = 0x00000100, // NYI
StartOfEncounter = 0x00000100, // Implemented in InstanceScript::SetBossState and Battleground::_ProcessJoin
EndOfEncounter = 0x00000200, // NYI
Disconnect = 0x00000400, // NYI
EnteringInstance = 0x00000800, // Implemented in Map::AddPlayerToMap