Bug Enabling "Show old form with Combat Action Bar" breaks end-of-fight tracking

Kasekopf

New member
Recently I was tracking down a strange bug where mafia was detecting that a fight was over at the very beginning of the fight (and returning from an adv1 call), without actually finishing the fight.

I was finally able to repro it myself by checking both "Enable Combat Action Bar" and, crucially, "Show old form with Combat Action Bar" in the KoL combat options. With both of these enabled, the following occurs:
[709] Barf Mountain
Preference lastEncounter changed from horrible tourist family to garbage tourist
Encounter: garbage tourist
Round 0: Kasekopf wins initiative!
Preference cosmicBowlingBallReturnCombats changed from 1 to 0
You acquire an item: cosmic bowling ball
Preference cosmicBowlingBallReturnCombats changed from 0 to -1
Preference _stinkyCheeseCount changed from 102 to 103
Preference lastCopyableMonster changed from horrible tourist family to garbage tourist
Preference _lastCombatWon changed from true to false
Round 0: Kasekopf attacks!
Encounter: garbage tourist
Round 0: Kasekopf loses initiative!
KoLmafia thinks it is round 1 but KoL thinks it is round 2
Round 2: garbage tourist takes 883 damage.
Round 2: Kasekopf wins the fight!
After Battle: You gain 30 hit points
After Battle: You gain 6 Muscularity Points
Your familiar gains a pound: Gaberta, the 12 lb. Trick-or-Treating Tot
After Battle: Gaberta dances around the corpse, shouting "Take that, mean ol' monster!" and then searches their pockets for candy. She's gonna be a damn fine adventurer one day.
After Battle: You gain 4 hit points
After Battle: You gain 4 Muscularity Points
You gain 1046 Meat
After Battle: Cryptic Symphony looks around carefully, and once she's satisfied you're alone, she gives you some meat.
You gain 12 Meat.
After Battle: What would you say if I told you that the garbage tourist has a secret plan for hiding its money.
You acquire an item: fat stacks of cash
After Battle: Gaberta, dressed to the nines in her fancy Prince George costume, orders a random passerby to bring her some extra items. So haughty! (+25% Item Drops)
After Battle: You gain 21 Beefiness
After Battle: You gain 9 Magicalness
After Battle: You gain 8 Sarcasm
You acquire an item: inflammable leaf (2)
After Battle: You gain 1 Mysteriousness
Preference _juneCleaverFightsLeft changed from 6 to 5
Preference _juneCleaverSleaze changed from 114 to 115
Preference _stinkyCheeseCount changed from 103 to 104
Preference _lastCombatWon changed from false to true
Preference _boomBoxFights changed from 5 to 6

Observe that _lastCombatWon and _stinkyCheeseCount changed both after Round 0 (when the fight was still going) and again after Round 2 (when the fight was really over). So I think mafia is incorrectly detecting the fight as over in the very first round. And when scripting, this results in the adv1 call returning without finishing the fight.

Looking at the code, the end-of-fight detection says the fight is still ongoing if the phrase "(show old combat form)" appears, since the combat action bar is on. But because "Show old form with Combat Action Bar" is also enabled this phrase never appears.

Attached is the debug log corresponding to the session log snippet above, which includes the HTML for Round 0 (which was incorrectly marked as completing the fight), and Round 2 (which actually finished the fight).
 

Attachments

  • DEBUG_20231227.txt
    158.8 KB · Views: 0
Top