Well, keep in mind that there are three years between the Triwizard Tournament and the Battle of Hogwarts. (And keep in mind that we don’t get to see any of those three years, which is my big complaint—the play feels very rushed after a vast, seven-book cycle.) I can see someone working on Cedric, poisoning his mind…