Bug Mafia setting `timesRested` to 0 on login

c2t

Member
Mafia has been doing this the last few days for me. Generally I stop at the same point every day and close mafia. When I start it back up later, I've discovered it has been setting timesRested to 0. This has been causing some rest frees to take turns for me, because the tracking preference for free rests is being changed to a state that does not reflect its state in game.

Attached is a debug of the login sequence, wherein mafia changes the preference. If I need to use some other debug settings and redo this, let me know which ones as I can do this any time and repeatedly.


Edit: Just tried this with all the mafia version I have downloaded, and this issue appeared starting with r27606 for me. r27605 and before is fine
 

Attachments

  • DEBUG_20230922.txt
    927.2 KB · Views: 1
Last edited:

Ryo_Sangnoir

Developer
Staff member
Some other comments on https://kolmafia.us/threads/sidepane-no-longer-shows-inebriety-limit-until-refresh.29265/, which is the same issue.

Specifically, this is because you have free rests available on logon, but Mafia calculates how many free rests you have incorrectly, so it sets the number of rests used to the number of free rests - 1.

The other strangeness here is "rest free" taking turns -- I had thought we looked at the campsite before doing that, so we should know whether a rest is free or not, so it puzzles me that this goes through.
 

c2t

Member
As far as rest free taking turns or not:
Code:
            while (total_free_rests() > get_property("timesRested").to_int()
                && get_property("_cinchUsed").to_int() > 40)
            {
                cli_execute("rest free");
            }
caused turns to be used:
Code:
[174] Rest in your campaway tent
You gain 31 hit points
You gain 104 Mojo Points
You acquire an effect: Moxious Intentions (20)
Preference _cinchUsed changed from 100 to 95
Preference _cinchoRests changed from 17 to 18
Preference timesRested changed from 15 to 16

[175] Rest in your campaway tent
You gain 16 Mojo Points
You acquire an effect: Moxious Intentions (20)
Preference _cinchUsed changed from 95 to 90
Preference _cinchoRests changed from 18 to 19
Preference timesRested changed from 16 to 17

[176] Rest in your campaway tent
You gain 3 hit points
You acquire an effect: Moxious Intentions (20)
Preference _cinchUsed changed from 90 to 85
Preference _cinchoRests changed from 19 to 20
Preference timesRested changed from 17 to 18
This was after mafia reset timesRested to 0 on login of course, which is also why timesRested is less than _cinchoRests.
 
Last edited:

Ryo_Sangnoir

Developer
Staff member
Okay, so it looks like whether free rests are available is updated for Chateau or Campground rests, but not Campaway rests. I can look into adding that.
 
Top