Fixed combat lenght calculation.

Refactored some code.