The book is set in the 17th century in the Badgworthy Water region of Exmoor in Devon and Somerset, England. John (in West Country dialect, pronounced "Jan") Ridd is the son of a respectable farmer who was murdered in cold blood by one of the notorious Doone clan, a once noble family, now outlaws, in the isolated Doone Valley. Battling his desire for revenge, John also grows into a respectable farmer and takes good care of his mother and two sisters. He falls hopelessly in love with Lorna, a girl he meets by accident, who turns out to be not only (apparently) the granddaughter of Sir Ensor Doone (lord of the Doones), but destined to marry (against her will) the impetuous, menacing, and now jealous heir of the Doone Valley, Carver Doone. Carver will let nothing get in the way of his marriage to Lorna, which he plans to force upon her once Sir Ensor dies and he comes into his inheritance.
Sir Ensor dies, and Carver becomes lord of the Doones. John Ridd helps Lorna escape to his family's farm, Plover's Barrows. Since Lorna is a member of the hated Doone clan, feelings are mixed toward her in the Ridd household, but she is nonetheless defended against the enraged Carver's retaliatory attack on the farm. A member of the Ridd household notices Lorna's necklace, a jewel that she was told by Sir Ensor belonged to her mother. During a visit from the Counsellor, Carver's father and the wisest of the Doone family, the necklace is stolen from Plover's Barrows. Shortly after its disappearance, a family friend discovers Lorna's origins, learning that the necklace belonged to a Lady Dugal, who was robbed and murdered by a band of outlaws. Only her daughter survived the attack. It becomes apparent that Lorna, being evidently the long-lost girl in question, is in fact heiress to one of the largest fortunes in the country, and not a Doone after all (although the Doones are remotely related, being descended from a collateral branch of the Dugal family). She is required by law, but against her will, to return to London to become a ward in Chancery. Despite John and Lorna's love for one another, their marriage is out of the question.
King Charles II dies, and the Duke of Monmouth (the late king's illegitimate son) challenges Charles's brother James for the throne. The Doones, abandoning their plan to marry Lorna to Carver and claim her wealth, side with Monmouth in the hope of reclaiming their ancestral lands. However, Monmouth is defeated at the Battle of Sedgemoor, and his associates are sought for treason. John Ridd is captured during the revolution. Innocent of all charges, he is taken to London by an old friend to clear his name. There, he is reunited with Lorna (now Lorna Dugal), whose love for him has not diminished. When he thwarts an attack on Lorna's great-uncle and legal guardian Earl Brandir, John is granted a pardon, a title, and a coat of arms by the king and returns a free man to Exmoor.
In the meantime, the surrounding communities have grown tired of the Doones and their depredations. Knowing the Doones better than any other man, John leads the attack on their land. All the Doone men are killed, except the Counsellor (from whom John retrieves the stolen necklace) and his son Carver, who escapes, vowing revenge. When Earl Brandir dies and Judge Jeffreys, as Lord Chancellor, becomes Lorna's guardian, she is granted her freedom to return to Exmoor and marry John. During their wedding, Carver bursts into the church at Oare. He shoots Lorna and flees. Distraught and filled with blinding rage, John pursues and confronts him. A struggle ensues in which Carver is left sinking in a mire. Exhausted and bloodied from the fight, John can only pant as he watches Carver slip away. He returns to discover that Lorna is not dead, and after a period of anxious uncertainty, she survives to live happily ever after.

Question: When is Duke of Monmouth defeated?
Answer: At the battle of Sedgemoore