A judge on Wednesday ruled that several producers of “The Walking Dead” were not cheated out of profits by AMC Networks, bringing the long-running litigation over the hit show closer to a finale.

Judge Daniel J. Buckley rejected the producers’ claim that AMC Networks had reverse-engineered the definition of “profits” in their contracts in order to keep the vast majority of the show’s profits for itself.

The producers — Robert Kirkman, Gale Anne Hurd, David Alpert, Charles Eglee and Glen Mazzara — first filed suit in 2017, four years after the show’s creator Frank Darabont — who was fired after the first season — filed a similar claim against AMC.

Darabont and CAA, his agency, won a $200 million settlement in their case last July.

But AMC has continued to fight Kirkman — the comic creator behind “The Walking Dead” series — and the other producers in court in Los Angeles. In July 2020, Buckley ruled in favor of AMC after a “mini-trial” focusing on the appropriate definition of “modified adjusted gross receipts,” or MAGR. In that ruling, Buckley held that the terms of the producers’ contract with AMC were clear, unambiguous and legally binding.

The producers revised the lawsuit in May 2021, arguing that — even if the terms were clear — AMC had nevertheless breached the “implied covenant of good faith and fair dealing” by concocting a bad-faith definition of MAGR after the success of “The Walking Dead” was evident.

Buckley was no more impressed with that argument, finding Wednesday that the producers’ own expert testimony showed that the MAGR definition was not atypical, and “was not specifically and malevolently crafted to deny Plaintiffs’ the benefits of their contracts.”

“Much of Plaintiffs’ argument related to the implied covenant claim is based upon the unsupported assumption that a benefit of their bargain was a positive MAGR, always resulting in contingent compensation, for each year,” Buckley wrote. “Plaintiffs do not cite any contractual language supporting this assumption and Plaintiffs agreed to be bound by Defendants’ MAGR term.”

The plaintiffs have reserved their right to appeal the ruling, and may still proceed to trial on accounting claims.