In order to break up the monotony of battles, there will be mini-game challenges to gather resources. In this one called Treasure Hunt, after a match is made, one cell (typically the latest one moved) of a contiguous block will be upgraded to the next type and the rest are removed. A match can be made mid-air with that upgraded cell, before it even falls to the bottom. There are a limited number of turns, and a match-4 or greater awards one extra turn.
It makes a lot of sense when played. There are many strategies too.
I had to rewrite the algorithm a few times until I got it completely correct. I use basic AI to play the game for me in fast-forward mode. There was a rare bug I fixed where cells would annoyingly overlap one another.