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:
Treeston
2016-02-10 17:23:43 +01:00
6 changed files with 8 additions and 6 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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();

View File

@@ -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

View File

@@ -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;

View File

@@ -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