(a) If the plaintiff prevails in the action, he or she shall recover by way of damages the rents and profits down to the time of assessing them.
(b) When the plaintiff or those under whom he or she claims title may have entered in any land office of the United States within this state the improvement of the defendant and the action is brought to recover the possession of the improvement the plaintiff shall recover no damages.