Bug Max Drunkenness drops when equipping weapon/off-hand

This is very strange & might not be reproducible, but I'm going to give all the information I can.

On one of my characters, with liver of steel & after breaking the prism, equipping anything in either my Weapon or Off-hand slot seems to suddenly reduce my max drunkenness by 5 within Mafia, down to to 14. If my current drunk is at 19, this means it refuses to adventure or do anything, believing I'm overdrunk. It's just Mafia that believes that; KoL itself is still fine, showing 19/19 drunkenness in the character pane.

I think what's happening is it's removing the Liver of Steel effect, but if I check with have_skill(), it does still recognize that I have it. At one point I tried messing with Liver's effect in modifiers.txt, changing it to +10 to offset the 5 point drop; when I did it went to 24 as expected, but then still dropped to 14 when I equipped something, implying it removed that specific effect for whatever reason.

It's been happening since around late February, across various mafia versions (currently 27935). It first happened after breaking the prism following a wereprofessor run I started when that was released. I haven't run another wereprof run since then. I've done a bunch of other types (gelnoob mostly) of runs since though.

I've only noticed it on this one character, only after breaking the prism. If I remove my weapon and off-hand I'm able to adventure again, as soon as I equip anything in either slot, I can't again due to appearing overdrunk. I'm wondering if it's something stored in this character's settings, but I don't know what to look for that could possibly cause this.

This is really all the info I have to go on right now, because honestly it's kind of baffling & I don't know what else to look for. If there are no other ideas on the cause I'll probably just try doing another wereprof run to see if that clears it up.
 
Hmm ah okay, thank you! Hopefully the details above might help troubleshoot.

I didn't know about the modtrace command, and while logging off & back on wouldn't fix it, running "modtrace liver" with a weapon equipped did. I've unequipped & re-equipped a few times and the fix seems to have stuck. I'll see if it comes back tomorrow.
 

heeheehee

Developer
Staff member
while logging off & back on wouldn't fix it
This is very surprising, and runs counter to my current understanding of the problem. Exactly what steps are you taking to log off & back on?

The short version is that we calculate all the modifiers associated with passive skills and store those values so we don't have to keep recomputing them. Sometimes, those modifiers get stuck caching some outdated state. `modtrace` forcibly recalculates all of them. But, so should logging out (or, rather, the act of logging back in after logging out).

Some of these scenarios make sense, like us not clearing our cache on certain actions where we really should (e.g. freeing the king, or breaking Ronin). Some scenarios are indeed a mystery, as ckb puts it. I don't understand why this would happen in the middle of normal adventuring, or why it would persist across logins, unless there's some fundamental issue with initialization that's broken in the first place.
 

Veracity

Developer
Staff member
Some packages have global static variables which will persist across login if you don't exit the program and restart it.
Ideally, those would be static data initialized from files, say, but, over the years, we've identified user-specific data which is kept in memory and needs to be re-calculated upon login.

One would hope that all such would be triggered by reloading preferences, but perhaps we are still missing something.

(One could also question the design decision that made us do things like that. I originally made IslandManager keep current war state in variables because I thought that fetching from (in memory) Preferences would be too slow. Silly me.)

In any case, logging out, restarting KoLmafia, and logging back in really should fix everything.
If not, there is something very mysterious about what KoL itself is reporting.
 
This is very surprising, and runs counter to my current understanding of the problem. Exactly what steps are you taking to log off & back on?

The short version is that we calculate all the modifiers associated with passive skills and store those values so we don't have to keep recomputing them. Sometimes, those modifiers get stuck caching some outdated state. `modtrace` forcibly recalculates all of them. But, so should logging out (or, rather, the act of logging back in after logging out).

Some of these scenarios make sense, like us not clearing our cache on certain actions where we really should (e.g. freeing the king, or breaking Ronin). Some scenarios are indeed a mystery, as ckb puts it. I don't understand why this would happen in the middle of normal adventuring, or why it would persist across logins, unless there's some fundamental issue with initialization that's broken in the first place.

Unfortunately because running modtrace once seemed to fix it totally, I can't test this now.. I do tend to bounce between characters with "login <char>" a lot, but I'm fairly positive I quit out (with the "exit" command) at least at some point.

Come to think of it - I do just about everything using my own relay scripts in the browser though, and that includes hitting a button that makes a relay script do a cli_execute("exit") when I'm done. I have noticed many things don't seem to operate the same way when kicked off from a relay script, things that work fine from the regular CLI or typed into the gCLI sometimes break when run via relay script, including things called via cli_execute. Oftentimes these issues do "feel" a lot like cached data problems, but I've never really tried to work out what's going on. If logging out via a relay script command could cause the problem to persist, that might've done it.
 

heeheehee

Developer
Staff member
`modtrace` is a bit of a hack, in that it will "fix" things short term but does not help us get much closer to figuring out what's going on. But it does seem like it confirms that it's (likely) the passive skill cache at fault if that fixes the problem, since that's one of the unique things that it does (I have no idea why it's implemented that way).

That said, exiting out fully or logging into a different character in between should reset the relevant state here, unless KoL itself is telling Mafia something different.

You mentioned that it seems to be Liver of Steel's effect that goes missing, but Mafia thinks you still have the skill.

If this happens again, it'd be good to confirm the values of:

> inebriety_limit
> numeric_modifier Liver Capacity
> ash numeric_modifier($skill[Liver of Steel], "Liver Capacity")

You also mention that it happened when you equip anything in your weapon / offhand slot. Did it fix itself when you unequip those slots?

(I am asking questions where I have assumptions re: what the answers should be, but if any of those assumptions are violated, that is a potentially useful clue.)
 
When I unequipped my weapon & offhand slots, my liver capacity would return to the normal 19, but when I re-equipped something in either of those slots (admittedly I wasn't paying attention to the effects those items had, it *seemed* like the item didn't matter but I only tried a couple different ones) my liver cap would drop down to 14 again.

For the rest, it's too late to check the numeric_modifiers but I did check inebriety_limit which also returned 14.
 
Top