mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 10:37:01 +00:00
Various Cleanups (game A-B)
This commit is contained in:
parent
2a4b8f2cb0
commit
f80629e307
47 changed files with 1359 additions and 1337 deletions
|
|
@ -28,38 +28,38 @@
|
|||
#include <list>
|
||||
|
||||
int
|
||||
AggressorAI::Permissible(const Creature *creature)
|
||||
AggressorAI::Permissible(const Creature* creature)
|
||||
{
|
||||
// have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight
|
||||
if( !creature->IsCivilian() && !creature->IsNeutralToAll() )
|
||||
if (!creature->IsCivilian() && !creature->IsNeutralToAll())
|
||||
return PERMIT_BASE_PROACTIVE;
|
||||
|
||||
return PERMIT_BASE_NO;
|
||||
}
|
||||
|
||||
AggressorAI::AggressorAI(Creature *c) : CreatureAI(c), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK)
|
||||
AggressorAI::AggressorAI(Creature* c) : CreatureAI(c), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AggressorAI::MoveInLineOfSight(Unit *u)
|
||||
AggressorAI::MoveInLineOfSight(Unit* u)
|
||||
{
|
||||
// Ignore Z for flying creatures
|
||||
if( !m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
|
||||
if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE)
|
||||
return;
|
||||
|
||||
if (m_creature->CanInitiateAttack() && u->isTargetableForAttack() &&
|
||||
m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature))
|
||||
m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature))
|
||||
{
|
||||
float attackRadius = m_creature->GetAttackDistance(u);
|
||||
if(m_creature->IsWithinDistInMap(u, attackRadius) && m_creature->IsWithinLOSInMap(u) )
|
||||
if (m_creature->IsWithinDistInMap(u, attackRadius) && m_creature->IsWithinLOSInMap(u))
|
||||
{
|
||||
if(!m_creature->getVictim())
|
||||
if (!m_creature->getVictim())
|
||||
{
|
||||
AttackStart(u);
|
||||
u->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
|
||||
}
|
||||
else if(sMapStore.LookupEntry(m_creature->GetMapId())->IsDungeon())
|
||||
else if (sMapStore.LookupEntry(m_creature->GetMapId())->IsDungeon())
|
||||
{
|
||||
m_creature->AddThreat(u);
|
||||
u->SetInCombatWith(m_creature);
|
||||
|
|
@ -123,7 +123,7 @@ void
|
|||
AggressorAI::UpdateAI(const uint32 /*diff*/)
|
||||
{
|
||||
// update i_victimGuid if m_creature->getVictim() !=0 and changed
|
||||
if(!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
||||
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
||||
return;
|
||||
|
||||
i_victimGuid = m_creature->getVictim()->GetObjectGuid();
|
||||
|
|
@ -132,19 +132,19 @@ AggressorAI::UpdateAI(const uint32 /*diff*/)
|
|||
}
|
||||
|
||||
bool
|
||||
AggressorAI::IsVisible(Unit *pl) const
|
||||
AggressorAI::IsVisible(Unit* pl) const
|
||||
{
|
||||
return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_FLOAT_SIGHT_MONSTER))
|
||||
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
|
||||
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
|
||||
}
|
||||
|
||||
void
|
||||
AggressorAI::AttackStart(Unit *u)
|
||||
AggressorAI::AttackStart(Unit* u)
|
||||
{
|
||||
if( !u )
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
if(m_creature->Attack(u,true))
|
||||
if (m_creature->Attack(u,true))
|
||||
{
|
||||
i_victimGuid = u->GetObjectGuid();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue