mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 02:46:33 +01:00
[svn] Fix a bug that event_ai mobs do not attack or cast.
--HG-- branch : trunk
This commit is contained in:
@@ -25,7 +25,7 @@ private:
|
||||
|
||||
struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
|
||||
{
|
||||
ScriptedAI(Creature* creature) : m_creature(creature), InCombat(false) {}
|
||||
ScriptedAI(Creature* creature) : m_creature(creature), InCombat(false), IsFleeing(false) {}
|
||||
~ScriptedAI() {}
|
||||
|
||||
//*************
|
||||
|
||||
@@ -1240,19 +1240,24 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
|
||||
if (!m_creature->isAlive())
|
||||
return;
|
||||
|
||||
if ((TimetoFleeLeft < diff || (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLEEING_MOTION_TYPE)) && IsFleeing)
|
||||
if (IsFleeing)
|
||||
{
|
||||
m_creature->GetMotionMaster()->Clear(false);
|
||||
m_creature->SetNoCallAssistence(false);
|
||||
m_creature->CallAssistence();
|
||||
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
|
||||
IsFleeing = false;
|
||||
}
|
||||
else
|
||||
TimetoFleeLeft -= diff;
|
||||
if(TimetoFleeLeft < diff
|
||||
|| m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE
|
||||
&& m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLEEING_MOTION_TYPE)
|
||||
{
|
||||
m_creature->GetMotionMaster()->Clear(false);
|
||||
m_creature->SetNoCallAssistence(false);
|
||||
m_creature->CallAssistence();
|
||||
if(m_creature->getVictim())
|
||||
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
|
||||
IsFleeing = false;
|
||||
}
|
||||
else
|
||||
TimetoFleeLeft -= diff;
|
||||
|
||||
if(IsFleeing)
|
||||
return;
|
||||
}
|
||||
|
||||
//Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events
|
||||
if (EventUpdateTime < diff)
|
||||
@@ -1274,18 +1279,17 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Check for time based events
|
||||
for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
|
||||
{
|
||||
//Decrement Timers
|
||||
if ((*i).Time)
|
||||
|
||||
{
|
||||
if ((*i).Time > EventDiff)
|
||||
{
|
||||
//Do not decrement timers if event cannot trigger in this phase
|
||||
//Do not decrement timers if event cannot trigger in this phase
|
||||
if (!((*i).Event.event_inverse_phase_mask & (1 << Phase)))
|
||||
(*i).Time -= EventDiff;
|
||||
//Skip processing of events that have time remaining
|
||||
@@ -1307,14 +1311,15 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
|
||||
case EVENT_T_TARGET_CASTING:
|
||||
case EVENT_T_FRIENDLY_HP:
|
||||
if( Combat )
|
||||
ProcessEvent(*i);
|
||||
ProcessEvent(*i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EventDiff = 0;
|
||||
EventUpdateTime = EVENT_UPDATE_TIME;
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
EventDiff += diff;
|
||||
EventUpdateTime -= diff;
|
||||
@@ -1323,7 +1328,6 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
|
||||
//Melee Auto-Attack
|
||||
if (Combat && MeleeEnabled)
|
||||
DoMeleeAttackIfReady();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -481,8 +481,6 @@ struct TRINITY_DLL_DECL boss_thurgAI : public boss_hexlord_addAI
|
||||
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
|
||||
return;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
|
||||
if(bloodlust_timer < diff)
|
||||
{
|
||||
std::list<Creature*> templist = DoFindFriendlyMissingBuff(50, SPELL_BLOODLUST);
|
||||
@@ -499,6 +497,8 @@ struct TRINITY_DLL_DECL boss_thurgAI : public boss_hexlord_addAI
|
||||
m_creature->CastSpell(m_creature->getVictim(),SPELL_CLEAVE, false);
|
||||
cleave_timer = 12000; //3 sec cast
|
||||
}else cleave_timer -= diff;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -549,9 +549,6 @@ struct TRINITY_DLL_DECL boss_alyson_antilleAI : public boss_hexlord_addAI
|
||||
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
|
||||
return;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
|
||||
|
||||
if(flashheal_timer < diff)
|
||||
{
|
||||
Unit* target = DoSelectLowestHpFriendly(99, 30000);
|
||||
@@ -592,6 +589,8 @@ struct TRINITY_DLL_DECL boss_alyson_antilleAI : public boss_hexlord_addAI
|
||||
|
||||
dispelmagic_timer = 12000;
|
||||
}else dispelmagic_timer -= diff;*/
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -635,13 +634,13 @@ struct TRINITY_DLL_DECL boss_gazakrothAI : public boss_hexlord_addAI
|
||||
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
|
||||
return;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
|
||||
if(firebolt_timer < diff)
|
||||
{
|
||||
m_creature->CastSpell(m_creature->getVictim(),SPELL_FIREBOLT, false);
|
||||
firebolt_timer = 700;
|
||||
}else firebolt_timer -= diff;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -668,8 +667,6 @@ struct TRINITY_DLL_DECL boss_lord_raadanAI : public boss_hexlord_addAI
|
||||
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
|
||||
return;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
|
||||
if (thunderclap_timer < diff)
|
||||
{
|
||||
m_creature->CastSpell(m_creature->getVictim(),SPELL_THUNDERCLAP, false);
|
||||
@@ -681,6 +678,8 @@ struct TRINITY_DLL_DECL boss_lord_raadanAI : public boss_hexlord_addAI
|
||||
m_creature->CastSpell(m_creature->getVictim(),SPELL_FLAME_BREATH, false);
|
||||
flamebreath_timer = 12000;
|
||||
}else flamebreath_timer -= diff;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -704,13 +703,13 @@ struct TRINITY_DLL_DECL boss_darkheartAI : public boss_hexlord_addAI
|
||||
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
|
||||
return;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
|
||||
if (psychicwail_timer < diff)
|
||||
{
|
||||
m_creature->CastSpell(m_creature->getVictim(),SPELL_PSYCHIC_WAIL, false);
|
||||
psychicwail_timer = 12000;
|
||||
}else psychicwail_timer -= diff;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -754,7 +753,6 @@ struct TRINITY_DLL_DECL boss_slitherAI : public boss_hexlord_addAI
|
||||
{
|
||||
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
|
||||
return;
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
|
||||
if (venomspit_timer < diff)
|
||||
{
|
||||
@@ -762,6 +760,8 @@ struct TRINITY_DLL_DECL boss_slitherAI : public boss_hexlord_addAI
|
||||
m_creature->CastSpell(victim,SPELL_VENOM_SPIT, false);
|
||||
venomspit_timer = 2500;
|
||||
}else venomspit_timer -= diff;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -786,14 +786,14 @@ struct TRINITY_DLL_DECL boss_fenstalkerAI : public boss_hexlord_addAI
|
||||
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
|
||||
return;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
|
||||
if (volatileinf_timer < diff)
|
||||
{
|
||||
// core bug
|
||||
m_creature->getVictim()->CastSpell(m_creature->getVictim(),SPELL_VOLATILE_INFECTION, false);
|
||||
volatileinf_timer = 12000;
|
||||
}else volatileinf_timer -= diff;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -822,8 +822,6 @@ struct TRINITY_DLL_DECL boss_koraggAI : public boss_hexlord_addAI
|
||||
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim() )
|
||||
return;
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
|
||||
if (mightyblow_timer < diff)
|
||||
{
|
||||
m_creature->CastSpell(m_creature->getVictim(),SPELL_MIGHTY_BLOW, false);
|
||||
@@ -835,6 +833,8 @@ struct TRINITY_DLL_DECL boss_koraggAI : public boss_hexlord_addAI
|
||||
m_creature->CastSpell(victim,SPELL_COLD_STARE, false);
|
||||
coldstare_timer = 12000;
|
||||
}
|
||||
|
||||
boss_hexlord_addAI::UpdateAI(diff);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user