Also, not that it is important, but in main(), function slime_damage() is called at least 2 times per loop (4 in the case a chamois must be used), which slows down the script...
You could have a tmp variable in line 254:
tmp_slime_dmg = slime_damage();
and use it in the conditions