Added code to detect limits for attack and HP function.