Come on... In the editor, we set Shakti to the maximum allowed by the rules, and that's it - as far as I know, 120 units... there's no need to invent anything or dig around. This is a technically solvable problem without any issues. And program the second hero to have the statistical maximum - to remove the theory of probability from the game altogether. Only the technique of achieving the desired result will remain. And everyone will have their own! :)
Well, okay... That's not the point.
I didn't specify tactical aspects simply because I set some default conditions - well, I didn't immediately realize that the description - an empty map and just a dungeon - could imply many options. And a hero - it can also imply artifacts and so on. Well, okay, now the task is stated in the form it is. :) I'm waiting for the results, whether you want to send them via ICQ or somewhere else. Just, guys, please refrain from phrases like "it all boils down to something simple. We just buy as much as we can, up to 9, and that's it - about 750 Troglodytes. The task has an exact answer and several solutions - and strictly defined solutions."