mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 20:52:22 -04:00
*Try to fix the bug that creature does not regenerate after evade.
--HG-- branch : trunk
This commit is contained in:
@@ -2394,11 +2394,6 @@ bool Creature::HasSpellCooldown(uint32 spell_id) const
|
||||
return (itr != m_CreatureSpellCooldowns.end() && itr->second > time(NULL)) || HasCategoryCooldown(spell_id);
|
||||
}
|
||||
|
||||
bool Creature::IsInEvadeMode() const
|
||||
{
|
||||
return /*!i_motionMaster.empty() &&*/ i_motionMaster.GetCurrentMovementGeneratorType() == HOME_MOTION_TYPE;
|
||||
}
|
||||
|
||||
bool Creature::HasSpell(uint32 spellID) const
|
||||
{
|
||||
uint8 i;
|
||||
|
||||
@@ -529,7 +529,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
|
||||
|
||||
uint32 getLevelForTarget(Unit const* target) const; // overwrite Unit::getLevelForTarget for boss level support
|
||||
|
||||
bool IsInEvadeMode() const;
|
||||
bool IsInEvadeMode() const { return hasUnitState(UNIT_STAT_EVADE); }
|
||||
|
||||
bool AIM_Initialize(CreatureAI* ai = NULL);
|
||||
void Motion_Initialize();
|
||||
|
||||
@@ -44,25 +44,19 @@ inline void PlayerCreatureRelocationWorker(Player* pl, Creature* c)
|
||||
|
||||
// Creature AI reaction
|
||||
if(c->HasReactState(REACT_AGGRESSIVE) && !c->hasUnitState(UNIT_STAT_SIGHTLESS))
|
||||
{
|
||||
if( c->IsAIEnabled && c->_IsWithinDist(pl, c->m_SightDistance, true) && !c->IsInEvadeMode() )
|
||||
if(c->_IsWithinDist(pl, c->m_SightDistance, true) && c->IsAIEnabled)
|
||||
c->AI()->MoveInLineOfSight(pl);
|
||||
}
|
||||
}
|
||||
|
||||
inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2)
|
||||
{
|
||||
if(c1->HasReactState(REACT_AGGRESSIVE) && !c1->hasUnitState(UNIT_STAT_SIGHTLESS))
|
||||
{
|
||||
if( c1->IsAIEnabled && c1->_IsWithinDist(c2, c1->m_SightDistance, true) && !c1->IsInEvadeMode() )
|
||||
if(c1->_IsWithinDist(c2, c1->m_SightDistance, true) && c1->IsAIEnabled)
|
||||
c1->AI()->MoveInLineOfSight(c2);
|
||||
}
|
||||
|
||||
if(c2->HasReactState(REACT_AGGRESSIVE) && !c2->hasUnitState(UNIT_STAT_SIGHTLESS))
|
||||
{
|
||||
if( c2->IsAIEnabled && c1->_IsWithinDist(c2, c2->m_SightDistance, true) && !c2->IsInEvadeMode() )
|
||||
if(c1->_IsWithinDist(c2, c2->m_SightDistance, true) && c2->IsAIEnabled)
|
||||
c2->AI()->MoveInLineOfSight(c1);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -31,6 +31,7 @@ HomeMovementGenerator<Creature>::Initialize(Creature & owner)
|
||||
float x, y, z;
|
||||
owner.GetHomePosition(x, y, z, ori);
|
||||
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
|
||||
owner.addUnitState(UNIT_STAT_EVADE);
|
||||
_setTargetLocation(owner);
|
||||
}
|
||||
|
||||
@@ -78,6 +79,7 @@ HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff
|
||||
owner.SendMessageToSet(&packet, false);
|
||||
}
|
||||
|
||||
owner.clearUnitState(UNIT_STAT_EVADE);
|
||||
owner.AI()->JustReachedHome();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10509,7 +10509,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
||||
if(PvP)
|
||||
m_CombatTimer = 5000;
|
||||
|
||||
if(isInCombat())
|
||||
if(isInCombat() || hasUnitState(UNIT_STAT_EVADE))
|
||||
return;
|
||||
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
|
||||
|
||||
@@ -455,11 +455,12 @@ enum UnitState
|
||||
UNIT_STAT_ONVEHICLE = 0x00080000,
|
||||
UNIT_STAT_MOVE = 0x00100000,
|
||||
UNIT_STAT_ROTATING = 0x00200000,
|
||||
UNIT_STAT_EVADE = 0x00400000,
|
||||
UNIT_STAT_UNATTACKABLE = (UNIT_STAT_IN_FLIGHT | UNIT_STAT_ONVEHICLE),
|
||||
UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE),
|
||||
UNIT_STAT_CONTROLLED = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING),
|
||||
UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONTROLLED | UNIT_STAT_JUMPING | UNIT_STAT_CHARGING),
|
||||
UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL),
|
||||
UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_EVADE),
|
||||
UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING),
|
||||
UNIT_STAT_CANNOT_TURN = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_ROTATING),
|
||||
UNIT_STAT_ALL_STATE = 0xffffffff //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT)
|
||||
|
||||
Reference in New Issue
Block a user