It appears that, if you're unable to fully restore HP/MP due to low meat, it will always cast LIO once or twice, as per this (restore_hp and restore_mp are in both my bBS and aBS, due to things like the dolphin whistle triggering and leading immediately into another fight, without another chance to heal up before/after.
Restoring HP! Currently at 102 of 445 HP, 44 of 137 MP, current meat: 2 ... Target HP = 423.
Casting Laugh It Off 1 times...
You gain 1 hit point
Laugh It Off was successfully cast.
Restoring MP! Currently at 103 of 445 HP, 43 of 137 MP, current meat: 2 ... Target MP = 137.
Insufficient meat to fully restore MP without wasting restoratives!
Restoring MP! Currently at 103 of 445 HP, 43 of 137 MP, current meat: 2 ... Target MP = 137.
Insufficient meat to fully restore MP without wasting restoratives!
Recovery target reduced to healing trigger (289)to conserve meat.
Insufficient meat to fully restore HP without wasting restoratives!
Did not fully restore HP for some reason.
Restoring HP! Currently at 103 of 445 HP, 43 of 137 MP, current meat: 2 ... Target HP = 423.
Casting Laugh It Off 1 times...
KoLmafia declares world peace.
You gain 2 hit points
Obviously I haven't hit my mana burning threshold... I don't even have enough for UR/mafia to be happy with me. And yet, each incarnation of restore_hp(0) casts LIO once.
As shown by:
> ash (my_mp() - get_property("manaBurningThreshold").to_float() * my_maxmp())
Returned: -67.6
Yet it gets used...
It IS definitely some function of restore("hp") though.
> ash import <universal_recovery.ash> restore("hp", 106);
Restoring HP! Currently at 105 of 445 HP, 42 of 137 MP, current meat: 2 ... Target HP = 423.
Casting Laugh It Off 1 times...
You gain 1 hit point
Laugh It Off was successfully cast.
Restoring MP! Currently at 106 of 445 HP, 41 of 137 MP, current meat: 2 ... Target MP = 137.
Insufficient meat to fully restore MP without wasting restoratives!
Restoring MP! Currently at 106 of 445 HP, 41 of 137 MP, current meat: 2 ... Target MP = 137.
Insufficient meat to fully restore MP without wasting restoratives!
Returned: true
> ash import <universal_recovery.ash> restore("hp", 120);
Restoring HP! Currently at 106 of 445 HP, 41 of 137 MP, current meat: 2 ... Target HP = 423.
Casting Laugh It Off 1 times...
You gain 2 hit points
Laugh It Off was successfully cast.
Restoring MP! Currently at 108 of 445 HP, 40 of 137 MP, current meat: 2 ... Target MP = 137.
Insufficient meat to fully restore MP without wasting restoratives!
Restoring MP! Currently at 108 of 445 HP, 40 of 137 MP, current meat: 2 ... Target MP = 137.
Insufficient meat to fully restore MP without wasting restoratives!
Insufficient meat to fully restore HP without wasting restoratives!
Returned: false
> ash import <universal_recovery.ash> boris();
Returned: void
In case it helps, here's the 120 heal on chatterbox (verbosity 3) settings:
> ash import <universal_recovery.ash> restore("hp", 120);
Calling Universal Recovery for type=hp, amount=120
Restoring HP! Currently at 108 of 445 HP, 40 of 137 MP, current meat: 2 ... Target HP = 423.
Trying to fullheal
Casting Laugh It Off 1 times...
You gain 2 hit points
Laugh It Off was successfully cast.
Try to heal HP from inventory.
Trying to fullheal
Try to heal HP with skills.
Restoring MP! Currently at 110 of 445 HP, 39 of 137 MP, current meat: 2 ... Target MP = 137.
Try to heal MP from inventory.
Last attempt to purchase MP with meat.
Insufficient meat to fully restore MP without wasting restoratives!
Restoring MP! Currently at 110 of 445 HP, 39 of 137 MP, current meat: 2 ... Target MP = 137.
Try to heal MP from inventory.
Last attempt to purchase MP with meat.
Insufficient meat to fully restore MP without wasting restoratives!
Last attempt to purchase HP with meat.
Insufficient meat to fully restore HP without wasting restoratives!
Returned: false
Nope, not the fullheal section. Tried that and it didn't fail. Maybe the (futile) section of hpheal?
Code:
if(cheap_skill != $skill[none] && cast_quant(cheap_skill, target)>0) {
// Inventory won't completely heal, so better to cast this skill BEFORE wasting a healing item
if(my_mp()>= skills[cheap_skill].mp || (my_maxhp() >= skills[cheap_skill].mp && mp_heal(skills[cheap_skill].mp))) {
if(my_hp() >= target) return true; // mp restoration may have restores hp
cast(1, cheap_skill);
}
futile = max_heal(options) < target - my_hp(); // Recheck futility
}
Yep, definitely that. Disabled the cast line, got the upper. Re-enabled it, got the bottom.
> ash import <universal_recovery.ash> restore("hp", 120);
Restoring HP! Currently at 111 of 445 HP, 38 of 137 MP, current meat: 2 ... Target HP = 423.
Restoring MP! Currently at 111 of 445 HP, 38 of 137 MP, current meat: 2 ... Target MP = 137.
Insufficient meat to fully restore MP without wasting restoratives!
Restoring MP! Currently at 111 of 445 HP, 38 of 137 MP, current meat: 2 ... Target MP = 137.
Insufficient meat to fully restore MP without wasting restoratives!
Insufficient meat to fully restore HP without wasting restoratives!
Returned: false
> ash import <universal_recovery.ash> restore("hp", 120);
Restoring HP! Currently at 111 of 445 HP, 38 of 137 MP, current meat: 2 ... Target HP = 423.
Casting Laugh It Off 1 times...
You gain 2 hit points
Laugh It Off was successfully cast.
Restoring MP! Currently at 113 of 445 HP, 37 of 137 MP, current meat: 2 ... Target MP = 137.
Insufficient meat to fully restore MP without wasting restoratives!
Restoring MP! Currently at 113 of 445 HP, 37 of 137 MP, current meat: 2 ... Target MP = 137.
Insufficient meat to fully restore MP without wasting restoratives!
Insufficient meat to fully restore HP without wasting restoratives!
Returned: false
Guessing that the if (futile) is actually supposed to be while (futile) or something similar, since you set the value of futile again inside, but it never gets used again. Otherwise there's no reason to "recheck futility" as the comments say. Problem with setting it to while is that it burns all your mana, then loops at 0 mp trying to restore one more MP forever.
One rather odd thing is that it has a cast_quant(skill, HP-target)>0 check in the futile casting, but you use a MAX(1, casts-needed) in cast_quant, so it will ALWAYS be >0.
Well, my solution for now will just be to comment out the single futile cast.
Least that keeps my MP more safe, since I'd rather have that one MP and be able to use my skills than to be able to have one more HP and lose 50.