If both Mirror Image and Sanctuary are on the same creature, do I determine if a duplicates is hit before or after the effects of sanctuary happen?
Mirror Image says:
Each time a creature targets you with an attack during the spell's duration, roll a d20 to determine whether the attack instead targets one of your duplicates.
Whereas the relevant text from Sanctuary is:
Until the spell ends, any creature who targets the warded creature with an attack or a harmful spell must first make a Wisdom saving throw.
Which effect takes place first, if they are attacked? If sanctuary takes precedence (or the creature passes it's wisdom saving throw), and the attack goes through, does it need a second save to target the duplicate? If mirror image takes precedence, does sanctuary still try to prevent the attack?
Best Answer
Xanathar's Guide to Everything, page 77
So, if it's the NPC turn, your Dungeon Master decides what happens / triggers first. If it's your turn, you decide.
This is optional rule so if you are not using it at your table, then it's DM call. But I believe it to be a fair rule to follow, and using rules from the book can help to prevent disagreements.
Either way, both effects take place, if after the first one, the second one still makes sense:
So if sanctuary goes first and stops the attack, no roll for duplicate retargeting is needed. If mirror image goes first and the roll indicated the real character, then roll for the sanctuary takes place.
This is because if first effect prevented the attack, the second one does not do anything as it makes no narrative sense. The attacker is no longer being someone targeting the PC with an attack, and so is no longer a valid subject of the second effect.
If mirror image made someone target duplicate instead of protected character, then sanctuary has nothing to do as it only affects creatures targeting the warded person, per spell text. And attacker is no longer targeting warded person, he is targeting duplicate instead (again, per mirror image spell text).