Prayers are efficacious based on the charity of the one praying it, and, as always, on God’s mercy (which is a Constant).
According to the Zealous Doctor, the prayer of a sinner wouldn’t be effective if that person isn’t actually praying with the intent of being healed of their sins. Or, the analogy he used: it would be like a person who has offended a prince, going to that prince to ask of a favor, while at the same time having no intention of ceasing to offend that prince. Likewise, the prayers of such a person would not be at all efficacious. Even if their own prayers aren’t efficacious, this doesn’t mean that the Holy Spirit (and the saints, and others) aren’t still working within that person, to bring about contrition within them, so that some day their prayers will become efficacious.
A person in mortal sin that seeks to conform their life to God would have a very efficacious prayer (although the question is: can such a person even be in mortal sin? The heart of perfect contrition is instantly forgiven of all sins).