Bug - Fixed Mafia is suddenly confused about monsters with the same image

Aenimus

Member
Hello,

Every day, I spend some turns in An Incredibly Strange Place (Great Trip), banishing all monsters except my target, which is the Angels of Avalon.

Yesterday, I updated mafia for the first time in a while, so this is the first time I have run the script since I updated Mafia.

It seems like mafia is very confused about what I am fighting; note the item drop is orange (incorrect) instead of blue (correct):
https://i.gyazo.com/thumb/1200/73ace4117431c5f55f978199a7a6a042-png.jpg

But I am indeed fighting the right monster, and got a blue-frosted astral cupcake:
https://i.gyazo.com/9ecc8a3e9d0e9c0e24594d10f8922af4.png

I haven't used macrometeor, and I completely closed Mafia and reopened it. Exact same.

I made an abort to print what mafia thinks the monster is: "Gathering of Angels? is not our pickpocket target of Angels of Avalon."

I have everything banished, although Mafia seems to think I still have a chance to encounter the Gathering of Angels?, even though it's also banished:

https://i.gyazo.com/9a50be1b7a3c59b9c8e47c3320b15a4a.png

Also note that Mafia knows the correct item drops of the monsters in this panel.

Ending the combat and starting a new combat produces the same error.

Did Mafia start to use images as a reference to monsters? These monsters share the same image. That's the only thing I can think of.

If you need any more information, I'd be happy to supply it.

Thanks.
 
Last edited:

Veracity

Developer
Staff member
KoLmafia has always used images to disambiguate monsters that cannot be distinguished by the encounter name.
The commit you mentioned made that a whole lot more efficient.
The question is why the monsters were not recognized by the encounter names, which, as you pointed out, were different.

FWIW, this script:

Code:
boolean [string, monster] image_map;

foreach m in $monsters[] {
    foreach image in m.images {
	if ( image == "" ) {
	    continue;
	}

	image_map[ image, m ] = true;
    }
}

foreach image in image_map {
    boolean [monster] monsters = image_map[ image ];
    if ( count( monsters ) > 1 ) {
	buffer output;
	foreach m in monsters {
	    if ( output.length() > 0 ) {
		output.append( ", " );
	    }
	    output.append( m );
	}
	print( "Image '" + image + "' used by monsters: " + output );
    }
}
yileds this:

Code:
Image 'angbugbear.gif' used by monsters: revolting bugbear, angry bugbear
Image 'angel.gif' used by monsters: Angels of Avalon, Gathering of Angels?
Image 'asparagus.gif' used by monsters: fiendish can of asparagus, fiendish zombie can of asparagus
Image 'astronomer.gif' used by monsters: Astronomer, Astronomer (obsolete)
Image 'aswarm.gif' used by monsters: swarm of killer bees, swarm of lowercase As
Image 'bigskeleton.gif' used by monsters: skeleton invader, procedurally-generated skeleton
Image 'blank.gif' used by monsters: Performer of Actions, Thinker of Thoughts, Perceiver of Sensations
Image 'blankmook.gif' used by monsters: common criminal, uncommon criminal, rare criminal, low-level mook, mid-level mook, high-level mook, former guard, time bandit, burner
Image 'bond_villain5.gif' used by monsters: Villainous Villain, "Blofeld"
Image 'borgelf1.gif' used by monsters: <s>Killer</s> Festive Arc-Welding Elfbot, Arc-Welding Elfborg
Image 'borgelf2.gif' used by monsters: <s>Killer</s> Festive Laser-Calibrating Elfbot, Ribbon-Cutting Elfborg
Image 'borgelf3.gif' used by monsters: <s>Killer</s> Festive Weapons-Assembly Elfbot, Weapons-Assembly Elfborg
Image 'borgelf4.gif' used by monsters: <s>Killer</s> Festive Decal-Applying Elfbot, Decal-Applying Elfborg
Image 'bowser.gif' used by monsters: [2172]Bowser, [2173]Bowser
Image 'butt.gif' used by monsters: CDMoyer's butt, HotStuff's butt, Jick's butt, Mr Skullhead's butt, Multi Czar's butt, Riff's butt, your butt, somebody else's butt
Image 'carpet.gif' used by monsters: Best Carpet Ever, psychedelic fur
Image 'cavefrat.gif' used by monsters: caveman frat boy, caveman frat pledge
Image 'cavewomyn.gif' used by monsters: cavewomyn hippy, werecougar
Image 'cleanpirate.gif' used by monsters: cleanly pirate, gaudy pirate
Image 'clown.gif' used by monsters: scary clown, creepy clown, shaky clown
Image 'colasol1.gif' used by monsters: Cloaca-Cola Soldier, Cloaca-Cola Footsoldier
Image 'colasol2.gif' used by monsters: Dyspepsi-Cola Soldier, Dyspepsi-Cola Knight
Image 'cowskeleton.gif' used by monsters: cowskeleton, skeletal gunslinger
Image 'crimboelf.gif' used by monsters: Striking Factory-Worker Elf, Striking Middle-Management Elf, Striking Pencil-Pusher Elf, Striking Stocking-Stuffer Elf, Striking Gift-Wrapper Elf
Image 'darkness.gif' used by monsters: the darkness (blind), barrow wraith?
Image 'darkstand.gif' used by monsters: animated nightstand (mahogany combat), animated nightstand (mahogany noncombat)
Image 'ed.gif' used by monsters: Ed the Undying (1), Ed the Undying
Image 'ed2.gif' used by monsters: Ed the Undying (2), Ed the Undying
Image 'ed3.gif' used by monsters: Ed the Undying (3), Ed the Undying
Image 'ed4.gif' used by monsters: Ed the Undying (4), Ed the Undying
Image 'ed5.gif' used by monsters: Ed the Undying (5), Ed the Undying
Image 'ed6.gif' used by monsters: Ed the Undying (6), Ed the Undying
Image 'ed7.gif' used by monsters: Ed the Undying (7), Ed the Undying
Image 'elfhobo1.gif' used by monsters: Hobelf, Elf Hobo
Image 'elfhobo2.gif' used by monsters: Hobelf, Elf Hobo
Image 'elfhobo3.gif' used by monsters: Hobelf, Elf Hobo
Image 'elfhobo4.gif' used by monsters: Hobelf, Elf Hobo
Image 'elfhobo5.gif' used by monsters: Hobelf, Elf Hobo
Image 'elfhobo6.gif' used by monsters: Hobelf, Elf Hobo
Image 'elfhobo7.gif' used by monsters: Hobelf, Elf Hobo
Image 'elfhobo8.gif' used by monsters: Hobelf, Elf Hobo
Image 'elizabeth.gif' used by monsters: ghost of Elizabeth Spookyraven, restless ghost
Image 'foss_wyrm.gif' used by monsters: Bonerdagon, reanimated wyrm skeleton
Image 'fratboy.gif' used by monsters: Orcish Frat Boy (Music Lover), Orcish Frat Boy (Paddler), War Pledge
Image 'gamblinman.gif' used by monsters: gamblin' man, surly gambler
Image 'gremlinbat.gif' used by monsters: batwinged gremlin, batwinged gremlin (tool)
Image 'gremlinglasses.gif' used by monsters: erudite gremlin, erudite gremlin (tool)
Image 'gremlinspider.gif' used by monsters: spider gremlin, spider gremlin (tool)
Image 'gremlinveg.gif' used by monsters: vegetable gremlin, vegetable gremlin (tool)
Image 'haiku2.gif' used by monsters: Guard Bugbear, ferocious bugbear
Image 'hippy1.gif' used by monsters: filthy hippy, filthy hippy Vegan chef, filthy hippy jewelry maker
Image 'hippy2.gif' used by monsters: dirty hippy, dirty hippy Vegan chef, dirty hippy jewelry maker
Image 'hippy3.gif' used by monsters: crusty hippy, crusty hippy Vegan chef, crusty hippy jewelry maker
Image 'hobo.gif' used by monsters: drunken half-orc hobo, hung-over half-orc hobo
Image 'illegal_alien.gif' used by monsters: illegal alien, legal alien
Image 'kasemhead.gif' used by monsters: Trippy Floating Head (Casey Kasem), talking head
Image 'kg_guardcaptain.gif' used by monsters: Knob Goblin Elite Guardsman, Knob Goblin Elite Guard Captain
Image 'kg_king.gif' used by monsters: Knob Goblin King, new Knob Goblin King
Image 'kg_madsci.gif' used by monsters: Knob Goblin Mad Scientist, Sub-Assistant Knob Mad Scientist
Image 'larryscrote.gif' used by monsters: [2050]Jerry Bradford, [2051]Jerry Bradford, [2052]Jerry Bradford, [2053]Jerry Bradford, [2054]Jerry Bradford, [2055]Jerry Bradford, [2056]Jerry Bradford, [2057]Jerry Bradford, [2058]Jerry Bradford, Jerry Bradford, Pokéfam World Champion
Image 'lich.gif' used by monsters: lihc, senile lihc, slick lihc, basic lihc
Image 'lilfratboy.gif' used by monsters: orcish juvenile delinquent, orcish frat wannaboy
Image 'lower_b.gif' used by monsters: acid blob, lowercase B
Image 'lower_h.gif' used by monsters: mind flayer, lowercase H
Image 'lower_k.gif' used by monsters: large kobold, lowercase K
Image 'meatblob.gif' used by monsters: flame-broiled meat blob, overdone flame-broiled meat blob
Image 'miner.gif' used by monsters: 7-Foot Dwarf (Royale), 7-Foot Dwarf (Moiling), 7-Foot Dwarf Replicant
Image 'nhobo1.gif' used by monsters: Normal hobo, simple hobo
Image 'nightstand.gif' used by monsters: animated nightstand (white combat), animated nightstand (white noncombat)
Image 'noart.gif' used by monsters: Slime Tube monster, one of Doctor Weirdeaux's creations, time-spinner prank
Image 'orangutan.gif' used by monsters: Ourang-Outang, jungle baboon
Image 'outlawboss.gif' used by monsters: outlaw leader, hired gun
Image 'penggoon.gif' used by monsters: Mob Penguin Goon (2009), Mob Penguin organizer
Image 'penghammer.gif' used by monsters: Mob Penguin steel driver, Mob Penguin negotiator
Image 'pengthug.gif' used by monsters: Mob Penguin Thug, Mob Penguin hitman, Mob Penguin enforcer, Mob Penguin Kneecapper, penguin mafioso, Mob Penguin union rail worker, Mob Penguin protector
Image 'pirate1.gif' used by monsters: sassy pirate, swarthy pirate, smarmy pirate, shady pirate
Image 'pirate2.gif' used by monsters: shifty pirate, groovy pirate, creamy pirate, chatty pirate, clingy pirate (male), whiny pirate, witty pirate, migratory pirate, ambulatory pirate, peripatetic pirate
Image 'protspirit.gif' used by monsters: ancient protector spirit, ancient protector spirit (The Hidden Apartment Building), ancient protector spirit (The Hidden Hospital), ancient protector spirit (The Hidden Office Building), ancient protector spirit (The Hidden Bowling Alley), ancient protector spirit (obsolete)
Image 'qmark.gif' used by monsters: Video Game Minion (weak), Video Game Minion (moderate), Video Game Minion (strong)
Image 'regbat.gif' used by monsters: regular old bat, vampire bat
Image 'reindeer.gif' used by monsters: Rudolph the Red, Dopey, the Reindeer, Sleepy, the Reindeer, Happy, the Reindeer, Bashful, the Reindeer, Grumpy, the Reindeer, Doc, the Reindeer, Sneezy, the Reindeer, Zeppo, the Reindeer
Image 'snowman.gif' used by monsters: Ninja Snowman (Hilt/Mask), Ninja Snowman (Mask), Ninja Snowman (Hilt)
Image 'spacebeast3.gif' used by monsters: space beast, space beast matriarch
Image 'spagcult2.gif' used by monsters: evil spaghetti cult assassin, evil spaghetti cult technician
Image 'steward.gif' used by monsters: skeletal sommelier (obsolete), skeletal sommelier
Image 'tnbot1.gif' used by monsters: Thinknerd Sorting Robot, Thinknerd Moving Robot, Thinknerd Packing Robot
Image 'tnbot2.gif' used by monsters: Thinknerd Sorting Robot, Thinknerd Moving Robot, Thinknerd Packing Robot
Image 'tnbot3.gif' used by monsters: Thinknerd Sorting Robot, Thinknerd Moving Robot, Thinknerd Packing Robot
Image 'unknownghost.gif' used by monsters: The Unknown Seal Clubber, The Unknown Turtle Tamer, The Unknown Pastamancer, The Unknown Sauceror, The Unknown Disco Bandit, The Unknown Accordion Thief
Image 'upper_q.gif' used by monsters: Quantum Mechanic, uppercase Q
Image 'vib1.gif' used by monsters: menacing construct, menacing construct (translated)
Image 'vib2.gif' used by monsters: bizarre construct, bizarre construct (translated)
Image 'vib3.gif' used by monsters: industrious construct, industrious construct (translated)
Image 'vib4.gif' used by monsters: towering construct, towering construct (translated)
Image 'vib5.gif' used by monsters: lonely construct, lonely construct (translated)
Image 'vib6.gif' used by monsters: hulking construct, hulking construct (translated), unusual construct
Image 'warfrata.gif' used by monsters: War Frat 151st Infantryman, Frat Warrior drill sergeant
Image 'warhipb.gif' used by monsters: War Hippy (space) cadet, War Hippy Baker
Image 'werewolf.gif' used by monsters: warwelf, wolfman
Image 'whirlwind.gif' used by monsters: tonic water elemental, oasis monster
Image 'winerack.gif' used by monsters: possessed wine rack (obsolete), possessed wine rack
Image 'wingedyeti.gif' used by monsters: Groar, Your winged yeti
Image 'yakguard.gif' used by monsters: yakuza guard, yakuza thug
Image 'yeti.gif' used by monsters: Knott Yeti, panicking Knott Yeti
Image 'zombie2.gif' used by monsters: zmobie, zombie zmobie, white zombie
 

Aenimus

Member
Is there anything I can do to help trace the issue?

Also, I'm going to request that MonsterID be included in the html, which would solve everything, I think.
 

Veracity

Developer
Staff member
Is there anything I can do to help trace the issue?
None of my characters have run turns today. I used a couple of astral mushrooms and found the Angels of Avalon.

Code:
[color=green]> test load angels.html[/color]

Read 14,716 bytes into a 14,716 character string

[color=green]> test monster[/color]

Gathering of Angels?
I have everything I need to debug this.

Also, I'm going to request that MonsterID be included in the html, which would solve everything, I think.
That would be super convenient. We have a ton of code to deal with OCRS modifiers and all sorts of other complexities.
We'd still need to disambiguate a handful of monsters which have the same monster ID. Ed, for example:

Code:
Ed the Undying	473	ed.gif,ed2.gif,ed3.gif,ed4.gif,ed5.gif,ed6.gif,ed7.gif	NOCOPY Atk: 180 Def: 162 HP: 1 Init: -10000 P: undead
Ed the Undying (1)	0	ed.gif	BOSS NOMANUEL HP: 256 Def: 162 Atk: 180 Exp: [75+ML/3] Init: 10000 P: undead
Ed the Undying (2)	0	ed2.gif	BOSS NOMANUEL HP: 256 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead
Ed the Undying (3)	0	ed3.gif	BOSS NOMANUEL HP: 128 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead
Ed the Undying (4)	0	ed4.gif	BOSS NOMANUEL HP: 64 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead
Ed the Undying (5)	0	ed5.gif	BOSS NOMANUEL HP: 32 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead
Ed the Undying (6)	0	ed6.gif	BOSS NOMANUEL HP: 16 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead
Ed the Undying (7)	0	ed7.gif	BOSS NOMANUEL HP: 8 Def: 162 Atk: 180 Exp: [75+ML/3] Init: -10000 P: undead	Holy MacGuffin (n100)
There is Ed the Undying, as he appears in Monster Manuel, and his 7 stages, which we disambiguate via image and pass to cosult scripts.
 

Veracity

Developer
Staff member
OK. Revision 20150 does this:

Code:
[color=green]> test load angels.html[/color]

Read 14,716 bytes into a 14,716 character string

[color=green]> test monster[/color]

Angels of Avalon
The issue is that KoL often includes "a " or "an " or "the " in front of a monster name, even though that is not actually part of the monster's name, as we see in Manuel.
We stripped off "a " and "an " before doing an exact name lookup, but not "the", since there are plenty of monsters that have that: "The Man", "the gunk", etc.
If we are looking for an exact match - from KoL - as opposed to a fuzzy match - from the user - if the monster name lookup failed, I made it try again with "the " or "The " stripped off.
 

Aenimus

Member
Appreciated, Veracity. I'll let you know re: html stuff. Earliest I'll hear about it will be Monday, probably.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
I actually won't have the time to work on it today so feel free if you want V
 
Top