loathers / autoscend

An ascension script for KoLMafia
Other
45 stars 68 forks source link

Better ML handling #816

Open taltamir opened 3 years ago

taltamir commented 3 years ago

We need some refactoring on how ML is handled. The numerical safety limit is not a really good way to handle "I keep on dying, stop commit suicide due to high ML" issue with autoscend

I think what we need:

  1. a function that predicts our ability to survive a zone in which we are about to adventure, to make sure we do delay zones that are too tough.
  2. consolidate most ML functions into a single pre-adventure function that selects an appropriate ML for the target location based on our situation and the target location (similar to our noncombat adventure file).
  3. allow for path specific exceptions to number 2.. which would be done via functions called from the function at number 2
  4. auto_MLSafetyLimit should be replaced by a cleaner override for manipulating ML. its stated goal is better achieved by a directive to just be more cautious on ML than a digit. Or possibly even removed if we have number 1 implemented
Malibu-Stacey commented 3 years ago

We need some refactoring on how ML is handled. The numerical safety limit is not a really good way to handle "I keep on dying, stop commit suicide due to high ML" issue with autoscend

Agreed, it's pretty horrible code and should all be torn out and redone.

I think what we need:

  1. a function that predicts our ability to survive a zone in which we are about to adventure, to make sure we do delay zones that are too tough.

This is going to be difficult if not almost impossible to do without adding a lot more server hits before every adventure with mafia's current tools.

  1. consolidate most ML functions into a single pre-adventure function that selects an appropriate ML for the target location based on our situation and the target location (similar to our noncombat adventure file).
  2. allow for path specific exceptions to number 2.. which would be done via functions called from the function at number 2

Basically both of these should be covered by a provideMonsterLevel(int amount, boolean doEquips, boolean speculative) function similar to all the other providers. That would allow us to call it in pre-adv up to the safe limit and also override it when we need to for the quests where ML cuts turns (fulminate, oil peak, tavern cellar, one of the cyrpt zones etc) and should also handle all paths etc same as the other provider functions.

  1. auto_MLSafetyLimit should be replaced by a cleaner override for manipulating ML. its stated goal is better achieved by a directive to just be more cautious on ML than a digit. Or possibly even removed if we have number 1 implemented

I think allowing the user to set the value is fine. Cheesecookie did have some code where it would decrement the MCD by 1 every time it got beaten up (which is utterly pointless, 1 ML isn't going to make a difference if you're dying over & over, it also never reset so it would eventually stick at 0 while running like 100+ ML from equipment and/or buffs) but that was before Phate wrote the current flawed ML limit stuff (was in 2019 just after macgregor forked sl_ascend to autoscend IIRC). Until we can figure out a reasonable way to do #1 I think we should stick with a user settable limit.