mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Fix fleeing speed to 66% run speed
This commit is contained in:
committed by
Ovahlord
parent
6bb1623464
commit
ccb00b971b
@@ -903,7 +903,6 @@ void Creature::DoFleeToGetAssistance()
|
||||
Cell::VisitGridObjects(this, searcher, radius);
|
||||
|
||||
SetNoSearchAssistance(true);
|
||||
UpdateSpeed(MOVE_RUN);
|
||||
|
||||
if (!creature)
|
||||
//SetFeared(true, EnsureVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
|
||||
@@ -1865,11 +1864,7 @@ void Creature::setDeathState(DeathState s)
|
||||
|
||||
setActive(false);
|
||||
|
||||
if (HasSearchedAssistance())
|
||||
{
|
||||
SetNoSearchAssistance(false);
|
||||
UpdateSpeed(MOVE_RUN);
|
||||
}
|
||||
SetNoSearchAssistance(false);
|
||||
|
||||
//Dismiss group if is leader
|
||||
if (m_formation && m_formation->getLeader() == this)
|
||||
|
||||
@@ -5773,16 +5773,8 @@ bool Unit::AttackStop()
|
||||
|
||||
// reset only at real combat stop
|
||||
if (Creature* creature = ToCreature())
|
||||
{
|
||||
creature->SetNoCallAssistance(false);
|
||||
|
||||
if (creature->HasSearchedAssistance())
|
||||
{
|
||||
creature->SetNoSearchAssistance(false);
|
||||
UpdateSpeed(MOVE_RUN);
|
||||
}
|
||||
}
|
||||
|
||||
SendMeleeAttackStop(victim);
|
||||
|
||||
return true;
|
||||
@@ -9013,10 +9005,6 @@ void Unit::UpdateSpeed(UnitMoveType mtype)
|
||||
|
||||
if (Creature* creature = ToCreature())
|
||||
{
|
||||
// for creature case, we check explicit if mob searched for assistance
|
||||
if (creature->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".
|
||||
|
||||
if (creature->HasUnitTypeMask(UNIT_MASK_MINION) && !creature->IsInCombat())
|
||||
{
|
||||
MovementGenerator* top = creature->GetMotionMaster()->topOrNull();
|
||||
|
||||
@@ -601,13 +601,14 @@ void MotionMaster::MoveFall(uint32 id /*=0*/)
|
||||
|
||||
void MotionMaster::MoveSeekAssistance(float x, float y, float z)
|
||||
{
|
||||
if (_owner->GetTypeId() == TYPEID_UNIT)
|
||||
if (Creature* creature = _owner->ToCreature())
|
||||
{
|
||||
TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveSeekAssistance: '%s', seeks assistance (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), x, y, z);
|
||||
_owner->AttackStop();
|
||||
_owner->CastStop();
|
||||
_owner->ToCreature()->SetReactState(REACT_PASSIVE);
|
||||
Mutate(new AssistanceMovementGenerator(x, y, z, _owner->GetSpeed(MOVE_RUN) * 0.66f), MOTION_SLOT_ACTIVE);
|
||||
TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveSeekAssistance: '%s', seeks assistance (X: %f, Y: %f, Z: %f)", creature->GetGUID().ToString().c_str(), x, y, z);
|
||||
creature->AttackStop();
|
||||
creature->CastStop();
|
||||
creature->DoNotReacquireSpellFocusTarget();
|
||||
creature->SetReactState(REACT_PASSIVE);
|
||||
Mutate(new AssistanceMovementGenerator(x, y, z), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
else
|
||||
TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveSeekAssistance: '%s', attempted to seek assistance.", _owner->GetGUID().ToString().c_str());
|
||||
|
||||
@@ -70,6 +70,7 @@ void HomeMovementGenerator<T>::DoInitialize(T*) { }
|
||||
template<>
|
||||
void HomeMovementGenerator<Creature>::DoInitialize(Creature* owner)
|
||||
{
|
||||
owner->SetNoSearchAssistance(false);
|
||||
SetTargetLocation(owner);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG
|
||||
class AssistanceMovementGenerator : public PointMovementGenerator<Creature>
|
||||
{
|
||||
public:
|
||||
AssistanceMovementGenerator(float _x, float _y, float _z, float speed = 0.0f) : PointMovementGenerator<Creature>(0, _x, _y, _z, true, speed) { }
|
||||
AssistanceMovementGenerator(float _x, float _y, float _z) : PointMovementGenerator<Creature>(0, _x, _y, _z, true) { }
|
||||
|
||||
MovementGeneratorType GetMovementGeneratorType() const override { return ASSISTANCE_MOTION_TYPE; }
|
||||
void Finalize(Unit*) override;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "MoveSplineInit.h"
|
||||
#include "MoveSpline.h"
|
||||
#include "MovementPacketBuilder.h"
|
||||
#include "Creature.h"
|
||||
#include "Unit.h"
|
||||
#include "PathGenerator.h"
|
||||
#include "Transport.h"
|
||||
@@ -108,6 +109,9 @@ namespace Movement
|
||||
moveFlagsForSpeed &= ~MOVEMENTFLAG_WALKING;
|
||||
|
||||
args.velocity = unit->GetSpeed(SelectSpeedType(moveFlagsForSpeed));
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
if (creature->HasSearchedAssistance())
|
||||
args.velocity *= 0.66f;
|
||||
}
|
||||
|
||||
if (!args.Validate(unit))
|
||||
|
||||
Reference in New Issue
Block a user