If Mr. X is Alan's father?
Why is he being so cruel to Alan?
Well, life itself is a cruel thing - people die from it. Everything that doesn't kill us makes us stronger. Better the bitter truth than the sweet lie. The later Alan finds out the truth, the worse it will be for him.
Therefore, Mr. X (if he is Alan's father) complicates the conditions for completing the task for the "heroes" so that they show their "true self" in all its beauty.

I think so...
evaluate your friends by their actions, not by their words...