hey hey
in my opinion it is not necessary to check all heroes on every step, it is enough to only check the current hero running.
So you could change your code like this:
I dont see fct 3800 in your code, maybe you need to adjust or make a new function because now it is no longer x16 but heronumber now=x1
The check on all heroes is also unnecessary for all heroes after any battle. For two heroes is enough.