diff options
author | megamage <none@none> | 2009-09-02 12:46:26 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-09-02 12:46:26 -0500 |
commit | 8efb15c52a7e79c4f312b643ec7933e608effe47 (patch) | |
tree | fed7753924bf0a7225b665f7deb1a14c7c4ea1f5 /src | |
parent | c150629f8d9ef38a25e939354b931098517874cc (diff) |
*Try to fix the bug that creature does not regenerate after evade.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Creature.cpp | 5 | ||||
-rw-r--r-- | src/game/Creature.h | 2 | ||||
-rw-r--r-- | src/game/GridNotifiersImpl.h | 12 | ||||
-rw-r--r-- | src/game/HomeMovementGenerator.cpp | 2 | ||||
-rw-r--r-- | src/game/Unit.cpp | 2 | ||||
-rw-r--r-- | src/game/Unit.h | 3 |
6 files changed, 9 insertions, 17 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 47515638490..9479c628f13 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -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; diff --git a/src/game/Creature.h b/src/game/Creature.h index 6991e598d2b..63baee1799b 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -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(); diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h index 23b781cab4c..d9e27cc8bcc 100644 --- a/src/game/GridNotifiersImpl.h +++ b/src/game/GridNotifiersImpl.h @@ -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> diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp index 805b4d51a3a..e2fc9b1e0ec 100644 --- a/src/game/HomeMovementGenerator.cpp +++ b/src/game/HomeMovementGenerator.cpp @@ -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; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e46f9ed9b55..e175896ca48 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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); diff --git a/src/game/Unit.h b/src/game/Unit.h index 2a35fe6551c..7f1161e4c49 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -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) |