Logic error can cause beaten up on low-ML combat after chamois
I've been using an old version of this, and just encountered what I believe to be a problematic logic error which appears to not be fixed in the newest version (which I just downloaded to check). Namely, after detecting that you are low on HP, and that the slime damage will kill you from max HP (the "if( slime_damage() >= my_maxhp() )" section), it uses a chamois first, *then* restores hp based on slime_damage.
However, if a chamois has been successfully used, slime_damage will return too low a number, as you do *not* take 0 slime damage when entering combat with 0 turns of coated in slime, but are instead coated in slime and then take damage from it. As a result, this start-of-combat damage can cause you to be beaten up if you are low on HP prior to using the chamois.
This cost me a turn in my most recent slime run; fortunately I had "do not auto-recover health" and "stop if auto-recovery fails" set, so I only lost the one turn, and I have always left two turns of padding for mistakes and none of my squeezers screwed up this time.
A quick fix is to insert the line
Code:
if( !restore_hp(my_maxhp()) ) abort( "Unable to restore HP!" );
*before*
Code:
if( !chamois() ) abort( "Slime removal failed! You won't survive another turn!" );
and this should cause full (though perhaps more than needed) HP recovery before the otherwise-potentially-up-beating fight. (I expect Mafia to use Cannelloni Cocoon for almost all my HP recovery needs anyway, so I'm not worried about exactly how much HP is recovered; I leave it as an exercise to the reader to make this recover only the needed amount of HP based on ML, especially since Mafia doesn't know how many squeezes are in the tube...)