mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 03:32:28 -04:00
[svn] Replace many IsWithinDistInMap with IsWithinCombatDist in melee attack function.
--HG-- branch : trunk
This commit is contained in:
@@ -42,7 +42,7 @@ struct TRINITY_DLL_DECL generic_creatureAI : public ScriptedAI
|
||||
|
||||
void Aggro(Unit *who)
|
||||
{
|
||||
if (!m_creature->IsWithinDistInMap(who, ATTACK_DISTANCE))
|
||||
if (!m_creature->IsWithinCombatDist(who, ATTACK_DISTANCE))
|
||||
{
|
||||
IsSelfRooted = true;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ struct TRINITY_DLL_DECL generic_creatureAI : public ScriptedAI
|
||||
return;
|
||||
|
||||
//If we are within range melee the target
|
||||
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
//Make sure our attack is ready and we arn't currently casting
|
||||
if( m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false))
|
||||
|
||||
@@ -86,7 +86,7 @@ void guardAI::UpdateAI(const uint32 diff)
|
||||
if( m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false))
|
||||
{
|
||||
//If we are within range melee the target
|
||||
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
bool Healing = false;
|
||||
SpellEntry const *info = NULL;
|
||||
|
||||
@@ -212,7 +212,7 @@ void npc_escortAI::UpdateAI(const uint32 diff)
|
||||
if( m_creature->isAlive() && m_creature->SelectHostilTarget() && m_creature->getVictim())
|
||||
{
|
||||
//If we are within range melee the target
|
||||
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
if( m_creature->isAttackReady() )
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ struct TRINITY_DLL_DECL boss_murmurAI : public Scripted_NoMovementAI
|
||||
//Resonance_Timer
|
||||
if (Resonance_Timer < diff)
|
||||
{
|
||||
if (!m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if (!m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
DoCast(m_creature->getVictim(), SPELL_RESONANCE);
|
||||
Resonance_Timer = 5000;
|
||||
}else Resonance_Timer -= diff;
|
||||
|
||||
@@ -1835,7 +1835,7 @@ struct TRINITY_DLL_DECL mob_parasitic_shadowfiendAI : public ScriptedAI
|
||||
|
||||
void DoMeleeAttackIfReady()
|
||||
{
|
||||
if( m_creature->isAttackReady() && m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if( m_creature->isAttackReady() && m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
if(!m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0))
|
||||
{
|
||||
|
||||
@@ -245,7 +245,7 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI
|
||||
for (i = m_threatlist.begin(); i!= m_threatlist.end();++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
if(pUnit && m_creature->IsWithinDistInMap(pUnit, ATTACK_DISTANCE))
|
||||
if(pUnit && m_creature->IsWithinCombatDist(pUnit, ATTACK_DISTANCE))
|
||||
{
|
||||
if(pUnit->GetHealth() > health)
|
||||
{
|
||||
|
||||
@@ -243,7 +243,7 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI
|
||||
Unit* target = NULL;
|
||||
target = SelectUnit(SELECT_TARGET_TOPAGGRO,1);
|
||||
|
||||
if (target && m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if (target && m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
DoCast(target,SPELL_HURTFUL_STRIKE);
|
||||
else
|
||||
DoCast(m_creature->getVictim(),SPELL_HURTFUL_STRIKE);
|
||||
|
||||
@@ -169,7 +169,7 @@ struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public Scripted_NoMovementAI
|
||||
else if( OrbitalStrike_Timer < diff )
|
||||
{
|
||||
Unit* temp = NULL;
|
||||
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE) )
|
||||
if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE) )
|
||||
temp = m_creature->getVictim();
|
||||
else temp = SelectUnit(SELECT_TARGET_RANDOM,0);
|
||||
|
||||
|
||||
@@ -612,7 +612,7 @@ struct TRINITY_DLL_DECL boss_malchezaarAI : public ScriptedAI
|
||||
|
||||
void DoMeleeAttacksIfReady()
|
||||
{
|
||||
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE) && !m_creature->IsNonMeleeSpellCasted(false))
|
||||
if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE) && !m_creature->IsNonMeleeSpellCasted(false))
|
||||
{
|
||||
//Check for base attack
|
||||
if( m_creature->isAttackReady() && m_creature->getVictim() )
|
||||
|
||||
@@ -274,7 +274,7 @@ struct TRINITY_DLL_DECL boss_ragnarosAI : public Scripted_NoMovementAI
|
||||
}else Submerge_Timer -= diff;
|
||||
|
||||
//If we are within range melee the target
|
||||
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
//Make sure our attack is ready and we arn't currently casting
|
||||
if( m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false))
|
||||
|
||||
@@ -171,7 +171,7 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public ScriptedAI
|
||||
}else Beserk_Timer -= diff;
|
||||
}
|
||||
|
||||
if( phase!=2 && m_creature->getVictim() && m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if( phase!=2 && m_creature->getVictim() && m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
if( m_creature->isAttackReady() )
|
||||
{
|
||||
|
||||
@@ -120,7 +120,7 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI
|
||||
if (!m_creature->SelectHostilTarget() || !m_creature->getVictim())
|
||||
return;
|
||||
|
||||
if (m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if (m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
//when hp <= 20% gain enrage
|
||||
if (((m_creature->GetHealth()*100)/ m_creature->GetMaxHealth()) <= 20)
|
||||
|
||||
@@ -326,7 +326,7 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI
|
||||
if( m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false))
|
||||
{
|
||||
//If we are within range melee the target
|
||||
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
HandleTouchedSpells(m_creature->getVictim(), SPELL_DARK_TOUCHED);
|
||||
m_creature->AttackerStateUpdate(m_creature->getVictim());
|
||||
@@ -739,7 +739,7 @@ struct TRINITY_DLL_DECL mob_shadow_imageAI : public ScriptedAI
|
||||
if(!m_creature->IsNonMeleeSpellCasted(false))
|
||||
{
|
||||
//If we are within range melee the target
|
||||
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
DoCast(m_creature->getVictim(),SPELL_DARK_STRIKE);
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI
|
||||
{
|
||||
if(m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false))
|
||||
{
|
||||
if(m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if(m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
m_creature->AttackerStateUpdate(m_creature->getVictim());
|
||||
m_creature->resetAttackTimer();
|
||||
|
||||
@@ -148,7 +148,7 @@ struct TRINITY_DLL_DECL boss_skeramAI : public ScriptedAI
|
||||
}else ArcaneExplosion_Timer -= diff;
|
||||
|
||||
//If we are within range melee the target
|
||||
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
//Make sure our attack is ready and we arn't currently casting
|
||||
if( m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false))
|
||||
|
||||
@@ -268,7 +268,7 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI
|
||||
{
|
||||
if( !m_creature->IsNonMeleeSpellCasted(false))
|
||||
{
|
||||
if(m_creature->isAttackReady() && m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if(m_creature->isAttackReady() && m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
{
|
||||
if(Phase == 1 && !Overpower_Timer)
|
||||
{
|
||||
@@ -613,7 +613,7 @@ struct TRINITY_DLL_DECL feather_vortexAI : public ScriptedAI
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
//if the vortex reach the target, it change his target to another player
|
||||
if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE))
|
||||
AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user