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:
@@ -176,13 +176,7 @@ namespace VMAP
|
|||||||
// direction with length of 1
|
// direction with length of 1
|
||||||
G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pos1, (pos2 - pos1) / maxDist);
|
G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pos1, (pos2 - pos1) / maxDist);
|
||||||
|
|
||||||
if (GetIntersectionTime(ray, maxDist, true, ignoreFlags))
|
return !GetIntersectionTime(ray, maxDist, true, ignoreFlags);
|
||||||
{
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
//=========================================================
|
//=========================================================
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1412,16 +1412,16 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
|||||||
uint32 mapid = m_caster->GetMapId();
|
uint32 mapid = m_caster->GetMapId();
|
||||||
uint32 phasemask = m_caster->GetPhaseMask();
|
uint32 phasemask = m_caster->GetPhaseMask();
|
||||||
float collisionHeight = m_caster->GetCollisionHeight();
|
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 pos;
|
||||||
Position lastpos;
|
Position lastpos;
|
||||||
m_caster->GetPosition(startx, starty, startz, starto);
|
m_caster->GetPosition(startx, starty, startz, starto);
|
||||||
pos.Relocate(startx, starty, startz, starto);
|
pos.Relocate(startx, starty, startz, starto);
|
||||||
destx = pos.GetPositionX() + distance * cos(pos.GetOrientation());
|
float destx = pos.GetPositionX() + distance * cos(pos.GetOrientation());
|
||||||
desty = pos.GetPositionY() + distance * sin(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();
|
bool isCasterInWater = m_caster->IsInWater();
|
||||||
if (!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) || (pos.GetPositionZ() - ground < distance))
|
if (!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) || (pos.GetPositionZ() - ground < distance))
|
||||||
@@ -1586,6 +1586,15 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
|||||||
destz = prevZ;
|
destz = prevZ;
|
||||||
//LOG_ERROR("spells", "(collision) destZ rewrited in 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;
|
break;
|
||||||
}
|
}
|
||||||
// we have correct destz now
|
// we have correct destz now
|
||||||
@@ -1597,9 +1606,9 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
float z = pos.GetPositionZ();
|
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
|
// 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
|
// collision occured
|
||||||
if (col || dcol)
|
if (col || dcol)
|
||||||
|
|||||||
Reference in New Issue
Block a user