Implement speed reduction at creatures DoFleeToGetAssistance, by NoFantasy.

--HG--
branch : trunk
This commit is contained in:
n0n4m3
2010-01-16 19:35:30 +03:00
parent ec10853f22
commit c9a3698a11
3 changed files with 21 additions and 5 deletions
+7 -1
View File
@@ -696,6 +696,8 @@ void Creature::DoFleeToGetAssistance()
cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap(), *this, radius); cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap(), *this, radius);
SetNoSearchAssistance(true); SetNoSearchAssistance(true);
UpdateSpeed(MOVE_RUN, false);
if(!pCreature) if(!pCreature)
//SetFeared(true, getVictim()->GetGUID(), 0 ,sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY)); //SetFeared(true, getVictim()->GetGUID(), 0 ,sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
//TODO: use 31365 //TODO: use 31365
@@ -1464,7 +1466,11 @@ void Creature::setDeathState(DeathState s)
if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) ) if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) )
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
SetNoSearchAssistance(false); if (HasSearchedAssistance())
{
SetNoSearchAssistance(false);
UpdateSpeed(MOVE_RUN, false);
}
//Dismiss group if is leader //Dismiss group if is leader
if(m_formation && m_formation->getLeader() == this) if(m_formation && m_formation->getLeader() == this)
+1 -3
View File
@@ -153,9 +153,7 @@ template<class T>
void void
TargetedMovementGenerator<T>::Initialize(T &owner) TargetedMovementGenerator<T>::Initialize(T &owner)
{ {
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->HasSearchedAssistance()) if (owner.isInCombat())
owner.AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
_setTargetLocation(owner); _setTargetLocation(owner);
+13 -1
View File
@@ -8927,7 +8927,12 @@ bool Unit::AttackStop()
if (GetTypeId() == TYPEID_UNIT) if (GetTypeId() == TYPEID_UNIT)
{ {
((Creature*)this)->SetNoCallAssistance(false); ((Creature*)this)->SetNoCallAssistance(false);
((Creature*)this)->SetNoSearchAssistance(false);
if (((Creature*)this)->HasSearchedAssistance())
{
((Creature*)this)->SetNoSearchAssistance(false);
UpdateSpeed(MOVE_RUN, false);
}
} }
SendMeleeAttackStop(victim); SendMeleeAttackStop(victim);
@@ -11714,6 +11719,13 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
break; break;
} }
// for creature case, we check explicit if mob searched for assistance
if (GetTypeId() == TYPEID_UNIT)
{
if (((Creature*)this)->HasSearchedAssistance())
speed *= 0.66f; // best guessed value, so this will be 33% reduction. Based off initial speed, mob can then "run", "walk fast" or "walk".
}
// Apply strongest slow aura mod to speed // Apply strongest slow aura mod to speed
int32 slow = GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED); int32 slow = GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED);
if (slow) if (slow)