Charlie Sheen and Denise Richards are back together -- on-screen, that is. The former marrieds are set to reunite on an episode of Sheen's new sitcom, 'Anger Management.'

In the series, Sheen plays Charlie Goodson, a former pro baseball player turned unorthodox anger-management therapist. Richards will guest-star as Lori, the new business partner of Goodson's ex, Jennifer. And if Charlie and Jennifer's TV relationship is as complicated as Charlie and Denise's real-life relationship has been, well, you may need spreadsheets and pie charts to sort the whole thing out.

Sheen and Richards married in 2002, with Richards filing for divorce in 2006 amid allegations that Charlie had been unfaithful (shocking, right?). They've had their ups and downs, but continue to share joint custody of their two daughters and apparently get along well enough that Charlie is happy to give Denise a little screen time on his new show.

She's the latest casting to be announced, joining actress and comedian Brett Butler, who will have a recurring role as a bartender on the new sitcom.

Since Butler hasn't been in the spotlight for years, she may seem like an odd choice, but Sheen and Butler share a common bond: an unpleasant history with Chuck Lorre, who created not only 'Two and a Half Men' (and famously fired Sheen from the show last year), but also Butler's old series, 'Grace Under Fire.' And just like Charlie, Brett had her share of run-ins with Lorre.

'Anger Management' premieres Thursday, Jun. 28 with two back-to-back episodes starting at 9 p.m. on FX.

More From ScreenCrush