At the Battle of Hogwarts we see the usually pompous and humorless Percy quipping and fighting like a duelist to everyone (and especially Fred's) surprise:
“Hello, Minister!” bellowed Percy, sending a neat jinx straight at Thicknesse, who dropped his wand and clawed at the front of his robes, apparently in awful discomfort. “Did I mention I’m resigning?”
“You’re joking, Perce!” shouted Fred as the Death Eater he was battling collapsed under the weight of three separate Stunning Spells. Thicknesse had fallen to the ground with tiny spikes erupting all over him; he seemed to be turning into some form of sea urchin. Fred looked at Percy with glee.
“You actually are joking, Perce… I don’t think I’ve heard you joke since you were—”
~Harry Potter and the Deathly Hallows, Chapter 31 - The Battle of Hogwarts
If I am not mistaken, this is the first joke ever we hear from Percy.
What is the reason for the atypical behaviour of this character?