mirror of
https://github.com/azerothcore/azerothcore-wotlk.git
synced 2025-11-10 20:54:15 +08:00
Merge 7ba22c44c3c4ef2154174a94731abce801445529 into fca2e120564ccebe77c1a820a9df22e6f24a0308
This commit is contained in:
commit
dbb3d3110f
@ -2706,7 +2706,6 @@ void Spell::EffectDistract(SpellEffIndex /*effIndex*/)
|
||||
if (unitTarget->HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING))
|
||||
return;
|
||||
|
||||
unitTarget->SetFacingTo(unitTarget->GetAngle(destTarget)); /// @BUG Causes the player to stop moving.
|
||||
unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,10 @@ CollectSourceFiles(
|
||||
PRIVATE_SOURCES
|
||||
)
|
||||
|
||||
list(APPEND PRIVATE_SOURCES
|
||||
"server/game/Spells/SpellEffectsTest.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
"mocks"
|
||||
)
|
||||
|
||||
45
src/test/server/game/Spells/SpellEffectsTest.cpp
Normal file
45
src/test/server/game/Spells/SpellEffectsTest.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of the AzerothCore 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 Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 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 Affero 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/>.
|
||||
*/
|
||||
|
||||
#include "Mocks/WorldMock.h"
|
||||
#include "Player.h"
|
||||
#include "Spell.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
TEST(SpellEffectsTest, DistractDoesNotStopMovement)
|
||||
{
|
||||
WorldMock world;
|
||||
Player* player = new Player(nullptr);
|
||||
player->Create(sObjectMgr->GenerateLowGuid<HighGuid::Player>(), nullptr);
|
||||
|
||||
Unit* target = new Unit(false);
|
||||
target->Create(sObjectMgr->GenerateLowGuid<HighGuid::Unit>(), nullptr, 0, 0);
|
||||
|
||||
target->GetMotionMaster()->MovePoint(1, 10.0f, 10.0f, 10.0f);
|
||||
|
||||
// Verify that the target is moving and the stack size is 1
|
||||
ASSERT_EQ(target->GetMotionMaster()->size(), 1);
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(1725); // Distract
|
||||
Spell* spell = new Spell(player, spellInfo, TriggerCastFlags(TRIGGERED_NONE));
|
||||
spell->m_targets.SetUnitTarget(target);
|
||||
|
||||
spell->EffectDistract(EFFECT_0);
|
||||
|
||||
// Verify that the movement stack size is now 2, meaning the original movement was not cleared
|
||||
EXPECT_EQ(target->GetMotionMaster()->size(), 2);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user