I'm beginning to understand why this wasn't already a standard feature of KoLmafia. Based on Winterbay's suggestion, the best I could come up with was this for a before battle script:
import <CounterChecker.ash>;
void main() {
string fortuneCounter = get_counters("Fortune Cookie", 0, 0);
if...