mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Merge pull request #16491 from Treeston/3.3.5-boundarycheck
[3.3.5] Add target boundary check to BossAI CanCreatureAttack call
This commit is contained in:
@@ -350,7 +350,7 @@ int32 CreatureAI::VisualizeBoundary(uint32 duration, Unit* owner, bool fill) con
|
||||
return boundsWarning ? LANG_CREATURE_MOVEMENT_MAYBE_UNBOUNDED : 0;
|
||||
}
|
||||
|
||||
bool CreatureAI::CheckBoundary(Position* who) const
|
||||
bool CreatureAI::CheckBoundary(Position const* who) const
|
||||
{
|
||||
if (!who)
|
||||
who = me;
|
||||
|
||||
@@ -79,7 +79,7 @@ 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;
|
||||
bool CheckBoundary(Position const* who = nullptr) const;
|
||||
void SetBoundary(CreatureBoundary const* boundary) { _boundary = boundary; me->DoImmediateBoundaryCheck(); }
|
||||
public:
|
||||
enum EvadeReason
|
||||
|
||||
@@ -360,6 +360,8 @@ class BossAI : public ScriptedAI
|
||||
void JustDied(Unit* /*killer*/) override { _JustDied(); }
|
||||
void JustReachedHome() override { _JustReachedHome(); }
|
||||
|
||||
bool CanAIAttack(Unit const* target) const override { return CheckBoundary(target); }
|
||||
|
||||
protected:
|
||||
void _Reset();
|
||||
void _EnterCombat();
|
||||
|
||||
@@ -135,9 +135,9 @@ class boss_general_zarithrian : public CreatureScript
|
||||
Talk(SAY_KILL);
|
||||
}
|
||||
|
||||
bool CanAIAttack(Unit const* /*target*/) const override
|
||||
bool CanAIAttack(Unit const* target) const override
|
||||
{
|
||||
return (instance->GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && instance->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE);
|
||||
return (instance->GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && instance->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE && BossAI::CanAIAttack(target));
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
|
||||
@@ -598,7 +598,7 @@ class boss_deathbringer_saurfang : public CreatureScript
|
||||
if (target->GetTransport())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return BossAI::CanAIAttack(target);
|
||||
}
|
||||
|
||||
static uint32 const FightWonValue;
|
||||
|
||||
@@ -578,7 +578,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
bool CanAIAttack(Unit const* target) const override
|
||||
{
|
||||
// The Lich King must not select targets in frostmourne room if he killed everyone outside
|
||||
return !target->HasAura(SPELL_IN_FROSTMOURNE_ROOM);
|
||||
return !target->HasAura(SPELL_IN_FROSTMOURNE_ROOM) && BossAI::CanAIAttack(target);
|
||||
}
|
||||
|
||||
void EnterEvadeMode(EvadeReason why) override
|
||||
|
||||
Reference in New Issue
Block a user