Bug - Waiting for Info MP Restoration and Equipment Changing (Travoltan Trousers mostly)

dier_cire

New member
Currently, I believe we consume restorers BEFORE swapping back the outfit (I may be wrong on that...)

The log seems to indicate that you're right in that you are wrong (though I could be wrong too and the log was slightly out of sync). From what I see from it is that it's swapping before using, but it's already in trouble due to the MP loss from the switch. Regardless, your logic fix is sound.

If you wanted to go really crazy, you could check the potenial meat gain for swapping versus the loss of MP if you do too to see if it's worth it. :)
 

Theraze

Active member
Unless it's changed since I last paid attention, the current action is buy restoratives (including switching outfits before if needed, and switching back after), THEN use restoratives. If switching the outfits dropped your max below its initial level, and the final level is below your bottom 'restore if not here' level, repeat until either it works or you run out of meat.
 

Darzil

Developer
I would do this:

1. Calculate the total MP you want to restore to
2. Calculate total - current MP
3. Swap to outfit to purchase in.
4. Buy amount of restorers to restore the amount calculated in 2.
5. Swap back to starting outfit.
6. Consume restorers.

Step 3 can (in Fluxxdog's example, for instance) reduce your current MP, resulting in 6 failing to top you up, and sending you around the loop again (til meat runs out). It's why I suggested calculating current MP after step 3.

Alternatively, maybe we just shouldn't buy stuff from NPCs if it requires an outfit the wearing of which will reduce MP below it's current value. It won't happen that often that it is required to spend more meat to recover from stuff that it lost, and maybe that could be left to manual or script exercise ?
 

Theraze

Active member
Your alternative would disable buying completely from NPCs for those with discounts, thereby making the discounts useless... That's definitely not behaviour as intended.
 

fronobulax

Developer
Staff member
Veracity explained what I was thinking better than I did but there is something I still don't get or am just too dense at the moment to see.

My character at an instant in time has a current and max mp which I will call X and Y. How does changing my outfit, doing something that does not consume food, drink or spleen items or use turns and then putting on my original outfit change X and Y as determined after I put the outfit back on. Is there a game mechanic that has eluded me for six years?

Edit:
Duh. The case I am missing is that changing the outfit lowers my max mp to a value lower than my current mp. Thus mp is lost and not restored when I switch back. Now I see what the problem is.

Would the problem go away if the amount of mp lost by switching outfits was added to the amount to be restored before any purchases or restoration took place?
 
Last edited:

Theraze

Active member
If your current outfit1 boosts max mysticality or mana to manaY, then switching to outfit2 to buy (either because it's seltzers or otherwise used for the purchase), may drop manaY below manaX, thereby increasing the total amount needed to restore, so that when you change back to outfit1, your manaX is less than it was when you started.

Or to use a specific (but generic) example:
You have 100 mysticality base.
You are wearing brimstone equipment that gives a 50% bonus, so you have 150 mysticality points.
You are trying to heal to full (150) from 30 points down (120), and it decides that 3 seltzers are the best way to accomplish this.
You change equipment to the KG to buy 3 seltzers dropping your max down to 100.
You change equipment back to brimstone (raising max back to 150).
You use 3 seltzers bringing you to 136.
You now need another 14 mana to reach full. 2 more Seltzers.
You switch back to KG, dropping you back to 100 max.
You buy 2 seltzers, and switch back to Brimstone, raising max to 150.
You use 2 seltzers, bringing you to 124.
You need another 3 seltzers to restore those 26 mana.
<repeat until meat stops>
 

Veracity

Developer
Staff member
Step 3 can (in Fluxxdog's example, for instance) reduce your current MP, resulting in 6 failing to top you up, and sending you around the loop again (til meat runs out). It's why I suggested calculating current MP after step 3.
You are correct. So the algorithm becomes:

1. Calculate the total MP you want to restore to
2. Swap to outfit to purchase in.
3. Calculate total - current MP
4. Buy amount of restorers needed to restore the amount calculated in 3.
5. Swap back to starting outfit.
6. Consume restorers.

... and my previous comments regarding step 4 and what it means to "buy the amount of restorers needed" still stand: keeping minimum & maximum in table rather than average, and being smarter about how we use that info: either potentially overbuying enough to restore, assuming min yield, or accepting below average yield, if we are restoring to a percentage.
 
You are correct. So the algorithm becomes:

1. Calculate the total MP you want to restore to
2. Swap to outfit to purchase in.
3. Calculate total - current MP
4. Buy amount of restorers needed to restore the amount calculated in 3.
5. Swap back to starting outfit.
6. Consume restorers.

... and my previous comments regarding step 4 and what it means to "buy the amount of restorers needed" still stand: keeping minimum & maximum in table rather than average, and being smarter about how we use that info: either potentially overbuying enough to restore, assuming min yield, or accepting below average yield, if we are restoring to a percentage.
I agree, this solution ought to kill the problem dead, if implemented correctly.
 

Theraze

Active member
My suggestion would be to, if possible, buy enough to restore considering minimum, consume multiple assuming maximum restoration, then consume singles until the desired restoration is met. Should meet with a good balance between efficiency/speed.
 

Veracity

Developer
Staff member
I like that. Unfortunately, I fully expect to start seeing bug reports from people about KoLmafia "wasting their scarce Meat" by buying more restoratives than it ends up using for the first restoration.
 

Theraze

Active member
Eh, they'll get used the next time around, long as mafia compares their current amount to purchase. For that matter, if the overbuy is implemented, (allowed) inventory should probably get considered on a weighted scale... Current inventory only costs half as much as normal or the like, so that they don't keep buying new items and ignoring the kept items forever.
 

slyz

Developer
If you already have seltzers in your inventory, I think Mafia already takes those into account when buying. If you need 5 seltzers to restore, and have 2 in your inventory, Mafia is only going to buy 3.
 

Theraze

Active member
What I mean though is, if you have those 2 seltzers in your inventory, and mafia has now decided to buy some black cherry cola... will it ever use those seltzers, or just if it happens to fall into where it decides they're optimal? Are we going to end up with the detrius of 30 former restorative choices in our inventory?
 

slyz

Developer
I guess that's a whole other can of worms... I gladly use Bale's Universal Recovery (which also has some logic to avoid the issue at hand, by the way).
 

Veracity

Developer
Staff member
Hence my original comment about buying extras would inevitably lead to people complaining about how KoLmafia is spending their scarce Meat. To which one can always reply "then don't use that feature", which will not stop the complaining, however.
 

Bale

Minion
Whenever I see someone complaining about how mafia doesn't solve their recovery woes I need to stifle, "Then write your own recovery script! It's damn hard to satisfy EVERYONE so please figure out how to satisfy yourself."

One of the reasons that Universal Recovery has so many comments is that when I wrote it I figured many other people would want to write their own recovery scripts and all those comments would help others figure out how to use my script as a model.

Over time I finally accepted that nobody else wanted to write their own recovery script and switched the name of the sript from hardcore recovery to universal recovery in recognition of the fact that my script was branching out to fill the needs of many different types of users. I also stopped using quite as many comments. ;)
 

GValko

Member
An issue with MP restoring tolerances

There's a bit of an issue with Mafia regarding the use of MP restorers and large numbers.

The following is a bit that happened to me when I was trying out one of the choices for the Valhalla invasion back on day 2. My MP drops to below the 20% threshold and then Mafia tries to restore to 100%.

What happens is that since I have Travolan Trousers, Mafia automatically switches them in to buy the MP restorers. (I'm a muscle class, so it's going for black cherry sodas). Mafia then uses the restorers, gets me to the 100% MP.

It then swaps back the original pants I was wearing at the time (sugar shots) which has a +25% to all stats.

This increases my MP.

Now my current MP score is below the 100% threshold.

Then Mafia attempts to get it back to the 100% threshold by equipping the Travoltan Trousers and buying some MP restorers...

I think you can see where this is going. I managed to stop it manually, but I have no idea if there's even a hard cap on # of attempts Mafia will buy MP restorers before aborting.

I will note that I did get a workaround by lowering my automatic MP restorer settings, but this is something that could easily drain meat from an unwary user.

Code:
postwarisland.php?place=nunnery&pwd&action=nuns
You gain 1,000 hit points
You gain 1,000 Muscularity Points

use 1 Oscus's neverending soda
You gain 281 Muscularity Points

equip pants Travoltan trousers

buy 7 black cherry soda at market price from Black Market
You acquire black cherry soda (7)
You spent 532 Meat

equip pants sugar shorts

use 7 black cherry soda
You gain 71 Muscularity Points

equip pants Travoltan trousers

buy 2 black cherry soda at market price from Black Market
You acquire black cherry soda (2)
You spent 152 Meat

equip pants sugar shorts

use 2 black cherry soda
You gain 21 Muscularity Points

equip pants Travoltan trousers

buy 7 Knob Goblin seltzer at market price from The Knob Dispensary
You acquire Knob Goblin seltzer (7)
You spent 532 Meat

equip pants sugar shorts

use 7 Knob Goblin seltzer
You gain 74 Muscularity Points

equip pants Travoltan trousers

buy 1 Knob Goblin seltzer at market price from The Knob Dispensary
You acquire an item: Knob Goblin seltzer
You spent 76 Meat

equip pants sugar shorts

use 1 Knob Goblin seltzer
You gain 8 Muscularity Points

equip pants Travoltan trousers

buy 21 soda water at market price from Market Demon
You acquire soda water (21)
You spent 1,386 Meat

equip pants sugar shorts

use 21 soda water
You gain 91 Muscularity Points

equip pants Travoltan trousers

buy 1 soda water at market price from Market Demon
You acquire an item: soda water
You spent 66 Meat

equip pants sugar shorts

use 1 soda water
You gain 3 Muscularity Points

equip pants Travoltan trousers

buy 9 black cherry soda at market price from Black Market
You acquire black cherry soda (9)
You spent 684 Meat

equip pants sugar shorts

use 9 black cherry soda
You gain 89 Muscularity Points

equip pants Travoltan trousers

buy 1 black cherry soda at market price from Black Market
You acquire an item: black cherry soda
You spent 76 Meat

equip pants sugar shorts

use 1 black cherry soda
You gain 9 Muscularity Points

equip pants Travoltan trousers

buy 8 Knob Goblin seltzer at market price from The Knob Dispensary
You acquire Knob Goblin seltzer (8)
You spent 608 Meat

equip pants sugar shorts

use 8 Knob Goblin seltzer
You gain 80 Muscularity Points
 
Last edited:
I've noticed this happening a lot less frequently since some daily build prior to 14.7... can't remember which one, though. Also, I have not had this happen since then at all... maybe that's because I'm ascending a lot more, and not doing aftercore stuff.
 

ElCarrot

New member
Mp restore not working correctly with Travoltan Trousers

The issue I have been running into occurs in the following situation:

1. I have the Travoltan Trousers in my inventory
2. I have a mood running that purchases something from an NPC store (Such as hair spray)
3. My HP or MP go below the trigger point for restoration in the same turn as the hair spray buff needs to be refreshed.

What happens is that mafia sees that the hair spray buff needs to be refreshed - so it automatically puts on the Travoltan Trousers in order to get the best price. Since my character is a Disco Bandit, my moxie is much higher than my myst - so the "Moxie used to determine Maximum MP" takes effect and suddenly my myst is much higher than it was before.

This is where the problem occurs. My MP was already going to be restored - but now I suddenly have a much larger MP pool than I did before. The MP is then restored with the much higher limit, and then my original pants are restored - losing a large chunk of the MP that was restored and losing the amount of meat spent to restore.

e.g.

1. My MP pool is of size 900.
2. My restore setting is set to restore when it falls below 20% and restore up to 50%
3. My MP hits 170 (below the 180 restore target) at the same time I run low on the hair spray buff
4. The Travoltan trousers are put on automatically - my MP pool is now 2500
5. The Hair Spray buff is purchased from the NPC store and used automatically
6. While the trousers are still being worn, my MP is is restored to 1250 (50% of 2500)
7. The Travoltan trousers are removed - and my MP pool is now back to 900 - losing me 350 MP - and however much meat was spent to restore it to that.

One Additional Note: I just remembered that I have a recovery script set (I am using this one - http://kolmafia.us/showthread.php?1780-Universal-Recovery-Script) - so that might have some bearing on it.

Thanks
 
Top