mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Threat: Fix a potential exploit allowing players to damage a boss without them taking damage.
Scripts/Halion: General cleanup of old hacks no longer needed under new combat system.
(cherry picked from commit 9ad11e67fb)
This commit is contained in:
@@ -808,6 +808,7 @@ void Creature::Update(uint32 diff)
|
||||
if (diff >= m_boundaryCheckTime)
|
||||
{
|
||||
AI()->CheckInRoom();
|
||||
GetThreatManager().UpdateOnlineStates(false, true);
|
||||
m_boundaryCheckTime = 2500;
|
||||
} else
|
||||
m_boundaryCheckTime -= diff;
|
||||
|
||||
@@ -281,6 +281,9 @@ class boss_halion : public CreatureScript
|
||||
|
||||
void DamageTaken(Unit* attacker, uint32& damage) override
|
||||
{
|
||||
if (damage >= me->GetHealth() && !events.IsInPhase(PHASE_THREE))
|
||||
damage = me->GetHealth() - 1;
|
||||
|
||||
if (me->HealthBelowPctDamaged(75, damage) && events.IsInPhase(PHASE_ONE))
|
||||
{
|
||||
events.SetPhase(PHASE_TWO);
|
||||
@@ -461,6 +464,8 @@ class boss_twilight_halion : public CreatureScript
|
||||
|
||||
void DamageTaken(Unit* attacker, uint32& damage) override
|
||||
{
|
||||
if (damage >= me->GetHealth() && !events.IsInPhase(PHASE_THREE))
|
||||
damage = me->GetHealth() - 1;
|
||||
//Needed because we already have UNIT_FLAG_IN_COMBAT, otherwise JustEngagedWith won't ever be called
|
||||
if (!events.IsInPhase(PHASE_TWO) && !events.IsInPhase(PHASE_THREE))
|
||||
JustEngagedWith(attacker);
|
||||
@@ -607,7 +612,7 @@ class npc_halion_controller : public CreatureScript
|
||||
_events.ScheduleEvent(EVENT_EVADE_CHECK, Seconds(5));
|
||||
}
|
||||
|
||||
void EnterEvadeMode(EvadeReason /*why*/) override
|
||||
void JustExitedCombat() override
|
||||
{
|
||||
if (Creature* twilightHalion = _instance->GetCreature(DATA_TWILIGHT_HALION))
|
||||
{
|
||||
@@ -624,16 +629,7 @@ class npc_halion_controller : public CreatureScript
|
||||
_instance->SetBossState(DATA_HALION, FAIL);
|
||||
_summons.DespawnAll();
|
||||
|
||||
uint32 corpseDelay = me->GetCorpseDelay();
|
||||
uint32 respawnDelay = me->GetRespawnDelay();
|
||||
|
||||
me->SetCorpseDelay(1);
|
||||
me->SetRespawnDelay(30);
|
||||
|
||||
me->DespawnOrUnsummon();
|
||||
|
||||
me->SetCorpseDelay(corpseDelay);
|
||||
me->SetRespawnDelay(respawnDelay);
|
||||
me->DespawnOrUnsummon(0, 30s);
|
||||
}
|
||||
|
||||
void DoAction(int32 action) override
|
||||
@@ -693,14 +689,11 @@ class npc_halion_controller : public CreatureScript
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
// The IsInCombat() check is needed because that check should be false when Halion is
|
||||
// The IsEngaged() check is needed because that check should be false when Halion is
|
||||
// not engaged, while it would return true without as UpdateVictim() checks for
|
||||
// combat state.
|
||||
if (!_events.IsInPhase(PHASE_INTRO) && me->IsInCombat() && !UpdateVictim())
|
||||
{
|
||||
EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
|
||||
if (me->IsEngaged() && !UpdateVictim())
|
||||
return;
|
||||
}
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
@@ -737,9 +730,10 @@ class npc_halion_controller : public CreatureScript
|
||||
twilightHalion->CastSpell(nullptr, SPELL_TWILIGHT_MENDING, true);
|
||||
break;
|
||||
case EVENT_TRIGGER_BERSERK:
|
||||
for (uint8 i = DATA_HALION; i <= DATA_TWILIGHT_HALION; i++)
|
||||
if (Creature* halion = _instance->GetCreature(i))
|
||||
halion->CastSpell(halion, SPELL_BERSERK, true);
|
||||
if (Creature* halion = _instance->GetCreature(DATA_HALION))
|
||||
halion->CastSpell(halion, SPELL_BERSERK, true);
|
||||
if (Creature* halion = _instance->GetCreature(DATA_TWILIGHT_HALION))
|
||||
halion->CastSpell(halion, SPELL_BERSERK, true);
|
||||
break;
|
||||
case EVENT_SHADOW_PULSARS_SHOOT:
|
||||
if (Creature* orbCarrier = _instance->GetCreature(DATA_ORB_CARRIER))
|
||||
|
||||
Reference in New Issue
Block a user