*Still use the old updatevictim functions for most scripts because some old scripts may cause crash using new function.
--HG-- branch : trunk
This commit is contained in:
@@ -202,7 +202,7 @@ struct TRINITY_DLL_DECL boss_gothikAI : public BossAI
|
|||||||
|
|
||||||
void UpdateAI(const uint32 diff)
|
void UpdateAI(const uint32 diff)
|
||||||
{
|
{
|
||||||
if(!UpdateVictim() || !CheckInRoom())
|
if(!UpdateCombatState() || !CheckInRoom())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
events.Update(diff);
|
events.Update(diff);
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ struct TRINITY_DLL_DECL boss_nothAI : public BossAI
|
|||||||
|
|
||||||
void UpdateAI(const uint32 diff)
|
void UpdateAI(const uint32 diff)
|
||||||
{
|
{
|
||||||
if(!UpdateVictim() || !CheckInRoom())
|
if(!UpdateCombatState() || !CheckInRoom())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
events.Update(diff);
|
events.Update(diff);
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI
|
|||||||
|
|
||||||
events.Update(diff);
|
events.Update(diff);
|
||||||
|
|
||||||
if(phase != PHASE_BIRTH && !UpdateVictim() || !CheckInRoom())
|
if(phase != PHASE_BIRTH && !UpdateCombatState() || !CheckInRoom())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(phase == PHASE_GROUND)
|
if(phase == PHASE_GROUND)
|
||||||
|
|||||||
@@ -145,6 +145,16 @@ bool CreatureAI::UpdateVictimWithGaze()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CreatureAI::UpdateVictim()
|
bool CreatureAI::UpdateVictim()
|
||||||
|
{
|
||||||
|
if(!me->isInCombat())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(Unit *victim = me->SelectVictim())
|
||||||
|
AttackStart(victim);
|
||||||
|
return me->getVictim();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CreatureAI::UpdateCombatState()
|
||||||
{
|
{
|
||||||
if(!me->isInCombat())
|
if(!me->isInCombat())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
|
|||||||
|
|
||||||
bool UpdateVictim();
|
bool UpdateVictim();
|
||||||
bool UpdateVictimWithGaze();
|
bool UpdateVictimWithGaze();
|
||||||
|
bool UpdateCombatState();
|
||||||
|
|
||||||
void SelectNearestTarget(Unit *who);
|
void SelectNearestTarget(Unit *who);
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user