Feature - Implemented Enter abort state if resting on sofa fails

Bale

Minion
If mafia attempts to rest on your clan's Comfy Sofa, but that sofa does not exist in the current clan, the player takes 5 HP of damage. Mafia will then attempt to do this again.

When when it takes 5 HP from resting on the sofa, a superior behavior would be for mafia to enter an abort state and print an appropriate red message, "This clan does not possess a sofa." That will alert the user that something is wrong because automation has aborted and the frame has turned red. He can then take appropriate action such as disabling the sofa in HP/MP options or switching clans.
 

roippi

Developer
More generally, we should enter an abort state if HP recovery results in HP loss, I'd imagine. Jick occasionally adds things to punish direct URL usage like the sofa.
 

Theraze

Active member
HP recovery might temporarily have HP loss if you're burning MP before a trip to the nuns or something similar... but yeah, in general, the end-result of a restoration shouldn't leave you worse off, and if it does, abort state.
 

Catch-22

Active member
Less generally, we should enter an abort state if recovery results in a loss when KoLmafia was not expecting it.
 

Greenen72

Member
The reason I originally posted this was because I had the sofa checked in auto-restore, and ended up wasting a day's worth of adventures. I know that it's basically my fault that I left mafia running unattended, but the reason I posted the bug report was because all mafia outputs is "Resting on clan sofa, you lose 5 HP". I know that an additional server hit every time you log on/change clans is unreasonable for the new kol servers, and unchecking the option to use the sofa or aborting during automation is far too hard to script, but maybe at least a single line between "Resting on clan sofa" and "You lose 5 hp" that says something along the lines of "You don't have a clan sofa"?
 

roippi

Developer
That's essentially what we meant with the ABORT_STATE talk. Additionally, it would turn the sidepane red and stop automation.
 
I wasn't sure how to fix the generic case, as it seems like the part of kolmafia that knows when the HP is lost doesn't have any idea if it's during the recovery process or not. Or at least, it's beyond my ability to figure out so far... so I patched the specific case, which is vastly easier. But, still a worthwhile commit, I think - as kolmafia should correctly error/abort if the sofa doesn't work, instead of just assuming success (esp with the hp loss). :) I ran into this accidentally earlier today, so it was time to fix...

Very simple patch, builds/runs against latest (r11316). I did not test success (not having a clan with a sofa handy), but since that's the default case I think it's extremely likely to work. I did test both the gcli "sofa" command, and mp recovery automation, and both properly aborted (no more keep trying to recover until you're beaten up, yay).
 

Attachments

  • sofa_abort.patch
    795 bytes · Views: 26

lostcalpolydude

Developer
Staff member
11337. It looks like the message in that patch only shows up if you leave out the number of turns to use in the URL. There's also the case where you aren't in a clan at all (and don't take damage). All of those cases lead to it being simplest to check for success and abort otherwise.
 
Top