Bug - Fixed Kolmafia does not let me use Milk of magnesium after spending the unused charge before rollover

mgreen52

New member
Steps to reproduce
1. Use Milk of magnesium before rollover, but do not use the charge yet (i.e. don't eat anything)
2. After rollover, eat something
3. Milk of magnesium will kick in
4. Try to use Milk of magnesium in Kolmafia GUI

Observed result
Kolmafia does not let me use it, because it thinks I have reached the daily limit.

However, this is not true because the charge is actually from the day before rollover.
After using the charge from yesterday, the player can use Milk of magnesium for today, and Milk of magnesium will work normally.

In other words:
1. Use Milk of magnesium before rollover, but do not use the charge yet (i.e. don't eat anything)
2. After rollover, eat something
3. Milk of magnesium will kick in
4. Manually use Milk of magnesium in relay browser
5. "You swallow the liquid. You stomach immediately begins to churn, and all the wrinkles in your shirt smooth out from the heat radiating from your abdomen." is displayed
6. Eat something
7. Milk of magnesium will kick in
8. Afterwards the daily limit has really been reached

See also
Notes section from Kol Wiki's entry for Milk of magnesium:
An unused charge of milk of magnesium will persist through rollover, but using another milk of magnesium without first using the charge will overwrite it instead of stack.

Environment
KoLmafia v21.9
 
Last edited by a moderator:

VladYvhuce

Member
That just says that the effect does not stack. There's nothing stating that you can use a second one if one already exists and have an additional benefit.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
That just says that the effect does not stack. There's nothing stating that you can use a second one if one already exists and have an additional benefit.
So mafia's current behaviour is to stop a player from wasting a milk of magnesium?
 

heeheehee

Developer
Staff member
Not quite. KoL itself will stop you from using a second milk of magnesium in a day. Our preference essentially just saves a server hit rejecting the use.

It looks like we set _milkOfMagnesiumUsed to true either if we use (or fail to use) a milk of magnesium (accurate), or if we eat a food, consuming a charge (potentially accurate).

If the charge was set on a previous day, we handle this incorrectly in both cases:

- We don't prevent using a milk of magnesium before eating, which fizzles the saved charge.
- If we do eat something, we set the preference to true, which prevents us from later using a milk later in the day (which is allowed).

Beyond, um, getting milk late enough in the day that you no longer have any spare fullness (or being in a non-eating path and pulling some milk, then breaking prism on a later day), what's the utility of this particular strategy?
 

mgreen52

New member
Beyond, um, getting milk late enough in the day that you no longer have any spare fullness (or being in a non-eating path and pulling some milk, then breaking prism on a later day), what's the utility of this particular strategy?
Yeah, I forgot to use milk of magnesium on the previous day, and I was already full, so I had to store the charge and use it on the next day, then I discovered this bug.
 

c2t

Member
Beyond, um, getting milk late enough in the day that you no longer have any spare fullness (or being in a non-eating path and pulling some milk, then breaking prism on a later day), what's the utility of this particular strategy?
Storing 5 adventures for the next day that is not affected by the 200 rollover adventure cap.

I have been just getting around mafia not allowing milk to be used again after spending a previous day's charge by setting the milk of magnesium tracking property to false before using the day's milk. But that seems a bit silly to have to do when milk of magnesium's tracking should probably just be updated to the not-so-new-anymore way it works now, as it's been almost 2 years since it was changed in game.
 

heeheehee

Developer
Staff member
Thanks for the responses regarding utility of this feature; it's helpful to understand the motivation for adding support.

Prior to the change, it wasn't limited, so this implementation was based on our incomplete understanding at the time of how it works. (I see the wiki history indicates that you updated it with this functionality on Jan 4, 2020, three days after this logic was added to Mafia. And it seems we never went back to update our handling.)

What I'm hearing is that we want a new per-user preference (presumably reset on ascension) that tracks whether Milk is active (set to true on successful use of milk, set to false in EatItemRequest), remove the logic to set _milkOfMagnesiumUsed in EatItemRequest, then provide a warning prompt (as opposed to a lockout as we have today for Milk usage) if you try to use milk while it's still active (analogous to trying to drink past your limit while still having turns left).

I'll most likely tinker with this tomorrow, assuming nobody beats me to the punch.
 
Top