wesnoth/wesnoth — pull request #356 by pelmers (2014-12-31 21:04:42+00:00)
Title: Bug 23108: expected damage for aborted attacks

[ref](https://gna.org/bugs/index.php?reload=1&func=detailitem&item_id=23108)

This commit moves the expected damage calculation from before the attack loop to during the perform_hit phase, since it's possible to abort from the attack loop prematurely via WML actions like teleporting a unit or changing its side. Now each strike adds its expected damage to the total expected.

I also refactored the replay validation into its own function to cut down on the complexity of perform_hit (still almost 200 lines).