Don’t get caught. ;-)
But seriously, there only seems to be one answer that is likely to work in practice: change the risk/reward structure so that patent trolling isn’t profitable any more.
One obvious approach would be making fewer things subject to patent protection in the first place. You could explicitly exclude whole categories like software or business method parents, assuming you could define them clearly enough. You could raise the general bar for granting/defending patents in terms of originality and non-obviousness. You could leave the standards the same in principle but apply more robust checking for prior art and/or a more thorough consultation to determine obviousness before awarding a patent. Each of these has costs in different places: principally, the legislature, the courts, and the patent office, respectively.
Another approach would be to look at the types and magnitudes of consequences that result if you lose a patent case, either by being found to infringe someone else’s patent or by claiming that someone infringes your patent and failing to win the case. For example, what if the remedies available to someone who owned a patent but who was not actively working to exploit that patent in some reasonable way themselves were made dramatically less than the remedies available to someone who was using the patent system “properly” to secure exclusive rights while they worked hard to exploit a real invention? What if there were a meaningful cost to bringing a patent case and losing not just because the court invalidated your original patent but also because the court actively determined that the original patent had been [some legal specification of “obviously abusing the system”], a kind of patent case analogy for dismissing with prejudice?