mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
fix(Core/Spell): Stop Blink from the falling player to move upward by 1y and stop moving backward when facing a wall (#16657)
* blink-bad-warps * Change formatting of an if
This commit is contained in:
@@ -1412,16 +1412,16 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
uint32 mapid = m_caster->GetMapId();
|
||||
uint32 phasemask = m_caster->GetPhaseMask();
|
||||
float collisionHeight = m_caster->GetCollisionHeight();
|
||||
float destx = 0.0f, desty = 0.0f, destz = 0.0f, ground = 0.0f, startx = 0.0f, starty = 0.0f, startz = 0.0f, starto = 0.0f;
|
||||
float destz = 0.0f, startx = 0.0f, starty = 0.0f, startz = 0.0f, starto = 0.0f;
|
||||
|
||||
Position pos;
|
||||
Position lastpos;
|
||||
m_caster->GetPosition(startx, starty, startz, starto);
|
||||
pos.Relocate(startx, starty, startz, starto);
|
||||
destx = pos.GetPositionX() + distance * cos(pos.GetOrientation());
|
||||
desty = pos.GetPositionY() + distance * sin(pos.GetOrientation());
|
||||
float destx = pos.GetPositionX() + distance * cos(pos.GetOrientation());
|
||||
float desty = pos.GetPositionY() + distance * sin(pos.GetOrientation());
|
||||
|
||||
ground = map->GetHeight(phasemask, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
|
||||
float ground = map->GetHeight(phasemask, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
|
||||
|
||||
bool isCasterInWater = m_caster->IsInWater();
|
||||
if (!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) || (pos.GetPositionZ() - ground < distance))
|
||||
@@ -1586,6 +1586,15 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
destz = prevZ;
|
||||
//LOG_ERROR("spells", "(collision) destZ rewrited in prevZ");
|
||||
|
||||
// Don't make the player move backward from the xy adjustments by collisions.
|
||||
if ((DELTA_X > 0 && startx > destx) || (DELTA_X < 0 && startx < destx) ||
|
||||
(DELTA_Y > 0 && starty > desty) || (DELTA_Y < 0 && starty < desty))
|
||||
{
|
||||
destx = startx;
|
||||
desty = starty;
|
||||
destz = startz;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// we have correct destz now
|
||||
@@ -1597,9 +1606,9 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
else
|
||||
{
|
||||
float z = pos.GetPositionZ();
|
||||
bool col = VMAP::VMapFactory::createOrGetVMapMgr()->GetObjectHitPos(mapid, pos.GetPositionX(), pos.GetPositionY(), z + 0.5f, destx, desty, z + 0.5f, destx, desty, z, -0.5f);
|
||||
bool col = VMAP::VMapFactory::createOrGetVMapMgr()->GetObjectHitPos(mapid, pos.GetPositionX(), pos.GetPositionY(), z, destx, desty, z, destx, desty, z, -0.5f);
|
||||
// check dynamic collision
|
||||
bool dcol = m_caster->GetMap()->GetObjectHitPos(phasemask, pos.GetPositionX(), pos.GetPositionY(), z + 0.5f, destx, desty, z + 0.5f, destx, desty, z, -0.5f);
|
||||
bool dcol = m_caster->GetMap()->GetObjectHitPos(phasemask, pos.GetPositionX(), pos.GetPositionY(), z, destx, desty, z, destx, desty, z, -0.5f);
|
||||
|
||||
// collision occured
|
||||
if (col || dcol)
|
||||
|
||||
Reference in New Issue
Block a user