TrinityCore
Loading...
Searching...
No Matches
MovementDefines.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITY_MOVEMENTDEFINES_H
19#define TRINITY_MOVEMENTDEFINES_H
20
21#include "Common.h"
22
23#define SPEED_CHARGE 42.0f // assume it is 25 yard per 0.6 second
24
25// EnumUtils: DESCRIBE THIS
27{
28 IDLE_MOTION_TYPE = 0, // IdleMovementGenerator.h
29 RANDOM_MOTION_TYPE = 1, // RandomMovementGenerator.h
30 WAYPOINT_MOTION_TYPE = 2, // WaypointMovementGenerator.h
31 MAX_DB_MOTION_TYPE = 3, // Below motion types can't be set in DB.
32 CONFUSED_MOTION_TYPE = 4, // ConfusedMovementGenerator.h
33 CHASE_MOTION_TYPE = 5, // ChaseMovementGenerator.h
34 HOME_MOTION_TYPE = 6, // HomeMovementGenerator.h
35 FLIGHT_MOTION_TYPE = 7, // FlightPathMovementGenerator.h
36 POINT_MOTION_TYPE = 8, // PointMovementGenerator.h
37 FLEEING_MOTION_TYPE = 9, // FleeingMovementGenerator.h
38 DISTRACT_MOTION_TYPE = 10, // IdleMovementGenerator.h
39 ASSISTANCE_MOTION_TYPE = 11, // PointMovementGenerator.h
40 ASSISTANCE_DISTRACT_MOTION_TYPE = 12, // IdleMovementGenerator.h
41 TIMED_FLEEING_MOTION_TYPE = 13, // FleeingMovementGenerator.h
42 FOLLOW_MOTION_TYPE = 14, // FollowMovementGenerator.h
43 ROTATE_MOTION_TYPE = 15, // IdleMovementGenerator.h
45 SPLINE_CHAIN_MOTION_TYPE = 17, // SplineChainMovementGenerator.h
46 FORMATION_MOTION_TYPE = 18, // FormationMovementGenerator.h
48 MAX_MOTION_TYPE // SKIP
49};
50
52{
53 // MovementGenerators that don't check Unit::IsMovementPreventedByCasting
54 switch (type)
55 {
58 case EFFECT_MOTION_TYPE: // knockbacks, jumps, falling, land/takeoff transitions
59 return false;
60 default:
61 break;
62 }
63 return true;
64}
65
72
79
85
87{
88 ChaseRange(float range);
89 ChaseRange(float _minRange, float _maxRange);
90 ChaseRange(float _minRange, float _minTolerance, float _maxTolerance, float _maxRange);
91
92 // this contains info that informs how we should path!
93 float MinRange; // we have to move if we are within this range... (min. attack range)
94 float MinTolerance; // ...and if we are, we will move this far away
95 float MaxRange; // we have to move if we are outside this range... (max. attack range)
96 float MaxTolerance; // ...and if we are, we will move into this range
97};
98
100{
101 ChaseAngle(float angle, float _tolerance = M_PI_4);
102
103 float RelativeAngle; // we want to be at this angle relative to the target (0 = front, M_PI = back)
104 float Tolerance; // but we'll tolerate anything within +- this much
105
106 float UpperBound() const;
107 float LowerBound() const;
108 bool IsAngleOkay(float relativeAngle) const;
109};
110
111inline bool IsInvalidMovementGeneratorType(uint8 const type) { return type == MAX_DB_MOTION_TYPE || type >= MAX_MOTION_TYPE; }
112inline bool IsInvalidMovementSlot(uint8 const slot) { return slot >= MAX_MOTION_SLOT; }
113
114#endif
#define M_PI_4
Definition Common.h:76
#define TC_GAME_API
Definition Define.h:114
uint8_t uint8
Definition Define.h:135
bool IsInvalidMovementSlot(uint8 const slot)
RotateDirection
@ ROTATE_DIRECTION_RIGHT
@ ROTATE_DIRECTION_LEFT
MovementGeneratorPriority
@ MOTION_PRIORITY_HIGHEST
@ MOTION_PRIORITY_NONE
@ MOTION_PRIORITY_NORMAL
MovementSlot
@ MOTION_SLOT_ACTIVE
@ MAX_MOTION_SLOT
@ MOTION_SLOT_DEFAULT
MovementGeneratorType
@ TIMED_FLEEING_MOTION_TYPE
@ MAX_DB_MOTION_TYPE
@ FORMATION_MOTION_TYPE
@ ASSISTANCE_MOTION_TYPE
@ DISTRACT_MOTION_TYPE
@ IDLE_MOTION_TYPE
@ CHASE_MOTION_TYPE
@ SPLINE_CHAIN_MOTION_TYPE
@ MAX_MOTION_TYPE
@ ROTATE_MOTION_TYPE
@ WAYPOINT_MOTION_TYPE
@ FACE_MOTION_TYPE
@ FLEEING_MOTION_TYPE
@ CONFUSED_MOTION_TYPE
@ HOME_MOTION_TYPE
@ POINT_MOTION_TYPE
@ FLIGHT_MOTION_TYPE
@ FOLLOW_MOTION_TYPE
@ RANDOM_MOTION_TYPE
@ ASSISTANCE_DISTRACT_MOTION_TYPE
@ EFFECT_MOTION_TYPE
constexpr bool CanStopMovementForSpellCasting(MovementGeneratorType type)
bool IsInvalidMovementGeneratorType(uint8 const type)