loathers / autoscend

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

Plumber infinite loop when trying to equip fancy boots with work boots already worn in another slot #292

Closed taltamir closed 4 years ago

taltamir commented 4 years ago

Context

Current Behavior

Someone reported this via discord and I confirmed it is an issue. They didn't provide much details on their side but it was not needed since it is so easy to replicate.

> equip acc1 work boots

Putting on work boots...
Equipment changed.

> equip acc3 fancy boots

Putting on fancy boots...
You can't equip a fancy boots because you're already wearing a work boots.

Neither mafia nor kol automatically remove work boots before attempting to equip fancy boots. As a result you can run into this error where it is trying and failing to equip work boots.

Now, it should not happen because we only try to equip them to acc3. but are not actually forcing them into acc3 and if something else already wanted to be there then I think (code is a bit over my head) that it might end up going in acc1 or acc2 slot.

I think there are several ways to solve this.

  1. in auto_pre_av.ash we could replace this

    if (possessEquipment($item[fancy boots]))
    {
        autoEquip($slot[acc3], $item[fancy boots]);
    }

    with

    if (possessEquipment($item[fancy boots]))
    {
        if(equipped_amount($item[work boots] > 0)
        {
            cli_execute("unequip work boots");
        }
        autoEquip($slot[acc3], $item[fancy boots]);
    }
  2. in auto_equipment.ash we could change autoEquip function. I am thinking add into it a call to another function called boolean stripIncompatibles(slot s, item it)

has a list of items with known issues like this and first strips you of incompatible items. Such as the work boots vs fancy boots incompatibility issue. Or if you are trying to add an off-hand item, strip any 2handed item currently equipped and add 1hand to maximizer, etc.

I am leaning towards the second option. But would like to discuss this first with the rest of the team.

taltamir commented 4 years ago

Also, I am bit baffled by the maximizer building code. how exactly is it indicating a target accessory slot? as far as I can tell the maximizer does not allow specifying an accessory slot when telling it to equip something

taltamir commented 4 years ago

https://kolmafia.us/showthread.php?24497-Spring-2020-Challenge-Path-Path-of-the-Plumber&p=156858&viewfull=1#post156858

This is not something mafia will handle for us. So we will have to take care of it on our side

Malibu-Stacey commented 4 years ago

Looks like Veracity caved and changed the mafia handling for us. Time to close.