Sundew grants credits even when running it first click
Sundew gives the Corp 2 credits when you run it first click. I believe this is because click-run calls pay to pay the click cost BEFORE initiating the run. That triggers :runner-spent-click before the run is initiated; Sundew handles the :runner-spent-click event before there is anything in (:run @state), so the attempt to check to see if the run is on Sundew's server fails because there is no run yet.
It used to work previously. I will check the issue this evening.
You are right. pay is called to check if the runner can pay for the run or the run ability before the run is initiated. Sundew actually never worked properly.
I don't see how this can be worked around with the current code. The pay function has to be split into a can-pay? function and a simpler pay function with no check. It would actually be beneficial for other card as well like Self Modifying Code or Clone Chip to check of the selected card can be installed.