From a57ca5cea2d13bc5d5ddee11e7b8100c7afd68e1 Mon Sep 17 00:00:00 2001 From: Sorikoff <46191832+Sorikoff@users.noreply.github.com> Date: Sun, 3 Mar 2019 18:54:07 +0000 Subject: Core/Movement: Allow using run when moving randomly (#23081) * Allow run when moving randomly (cherry picked from commit 34cfa69efd1857540f1f44b118086bb02334c100) --- src/server/game/Entities/Creature/Creature.cpp | 4 +++- src/server/game/Entities/Creature/CreatureData.h | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src/server/game/Entities/Creature') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 3f66428e474..10f15315e4a 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -61,13 +61,15 @@ std::string CreatureMovementData::ToString() const char const* const GroundStates[] = { "None", "Run", "Hover" }; char const* const FlightStates[] = { "None", "DisableGravity", "CanFly" }; char const* const ChaseStates[] = { "Run", "CanWalk", "AlwaysWalk" }; + char const* const RandomStates[] = { "Walk", "CanRun", "AlwaysRun" }; std::ostringstream str; str << std::boolalpha << "Ground: " << GroundStates[AsUnderlyingType(Ground)] << ", Swim: " << Swim << ", Flight: " << FlightStates[AsUnderlyingType(Flight)] - << ", Chase: " << ChaseStates[AsUnderlyingType(Chase)]; + << ", Chase: " << ChaseStates[AsUnderlyingType(Chase)] + << ", Random: " << RandomStates[AsUnderlyingType(Random)]; if (Rooted) str << ", Rooted"; diff --git a/src/server/game/Entities/Creature/CreatureData.h b/src/server/game/Entities/Creature/CreatureData.h index cfcfb6f1c23..572ccb62433 100644 --- a/src/server/game/Entities/Creature/CreatureData.h +++ b/src/server/game/Entities/Creature/CreatureData.h @@ -327,16 +327,27 @@ enum class CreatureChaseMovementType : uint8 Max }; +enum class CreatureRandomMovementType : uint8 +{ + Walk, + CanRun, + AlwaysRun, + + Max +}; + struct TC_GAME_API CreatureMovementData { CreatureMovementData() : Ground(CreatureGroundMovementType::Run), Flight(CreatureFlightMovementType::None), - Swim(true), Rooted(false), Chase(CreatureChaseMovementType::Run) { } + Swim(true), Rooted(false), Chase(CreatureChaseMovementType::Run), + Random(CreatureRandomMovementType::Walk) { } CreatureGroundMovementType Ground; CreatureFlightMovementType Flight; bool Swim; bool Rooted; CreatureChaseMovementType Chase; + CreatureRandomMovementType Random; bool IsGroundAllowed() const { return Ground != CreatureGroundMovementType::None; } bool IsSwimAllowed() const { return Swim; } @@ -344,6 +355,7 @@ struct TC_GAME_API CreatureMovementData bool IsRooted() const { return Rooted; } CreatureChaseMovementType GetChase() const { return Chase; } + CreatureRandomMovementType GetRandom() const { return Random; } std::string ToString() const; }; -- cgit v1.2.3