TrinityCore
Loading...
Searching...
No Matches
FleeingMovementGenerator.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_FLEEINGMOVEMENTGENERATOR_H
19#define TRINITY_FLEEINGMOVEMENTGENERATOR_H
20
21#include "MovementGenerator.h"
22#include "ObjectGuid.h"
23#include "Timer.h"
24
25class Creature;
26class PathGenerator;
27struct Position;
28
29template<class T>
30class FleeingMovementGenerator : public MovementGeneratorMedium<T, FleeingMovementGenerator<T>>
31{
32 public:
33 explicit FleeingMovementGenerator(ObjectGuid fleeTargetGUID);
34
36
37 bool DoInitialize(T*);
38 bool DoReset(T*);
39 bool DoUpdate(T*, uint32);
40 void DoDeactivate(T*);
41 void DoFinalize(T*, bool, bool);
42
44
45 private:
46 void SetTargetLocation(T*);
47 void GetPoint(T*, Position& position);
48
49 std::unique_ptr<PathGenerator> _path;
52};
53
55{
56 public:
57 explicit TimedFleeingMovementGenerator(ObjectGuid fleeTargetGUID, uint32 time) : FleeingMovementGenerator<Creature>(fleeTargetGUID), _totalFleeTime(time) { }
58
59 bool Update(Unit*, uint32) override;
60 void Finalize(Unit*, bool, bool) override;
62
63 private:
65};
66
67#endif
uint32_t uint32
Definition Define.h:133
MovementGeneratorType
@ MOVEMENTGENERATOR_FLAG_SPEED_UPDATE_PENDING
std::unique_ptr< PathGenerator > _path
void GetPoint(T *, Position &position)
MovementGeneratorType GetMovementGeneratorType() const override
void AddFlag(uint16 const flag)
TimedFleeingMovementGenerator(ObjectGuid fleeTargetGUID, uint32 time)
bool Update(Unit *, uint32) override
MovementGeneratorType GetMovementGeneratorType() const override
void Finalize(Unit *, bool, bool) override
Definition Unit.h:769