SPOILER ALERT: Do not read until you’ve watched the July 30 “Game of Thrones” episode, “The Queen’s Justice.”

Being resourceful has put the Lannisters back on top.

In fact, taking control of raw materials is what has solidified Queen Cersei’s seat on the Iron Throne, which was looking pretty shaky at the beginning of “Game of Thrones’” seventh season.

The money was on Daenerys Targaryen to reclaim the Seven Kingdoms earlier, because she was allied with Highgarden (the richest family, and a major food producer), and Dorne (rich in wealth, resources and an army), and she also commanded an Iron Island fleet, an army of Unsullied soldiers, a Dothraki warrior horde and three fire-breathing dragons.

See also: Financial mistakes may cost this ‘Game of Thrones’ family the Iron Throne

The Lannisters, on the other hand, had estranged most of their allies, they didn’t have food to feed their people, their gold mines were dried up, and they were in debt to the Iron Bank of Braavos.

But as we hit the midseason point, the noble family of lions has roared back by allying with Euron Greyjoy’s fleet, which destroyed Daenerys’ navy and captured the Dornish and Iron Island leaders that had sided with the dragon queen. Last Sunday night’s episode also saw Cersei and Jaime tricking their enemies to capture the Lannisters’ Casterly Rock stronghold while they invaded the vulnerable Highgarden.

The Lannisters fortunes have changed thanks to reps from the Iron Bank (l.) now backing Queen Cersei (r.) in the wars to come. (Helen Sloan/courtesy of HBO)

“There was certainly a reversal of fortune,” Adam Ozimek, an economist at Moody’s Analytics, told Moneyish. Now Cersei has the Tyrell gold – and its grains and food to feed her armies. She’s also got the Greyjoy navy, so she has military and economic command of the seas. And now she’s got the Iron Bank of Braavos on her side – largely because Daenerys’ crusade to end slavery has hurt the bank’s profits.

But Daenerys is sitting on an important raw material that could put her back in the game: Dragonglass, or obsidian, which can destroy the White Walkers and their army of the dead that threatens the entire realm. King of the North Jon Snow’s desperation to get his hands on the glass will be key to allying him with Daenerys, despite the pair’s initial dislike for each other.

“Jon used diplomacy, appeals to the higher good, and a trustworthy reputation to secure his resources from Daenerys. The trade of resources in turn is a helpful first step towards a stronger alliance based on positive sum gains,” said Ozimek.

See also: Hot Pie from ‘Game of Thrones’ is selling direwolf bread in real life

So what can Dany do? Take the late Lady Olenna Tyrell of Highgarden’s advice, and be a dragon – as in, lead her three dragons in an attack against Cersei’s Iron Fleet. “Ships seem most vulnerable to dragon fire, and that fleet has been a headache for her, so that’s probably what I’d try to do,” said Ozimek.

And now that Cersei appears to have cut the head off of Dorne by capturing Ellaria Sand and killing the Sand Snakes, it’s imperative for Daenerys to discover who is left ruling the country, and to secure Dorne to her side again.

“Ice and fire” really need to come together if Dany wants to beat Cersei. (Helen Sloan/courtesy of HBO)

“The Dornish are historically very strong” said Ozimek. “Not to mention that if the army of the dead comes, Dorne might be a good place to flee to. It’s hard to picture the icy Night King walking across the hot sandy dunes of Dorne with all of his wintery troops.”

And it wouldn’t hurt to try getting the Iron Bank on her side. “Given that Cersei was able to make Daenerys look like a crazy person, and [a] major risk to the interests of the Iron Bank, I’d also probably try to have a sitdown with one of the Bank’s representatives as well to try to assuage their worries and encourage them to not intervene in the war with Cersei,” he said.

Because Cersei’s idea of diplomacy – turning allies into enemies, and then looking for new allies to help destroy them – could still hurt her in the long run.

”Cersei takes a zero sum approach to securing the resource she needs … the Tyrells have gold, so Cersei destroys them and takes it,” Ozimek added. “For now she has forged new temporary alliances to help finish old enemies off … but if I was the Iron Bank of Braavos or Euron Greyjoy, I’d be worried about whether she can be trusted.”