Try to fix #1763 and a small refactoring

This should fix exact case in http://bugs.vcmi.eu/view.php?id=1763. Also can anyone test the case when resurrecting dead friendly "under" alive enemy. Thats why I consider this fix partial and created branch and request.