I dont think it is as simple as the list above from the other source…
Oh sorry I just realised you were referring to St Alphonsus’ sermon on the conditions of prayer. In the sermon, St Alphonsus says there are various exceptions to our prayers being heard. One exception is the example you mentioned (people in a state of mortal sin). St Alphonsus refers to these people as being “proud” Christians and that God doesn’t answer their prayers:
St. James tells us, that God rejects the prayers of the proud: “God resisteth the proud, and giveth grace to the humble” (iv. 6). He cannot bear the proud; he rejects their petitions, and refuses to hear them. Let those proud Christians who trust in their own strength, and think themselves better than others, attend to this, and let them remember that their prayers shall be rejected by the Lord.
Although St Alphonsus does note that God will hear the prayer of these people if they sincerely repent of their sins:
The Lord cannot despise even the most obdurate sinners, when they repent from their hearts, and humble themselves before him, acknowledging that they are unworthy to receive any favour from him. ”A contrite and humble heart, God, thou wilt not despise." (Ps. l, 19.)
He also notes that there are some things God will never grant:
For example: if a person asked help from God to be revenged of an enemy, or to accomplish what would be offensive to God, the Lord will not hear his prayers; because, says St. Chrysostom, such a person offends God in the very act of prayer; he does not pray, but, in a certain manner mocks God. ”Qui orat et peccat, non rogat Deum, sed eludit."
St Alphonsus also notes that a Christian should also “remove every obstacle which may render [a person] unworthy of being heard”, such as not avoiding occasions of sin:
Moreover, if you wish to receive from God the aid which you ask, you must remove every obstacle which may render you unworthy of being heard. For example: if you ask of God strength to preserve you from relapsing into a certain sin, but will not avoid the occasions of the sin, nor keep at a distance from the house, from the object, or the bad company, which led to your fall, God will not hear your prayer. And why? Because “thou hast set a cloud before thee, that prayer may not pass through.” (Thren. iii. 44.) Should you relapse, do not complain of God, nor say: I have besought the Lord to preserve me from falling into sin, but he has not heard me. Do you not see that, by not taking away the occasions of sin, you have interposed a thick cloud, which has prevented your prayers from passing to the throne of divine mercy.
He also notes that God will not necessarily grant all the temporal favors we ask for:
It is also necessary to remark that the promise of Jesus Christ to hear those who pray to him does not extend to all the temporal favours which we ask such as a plentiful harvest, a victory in a law-suit, or a deliverance from sickness, or from certain persecutions. These favours God grants to those who pray for them; but only when they are conducive to their spiritual welfare.