Bug Mafia loses track of which equipment can be used for CHEAT CODE skills

VeeArr

New member
This is possibly related to https://kolmafia.us/threads/mafia-cant-find-sweat-out.30600/ but what I've seen so far indicates it's probably a different issue.

As with most equipment that grants noncombat skills, if you ask mafia to use one of those skills (e.g. via skill <skillname> in the GCLI or via the modifier maximizer), it will temporarily equip the equipment to use the skill and then re-equip your previous equipment. Upon starting mafia, this works as expected, but at some point it starts failing.

At first, I suspected that it was losing track of the fact that I had a Powerful Glove in my inventory, but further evidence indicates that this is not actually the case.

At https://github.com/kolmafia/kolmafi...ge/kolmafia/request/UseSkillRequest.java#L947 it looks like it builds a list of candidate equipment that could be used to cast the desired skill, and then see if any are accessible/already equipped, and then print an error message if none are. Critically, the error message includes all of the equipment it thought would allow for the skill to be used.

Interestingly, the error message that prints when I encounter the error includes only "replica Powerful Glove", which implies that the problem isn't that it's losing track of the fact that I have a Powerful Glove in my inventory, but rather than it is losing track of the fact that Powerful Glove can be used to cast CHEAT CODE skills.

It does always work as expected initially upon loading mafia, so it's not a matter of the data being misconfigured--something actually gets broken later for some reason.

I haven't been able to track down exactly what causes this to get messed up (or even what game actions trigger the error to start happening), but hopefully this points someone more knowledgeable in the inner workings of these things in the right direction.
 
I hadn't seen that one, but yea it does seem like the same issue. Would it be useful to copy my details over to that thread instead, or leave this up?
 
Well, I managed to get a debugger hooked up, and I figured out what was causing this. If you hover over the Powerful Glove's icon in your inventory, it attempts to re-parse its enchantments within ConsequenceManager.fireAction(), which in turn uses DebugDatabase.parseItemEnchantments(). The parsing method doesn't find anything to do with "Lets you use various glitchy cheat codes", so it calls ModifierDatabase.overrideModifier(ModifierType, int, String), which eventually causes its entry in ModifierDatabase.modifiersByName to get set to a value with no MultiStringModifier entries. Later, when UseSkillRequest tries to find equipment that allows use of the CHEAT CODE skills, it doesn't match against Powerful Glove anymore, because it doesn't have the corresponding MultiStringModifier in the internal cache.

I used a fresh instance of r28725 in an empty directory and verified that this behavior is present independent of any scripts or other weirdness that might be banging around my normal mafia install.
 
This issue doesn't affect blood cubic zirconium, so I suspect that the reason the glove gets re-parsed on hover is so that it can detect the battery level in the glove and remove the skills if you no longer have enough charge, but the actual parsing got broken at some point?
 
Does anyone know a situation where we actually want to reparse the item enchantments when calculating a consequence?
 

This seems to imply that the intent is to make sure the Glove's battery level is correctly synced. Re-parsing the enchants seems to happen when it parses stuff out of the description, regardless of whether the data it's looking for is actually in the enchantments or not: https://github.com/kolmafia/kolmafi...kolmafia/session/ConsequenceManager.java#L295
 
Last edited:
I suspect this impacts any item which (1) has a DESC_ITEM entry in consequences.txt; and (2) has any noncombat Conditional Skill (Equipped) modifiers listed in modifiers.txt.

If so, affected items include (perhaps among others):
  • Cincho de Mayo
  • designer sweatpants
  • Powerful Glove
 
Back
Top