I would love to play Magey, due more to his DM being a special combination of smart, creative, and the physical manifestation of pure evil. We should work to overcome the challenge in a smart and creative way as well.
Trying to see inside a Bag of Holding
As noted by Miniman, you can use a variety of Divination spells to figure out where the treasure is, and where the liches are. I will give you some clever uses of these spells, and since our DM is smart and creative, he will hopefully not disallow smart and creative ideas from his players.
Augury: Do it in 2 castings, max
The chief issue with this spell is, there is a cumulative 25% chance that you get a random reading if you cast it two or more times, before your next long rest. So really, only the 1st result is reliable. Then we should minimize the number of questions we ask with Augury. The trick is such that when you ask a question, you must always get one new fact for certain that you did not know before.
Arrange the five bags in a line, labeled A, B, C, D, E. Now cast Augury with the following plan of action:
If A contains a Lich, I will open A and B. Otherwise, I will open C.
This plan of action is loaded with these conditionals:
If A contains a Lich, and B contains the treasure, then we open A and B, getting a Lich and treasure. We should get weal e aflição
If A contains a Lich, and B contains a Lich, we get two Liches. We should get aflição
If A contains a Lich, and B contains nothing, we get a Lich and an empty bag. We should get aflição
If A does not contain a Lich, and C contains the treasure, then we will open C. We should get weal
If A does not contain a Lich, and C contains a Lich, then we should get aflição
If A does not contain a Lich, and C contains nothing, then we should get nothing
Then we can get the following information:
Weal: C has the treasure
Weal e Ai: B has the treasure
Ai: B and C do not contain the treasure
Nada: A does not have a Lich (it can have nothing, or the treasure), and C contains nothing
If you get either "Weal"Ou"Weal e Ai", then game over, you've found the treasure.
Se você pegar Ai, then cast Augury again with A, D, E (if A... open A and D... otherwise E).
Again, a "Weal"Ou"Weal e Ai" means game over for the second casting.
But if you get "Ai", then D and E do not contain the treasure either, meaning A must have it (remember, the first casting resulted in knowing B and C not containing the treasure).
If you get nothing, then you have either A or D as the ones containing the treasure. We know from the first casting that B and C do not have the treasure, and we know from this second result that E contains nothing, and A does not contain a Lich. So you can open A safely. If it's the treasure, game over. If it contains nothing, then D has the treasure.
If you get nothing, then we know C contains nothing and A does not have a Lich. Leverage it by opening A. It will have either nothing or the treasure. If it has the treasure, game over. If it has nothing, then we know both A and C contain nothing. This means the treasure and two Liches will be in B, D, E. We then cast Augury a second time with the following plan of action:
If B has the treasure, I will open B and D. Otherwise, I will open E.
At this point, we know there are only either Liches or treasure in the bags. So the conditionals are:
If B has the treasure, and D has a Lich, we are getting a Lich and a treasure. We should get Weal e Ai
If B has a Lich and D has a Lich, then we are opening E, which has the treasure. We should get Weal
If B has a Lich and D has the treasure, then we are opening E, which has a Lich. We should get Ai
There are no other possible results. This means, on the second casting of Augury, we will know:
There are plenty of ways to mix this around. Instead of saying "I A has a Lich, I open A" we could easily say "If A has nothing, I open A" and we will be able to construct a new logic path that leads us to the same conclusion-structure, just with different knowledge gains for weal, aflição, weal e aflição, and a non-result.
Of course, the second casting is unreliable already. But we could always use a better spell...
Commune: Do it in 1 casting
Commune is like Augury, in that you want to find the treasure in as few castings as possible. Thankfully, we get three yes-no questions here, and there is no need to be particularly clever.
Arrange the bags in a line and label them A, B, C, D, E.
- Is the treasure in A, B, or C?
If the answer to 1 is Yes, then we try to narrow it down from A, B, and C. Otherwise, the treasure is either in D or E.
2.i (If Yes to 1): Is the treasure in A or B?
If the answer to 2.i is Yes, then the treasure is either in A or B, but not C. We can use our third question to figure out in which bag is it in.
- (If Yes to 2): Is the treasure in A?
Obviously, if the answer to 3 is Yes, the treasure is in A. If the answer is No, the treasure is in B.
2.ii (If No to 1): Is the treasure in D?
Going back to the first question, if the answer was No to start with, we only need one additional question. If the answer to 2.ii is Yes, the treasure is in D. Otherwise, the treasure is in E. We can treat the third question as a bonus now, so ask whatever you like!
Contact Other Plane: Do it in 1 casting, but that's obvious
Entre em contato com outro avião will let you ask five questions, and you have 5 bags. You can just directly ask if the treasure is in each bag. Of course, you risk insanity, so just go with Commune or Augury instead. It's risk-free.
Having fun inside the Astral Plane
Plane Shift and Locate Objects
It's boring to be clever! I want explosions!
If the bag is overloaded, pierced, or torn, it ruptures and is destroyed, and its contents are scattered in the Astral Plane.
You can then Plane Shift into the Astral Plane, and use Locate Object (have lots of scrolls!) to find it there.
Parar o tempo
If you can cast Time Stop, you will get four free actions. You can use each of these actions to look in four of the five bags without having the Lich be pulled through, even if you get the bags the Liches are in.