1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_MOVEMENTDEFINES_H
#define TRINITY_MOVEMENTDEFINES_H
#include "Common.h"
#include "ObjectGuid.h"
#include "Optional.h"
#include "Position.h"
#include <variant>
class Unit;
#define SPEED_CHARGE 42.0f // assume it is 25 yard per 0.6 second
// EnumUtils: DESCRIBE THIS
enum MovementGeneratorType : uint8
{
IDLE_MOTION_TYPE = 0, // IdleMovementGenerator.h
RANDOM_MOTION_TYPE = 1, // RandomMovementGenerator.h
WAYPOINT_MOTION_TYPE = 2, // WaypointMovementGenerator.h
MAX_DB_MOTION_TYPE = 3, // Below motion types can't be set in DB.
CONFUSED_MOTION_TYPE = 4, // ConfusedMovementGenerator.h
CHASE_MOTION_TYPE = 5, // ChaseMovementGenerator.h
HOME_MOTION_TYPE = 6, // HomeMovementGenerator.h
FLIGHT_MOTION_TYPE = 7, // FlightPathMovementGenerator.h
POINT_MOTION_TYPE = 8, // PointMovementGenerator.h
FLEEING_MOTION_TYPE = 9, // FleeingMovementGenerator.h
DISTRACT_MOTION_TYPE = 10, // IdleMovementGenerator.h
ASSISTANCE_MOTION_TYPE = 11, // PointMovementGenerator.h
ASSISTANCE_DISTRACT_MOTION_TYPE = 12, // IdleMovementGenerator.h
TIMED_FLEEING_MOTION_TYPE = 13, // FleeingMovementGenerator.h
FOLLOW_MOTION_TYPE = 14, // FollowMovementGenerator.h
ROTATE_MOTION_TYPE = 15, // IdleMovementGenerator.h
EFFECT_MOTION_TYPE = 16,
SPLINE_CHAIN_MOTION_TYPE = 17, // SplineChainMovementGenerator.h
FORMATION_MOTION_TYPE = 18, // FormationMovementGenerator.h
MAX_MOTION_TYPE // SKIP
};
constexpr bool CanStopMovementForSpellCasting(MovementGeneratorType type)
{
// MovementGenerators that don't check Unit::IsMovementPreventedByCasting
switch (type)
{
case HOME_MOTION_TYPE:
case FLIGHT_MOTION_TYPE:
case EFFECT_MOTION_TYPE: // knockbacks, jumps, falling, land/takeoff transitions
return false;
default:
break;
}
return true;
}
enum MovementGeneratorMode : uint8
{
MOTION_MODE_DEFAULT = 0,
MOTION_MODE_OVERRIDE
};
enum MovementGeneratorPriority : uint8
{
MOTION_PRIORITY_NONE = 0,
MOTION_PRIORITY_NORMAL,
MOTION_PRIORITY_HIGHEST
};
enum MovementSlot : uint8
{
MOTION_SLOT_DEFAULT = 0,
MOTION_SLOT_ACTIVE,
MAX_MOTION_SLOT
};
enum class MovementWalkRunSpeedSelectionMode
{
Default,
ForceRun,
ForceWalk
};
enum class MovementStopReason : uint8
{
Finished, // Movement finished either by arriving at location or successfully continuing it for requested duration
Interrupted
};
enum RotateDirection : uint8
{
ROTATE_DIRECTION_LEFT = 0,
ROTATE_DIRECTION_RIGHT
};
struct TC_GAME_API ChaseRange
{
ChaseRange(float range);
ChaseRange(float _minRange, float _maxRange);
ChaseRange(float _minRange, float _minTolerance, float _maxTolerance, float _maxRange);
// this contains info that informs how we should path!
float MinRange; // we have to move if we are within this range... (min. attack range)
float MinTolerance; // ...and if we are, we will move this far away
float MaxRange; // we have to move if we are outside this range... (max. attack range)
float MaxTolerance; // ...and if we are, we will move into this range
};
struct TC_GAME_API ChaseAngle
{
ChaseAngle(float angle, float _tolerance = M_PI_4);
float RelativeAngle; // we want to be at this angle relative to the target (0 = front, M_PI = back)
float Tolerance; // but we'll tolerate anything within +- this much
float UpperBound() const;
float LowerBound() const;
bool IsAngleOkay(float relativeAngle) const;
};
struct JumpArrivalCastArgs
{
uint32 SpellId = 0;
ObjectGuid Target;
};
struct JumpChargeParams
{
union
{
float Speed;
float MoveTimeInSec;
};
bool TreatSpeedAsMoveTimeSeconds = false;
float JumpGravity = 0.0f;
Optional<uint32> SpellVisualId;
Optional<uint32> ProgressCurveId;
Optional<uint32> ParabolicCurveId;
Optional<uint32> TriggerSpellId;
};
using MovementFacingTarget = std::variant<std::monostate, Position, Unit const*, float>;
inline bool IsInvalidMovementGeneratorType(uint8 const type) { return type == MAX_DB_MOTION_TYPE || type >= MAX_MOTION_TYPE; }
inline bool IsInvalidMovementSlot(uint8 const slot) { return slot >= MAX_MOTION_SLOT; }
#endif
|