Bug Maximizer unnecessarily moves weapon to offhand

Veracity

Developer
Staff member
I'm on day two of a Hardcore run. I want to maximize for rollover adventures.

My options are limited.

I set my equipment to have all but one of my suitable items equipped.

Code:
> equip

Hat: Daylight Shavings Helmet
Weapon: June cleaver
Off-hand: unbreakable umbrella (bucket style)
Shirt: Jurassic Parka (kachungasaur mode)
Pants: designer sweatpants
Back: Misty Cape

Acc. 1: mother's necklace (3)
Acc. 2: mother's necklace (3)
Acc. 3: mother's necklace (3)

Pet: Cookbookbat (51 lbs)
Item: miniature crystal ball (locked)

Let's see what the maximizer thinks.

Code:
> maximize advs

Maximizer: advs
Maximizing...
18 combinations checked, best score 32.00
Wielding industrial fire extinguisher...
Equipment changed.
Holding June cleaver...
Equipment changed.

Good. It found my other weapon that grants rollover Adventures. Fortunately, I can dual-wield.

Code:
> equip

Hat: Daylight Shavings Helmet
Weapon: industrial fire extinguisher
Off-hand: June cleaver
Shirt: Jurassic Parka (kachungasaur mode)
Pants: designer sweatpants
Back: Misty Cape

Acc. 1: mother's necklace (3)
Acc. 2: mother's necklace (3)
Acc. 3: mother's necklace (3)

Pet: Cookbookbat (51 lbs)
Item: miniature crystal ball (locked)

Why did it replace my main hand weapon and move the previous one to my off-hand?
 

heeheehee

Developer
Staff member
Hm. There's a notion of "simplicity" used as part of the tiebreaker, which should prevent this.

Either way, I can readily reproduce in tests, which is good for finding a fix:
Code:
  // https://kolmafia.us/threads/maximizer-unnecessarily-moves-weapon-to-offhand.28631/
  @Test
  public void shouldNotMoveWeaponToOffhand() {
    var cleanups =
        new Cleanups(
            withSkill("Double-Fisted Skull Smashing"),
            withEquipped(EquipmentManager.WEAPON, "June cleaver"),
            withEquippableItem("industrial fire extinguisher"));

    try (cleanups) {
      assertTrue(maximize("advs"));
      recommendedSlotIsUnchanged(EquipmentManager.WEAPON);
      recommendedSlotIs(EquipmentManager.OFFHAND, "industrial fire extinguisher");
    }
  }
 

Ryo_Sangnoir

Developer
Staff member
Seems like it might be sorting them so the higher scoring one goes on the offhand. If you edit the test to have "time sword" or "deadfall branch" it passes. With "Staff of Kitchen Royalty" or "cursed pirate cutlass" it fails.

From additional checking: for the failing items, the offhand_melee slot in potentials in MaximizerSpeculation does not contain the fire extinguisher. The "ranked" map in Evaluator does contain both items.
 
Last edited:

heeheehee

Developer
Staff member
(nit: Staff of Kitchen Royalty needs to go in the mainhand, since it's a chefstaff.)

It also seems special to the June cleaver -- if I edit the mainhand to hold a time sword, it works just fine.
 
Top