*Update Naxx script. Let boss evade if they are pulled out of room.
--HG-- branch : trunk
This commit is contained in:
@@ -84,29 +84,13 @@ ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature), m_creature(cr
|
||||
HeroicMode = m_creature->GetMap()->IsHeroic();
|
||||
}
|
||||
|
||||
void ScriptedAI::AttackStart(Unit* who, bool melee)
|
||||
void ScriptedAI::AttackStartNoMove(Unit* who)
|
||||
{
|
||||
if (!who)
|
||||
return;
|
||||
|
||||
if (m_creature->Attack(who, melee))
|
||||
{
|
||||
if(melee)
|
||||
DoStartMovement(who);
|
||||
else
|
||||
DoStartNoMovement(who);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptedAI::AttackStart(Unit* who)
|
||||
{
|
||||
if (!who)
|
||||
return;
|
||||
|
||||
if (m_creature->Attack(who, true))
|
||||
{
|
||||
DoStartMovement(who);
|
||||
}
|
||||
if(m_creature->Attack(who, false))
|
||||
DoStartNoMovement(who);
|
||||
}
|
||||
|
||||
void ScriptedAI::UpdateAI(const uint32 diff)
|
||||
@@ -650,6 +634,12 @@ void Scripted_NoMovementAI::AttackStart(Unit* who)
|
||||
}
|
||||
}
|
||||
|
||||
BossAI::BossAI(Creature *c, uint32 id) : ScriptedAI(c)
|
||||
, bossId(id), summons(me), instance(c->GetInstanceData())
|
||||
, boundary(instance ? instance->GetBossBoundary(id) : NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void BossAI::_Reset()
|
||||
{
|
||||
events.Reset();
|
||||
@@ -673,6 +663,53 @@ void BossAI::_EnterCombat()
|
||||
instance->SetBossState(bossId, IN_PROGRESS);
|
||||
}
|
||||
|
||||
bool BossAI::CheckBoundary(Unit *who)
|
||||
{
|
||||
if(!boundary || !who)
|
||||
return true;
|
||||
|
||||
for(BossBoundaryMap::const_iterator itr = boundary->begin(); itr != boundary->end(); ++itr)
|
||||
{
|
||||
switch(itr->first)
|
||||
{
|
||||
case BOUNDARY_N:
|
||||
if(me->GetPositionX() > itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_S:
|
||||
if(me->GetPositionX() < itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_E:
|
||||
if(me->GetPositionY() < itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_W:
|
||||
if(me->GetPositionY() > itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_NW:
|
||||
if(me->GetPositionX() + me->GetPositionY() > itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_SE:
|
||||
if(me->GetPositionX() + me->GetPositionY() < itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_NE:
|
||||
if(me->GetPositionX() - me->GetPositionY() > itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_SW:
|
||||
if(me->GetPositionX() - me->GetPositionY() < itr->second)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BossAI::JustSummoned(Creature *summon)
|
||||
{
|
||||
summons.Summon(summon);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "InstanceData.h"
|
||||
|
||||
class ScriptedInstance;
|
||||
|
||||
@@ -55,9 +56,7 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
|
||||
//CreatureAI Functions
|
||||
//*************
|
||||
|
||||
//Called at each attack of m_creature by any victim
|
||||
void AttackStart(Unit *);
|
||||
void AttackStart(Unit *, bool melee);
|
||||
void AttackStartNoMove(Unit *target);
|
||||
|
||||
// Called at any Damage from any attacker (before damage apply)
|
||||
void DamageTaken(Unit *done_by, uint32 &damage) {}
|
||||
@@ -204,27 +203,36 @@ struct TRINITY_DLL_DECL Scripted_NoMovementAI : public ScriptedAI
|
||||
|
||||
struct TRINITY_DLL_DECL BossAI : public ScriptedAI
|
||||
{
|
||||
BossAI(Creature *c, uint32 id) : ScriptedAI(c), bossId(id)
|
||||
, summons(me), instance(c->GetInstanceData())
|
||||
{}
|
||||
BossAI(Creature *c, uint32 id);
|
||||
|
||||
uint32 bossId;
|
||||
const uint32 bossId;
|
||||
EventMap events;
|
||||
SummonList summons;
|
||||
InstanceData *instance;
|
||||
InstanceData * const instance;
|
||||
const BossBoundaryMap * const boundary;
|
||||
|
||||
void JustSummoned(Creature *summon);
|
||||
void SummonedCreatureDespawn(Creature *summon);
|
||||
|
||||
void UpdateAI(const uint32 diff) = 0;
|
||||
|
||||
void _Reset();
|
||||
void _EnterCombat();
|
||||
void _JustDied();
|
||||
|
||||
void Reset() { _Reset(); }
|
||||
void EnterCombat(Unit *who) { _EnterCombat(); }
|
||||
void JustDied(Unit *killer) { _JustDied(); }
|
||||
|
||||
protected:
|
||||
void _Reset();
|
||||
void _EnterCombat();
|
||||
void _JustDied();
|
||||
|
||||
bool CheckInRoom()
|
||||
{
|
||||
if(CheckBoundary(me))
|
||||
return true;
|
||||
EnterEvadeMode();
|
||||
return false;
|
||||
}
|
||||
bool CheckBoundary(Unit *who);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user