diff --git a/src/strategy/actions/MovementActions.cpp b/src/strategy/actions/MovementActions.cpp index ebb10b45..aafa7241 100644 --- a/src/strategy/actions/MovementActions.cpp +++ b/src/strategy/actions/MovementActions.cpp @@ -146,8 +146,14 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, // if (bot->Unit::IsFalling()) { // bot->Say("I'm falling", LANG_UNIVERSAL); // } - z += 2.0f; - bot->UpdateAllowedPositionZ(x, y, z); + float modified_z = z + 0.5f; + bot->UpdateAllowedPositionZ(x, y, modified_z); + // prevent falling when bot on slope + if (modified_z < z - 20.0f) { + modified_z = z + 5.0f; + bot->UpdateAllowedPositionZ(x, y, modified_z); + } + z = modified_z; // z += 0.5f; float distance = bot->GetDistance2d(x, y); if (distance > sPlayerbotAIConfig->contactDistance) @@ -164,7 +170,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, } bool generatePath = !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && - !bot->IsFlying() && !bot->isSwimming(); + !bot->IsFlying() && !bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) && !bot->IsInWater(); MotionMaster &mm = *bot->GetMotionMaster(); mm.Clear(); mm.MovePoint(mapId, x, y, z, generatePath); @@ -758,13 +764,11 @@ void MovementAction::UpdateMovementState() { if (bot->Unit::IsInWater() || bot->Unit::IsUnderWater()) { - bot->m_movementInfo.AddMovementFlag(MOVEMENTFLAG_SWIMMING); - bot->UpdateSpeed(MOVE_SWIM, true); + bot->SetSwim(true); } else { - bot->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_SWIMMING); - bot->UpdateSpeed(MOVE_SWIM, true); + bot->SetSwim(false); } if (bot->IsFlying()) diff --git a/src/strategy/values/Arrow.cpp b/src/strategy/values/Arrow.cpp index 22cbf619..e51752f9 100644 --- a/src/strategy/values/Arrow.cpp +++ b/src/strategy/values/Arrow.cpp @@ -43,7 +43,7 @@ WorldLocation ArrowFormation::GetLocationInternal() float x = master->GetPositionX() - masterUnit->GetX() + botUnit->GetX(); float y = master->GetPositionY() - masterUnit->GetY() + botUnit->GetY(); - float z = master->GetPositionZ() + 5.0f; + float z = master->GetPositionZ(); float ground = master->GetMap()->GetHeight(x, y, z + 0.5f); if (ground <= INVALID_HEIGHT)