Core/Movement: Replace old TargetedMovementGenerator into ChaseMovementGenerator and FollowMovementGenerator, full rewrite for both.

- Chase to angle is now functional. Pets use this to chase behind the target. Closes #19925.
- Chase to arbitrary range interval works. Not used anywhere, but you can technically make hunter-like mobs.
- Pets now follow the hunter cleanly and without stutter stepping. Also fix some other things. Closes #8924.
This commit is contained in:
Treeston
2018-04-06 18:09:55 +02:00
committed by GitHub
parent 9f03743d2d
commit 2a84562dc8
28 changed files with 700 additions and 768 deletions

View File

@@ -20,9 +20,11 @@
#include "ArenaTeamMgr.h"
#include "CellImpl.h"
#include "CharacterCache.h"
#include "ChaseMovementGenerator.h"
#include "Chat.h"
#include "DatabaseEnv.h"
#include "DisableMgr.h"
#include "FollowMovementGenerator.h"
#include "GridNotifiers.h"
#include "Group.h"
#include "GroupMgr.h"
@@ -43,7 +45,6 @@
#include "SpellAuras.h"
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "TargetedMovementGenerator.h"
#include "Transport.h"
#include "Weather.h"
#include "WeatherMgr.h"
@@ -2164,11 +2165,7 @@ public:
break;
case CHASE_MOTION_TYPE:
{
Unit* target = nullptr;
if (unit->GetTypeId() == TYPEID_PLAYER)
target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
else
target = static_cast<ChaseMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
Unit* target = static_cast<ChaseMovementGenerator const*>(movementGenerator)->GetTarget();
if (!target)
handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
@@ -2180,11 +2177,7 @@ public:
}
case FOLLOW_MOTION_TYPE:
{
Unit* target = nullptr;
if (unit->GetTypeId() == TYPEID_PLAYER)
target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
else
target = static_cast<FollowMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
Unit* target = static_cast<FollowMovementGenerator const*>(movementGenerator)->GetTarget();
if (!target)
handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);

View File

@@ -34,7 +34,6 @@
#include "Player.h"
#include "PointMovementGenerator.h"
#include "RBAC.h"
#include "TargetedMovementGenerator.h"
class mmaps_commandscript : public CommandScript
{

View File

@@ -27,6 +27,7 @@ EndScriptData */
#include "CreatureAI.h"
#include "CreatureGroups.h"
#include "DatabaseEnv.h"
#include "FollowMovementGenerator.h"
#include "GameTime.h"
#include "Language.h"
#include "Log.h"
@@ -36,7 +37,6 @@ EndScriptData */
#include "Pet.h"
#include "Player.h"
#include "RBAC.h"
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
#include "Transport.h"
#include "World.h"
#include "WorldSession.h"
@@ -1309,7 +1309,7 @@ public:
return false;
}
FollowMovementGenerator<Creature> const* mgen = static_cast<FollowMovementGenerator<Creature> const*>((creature->GetMotionMaster()->top()));
FollowMovementGenerator const* mgen = static_cast<FollowMovementGenerator const*>((creature->GetMotionMaster()->top()));
if (mgen->GetTarget() != player)
{

View File

@@ -549,7 +549,7 @@ public:
if (ShadowBolt_Timer <= diff)
{
if (!me->IsWithinDist(me->GetVictim(), 45.0f))
me->GetMotionMaster()->MoveChase(me->GetVictim(), VEKLOR_DIST, 0);
me->GetMotionMaster()->MoveChase(me->GetVictim(), VEKLOR_DIST);
else
DoCastVictim(SPELL_SHADOWBOLT);
ShadowBolt_Timer = 2000;
@@ -599,7 +599,7 @@ public:
// VL doesn't melee
if (me->Attack(who, false))
{
me->GetMotionMaster()->MoveChase(who, VEKLOR_DIST, 0);
me->GetMotionMaster()->MoveChase(who, VEKLOR_DIST);
AddThreat(who, 0.0f);
}
}