Curse of the Golden Flower

This article's plot summary may be too long or excessively detailed. Please help improve it by removing unnecessary details and making it more concise. (October 2015) (Learn how and when to remove this template message)
Golden flowers fill the imperial palace on the eve of Zhong Yang. The Emperor (Chow Yun-fat) returns from his military campaign with his second son, Prince Jai (Jay Chou), in order to celebrate with his family.
For three years, the Empress (Gong Li) has had an affair with her stepson, Crown Prince Wan (Liu Ye), who was born from the Emperor's first wife. Crown Prince Wan is not interested in the throne and wishes to run away with his secret lover, Jiang Chan (Li Man), the daughter of the Imperial Doctor. Meanwhile, Prince Jai (the Empress's first son), becomes worried over his mother' ill health and wonders at her sudden obsession with golden flowers. The Empress reveals that she is planning to overthrow the Emperor, who has been poisoning her. Prince Jai agrees to lead the Empress's soldiers.
A mysterious woman informs the Empress that she is being poisoned with Persian Black Fungus, but immediately after making her report, Crown Prince Wan captures the woman and takes her to the Emperor. The woman identifies herself as Jiang Shi (Chen Jin), the wife of the Imperial Doctor. The Emperor is shocked when he sees her and decides not to punish her, in spite of having had her entire family killed shortly after his ascension. She reunites with her husband and daughter. The Emperor also decides to promote the Doctor to governor of the nearby province of Suzhou, so the Doctor and his family pack their things and set out.
Crown Prince Wan is sad that the Doctor's daughter is leaving. He runs after their convoy and speaks to her, and learns that the Empress has woven ten thousands of scarves adorned with chrysanthemum motifs, sending them to a general of the imperial army afterwards. Fearing that this might mark the beginning of some conspiracy, Wan hurries back to the palace and confronts the Empress, who confesses that she is planning a coup d'Ã©tat. Out of shock and anguish, Crown Prince Wan stabs himself with a dagger and is placed under care.
The Doctor's family is betrayed and attacked by the Emperor's assassins. His servants and soldiers loyally try to fight them, but the Doctor is killed. The Doctor's wife and daughter flee on horseback and head for the palace. Upon arrival, they interrupt the Chrysanthemum ceremony and demand that the Emperor answer why he wants them killed. When he remains silent, the Empress explains to everyone that the Doctor's wife is Crown Prince Wan's mother, whom the Emperor discarded in the struggle for the throne. The Doctor's daughter and Crown Prince Wan have been half-siblings all this time. The doctor's daughter screams upon hearing this and flees the palace, where she and her mother are promptly cut down by more assassins.
Suddenly, the youngest son, Prince Yu, abruptly kills Crown Prince Wan with a sword, and he summons a group of his own soldiers to kill the Emperor and take the throne. He reveals that he knew about the Emperor's poisoning of the Empress, her affair with Wan and subsequent coup plans, and Wan's affair with the doctor's daughter. Declaring the rest of the family unfit, he plans to seize the throne himself. However, more of the Emperor's assassins descend from the ceiling and easily kill Prince Yu's soldiers. The Empress simply leaves the room as the Emperor proceeds to beat Prince Yu to death with his belt.
Meanwhile, ten thousand soldiers wearing golden armor and golden chrysanthemum emblems storm the palace, with Prince Jai in the lead. They easily overpower the Emperor's assassins and advance into the palace's inner square, trampling the golden flowers laid out for the ceremony. However, massive silver shields block their way in, and thousands of silver-armored archers appear on the walls surrounding them. The golden soldiers initially try to fight, but the wall of silver shields is impenetrable, and they are forced to retreat. They find the gates behind them blocked, and are shot down to the last man.
Prince Jai rises from the sea of dead bodies and is taken captive by the Emperor's soldiers. Behind him, the courtyard is cleaned up with mechanical efficiency by a legion of servants, with bodies being removed, floors being scrubbed and laid with carpets, and pots of yellow chrysanthemums replaced, making it seem as if the entire failed rebellion never even happened. At midnight, the Chrysanthemum Festival begins as scheduled.
The Emperor speaks with Prince Jai and the Empress at the terrace's ceremonial table. He expresses disappointment at Jai's actions, revealing that he was always planning to let Wan retire and make Jai his heir. When Prince Jai confirms that he only joined the rebellion because his mother was being poisoned, the Emperor offers to forgive his son, provided he serves his mother her "medicine" personally every day. Prince Jai refuses, apologizes to his mother for the rebellion's failure, and kills himself with a sword. The poisoned cup is still offered to the Empress, but she shrieks and slaps it away. The film ends as the spilled medicine is shown instantly corroding the table's engraved wooden chrysanthemum, referencing a Chinese proverb éçå¶å¤è´¥çµ®å¶ä¸­; JÄ«n yÃ¹ qÃ­ wÃ i, bÃ i xÃ¹ qÃ­ zhÅng, idiomatically translated as all that glistens is not gold.

Question: Who was the emperor planning to let retire?
Answer: Wan