Bug - Fixed Ed (1) or just Ed?

Theraze

Active member
I get this and it breaks automation every time...
[2109] The Lower Chambers (Empty/Rubble)
Encounter: Ed the Undying
Strategy: C:\Program Files (x86)\KoLMafia\ccs\default.ccs [default]
Round 0: Theraze loses initiative!
You lose 18 hit points
(unable to macrofy due to action: consult SmartStasis.ash)
Monster value: -0.9
HP/round from Mosquito: 5
Profit per round: 11.43
Bad monster value: "ed the undying"
Bad monster value: "ed the undying"
Bad monster value: "ed the undying"
You're on your own, partner.

I believe the issue is that while every other form of Ed has a number, the initial one at least appears to be unnumbered... he appears like this in monsters.txt
PHP:
Ed the Undying (1) HP: 256 Atk: 180
Ed the Undying (2) HP: 256 Atk: 180
Ed the Undying (3) HP: 128 Atk: 180
Ed the Undying (4) HP: 64 Atk: 180
Ed the Undying (5) HP: 32 Atk: 180
Ed the Undying (6) HP: 16 Atk: 180
Ed the Undying (7) HP: 8 Atk: 180 Holy MacGuffin (n100)

I believe that removing the (1) would fix this issue.
 
I believe this would fix a bug report that I filed a while ago stating that Ed didn't have any ML/stats for the first round. I've gotten used to my flyer % being off by about 2.5%, haha.
 
Do we know what is giving the "Bad monster value: "ed the undying"" message?

If this condition is true:
PHP:
if (last_monster() == $monster[none] && to_int(vars["unknown_ml"]) == 0)
FTF will abort saying you should handle the unknown monster yourself. Is your "unknown_ml" zlib setting set to something other than 0?

If Mafia parses the HTML of the fight and doesn't recognize you are fighting Ed, then it is a Mafia bug. The fact that SmartStasis returns a negative Monster value supports that, since meat_drop($monster[none]) returns -1.

I'll be fighting Ed today, I'll edit this post to post the result of doing "ash last_monster()" in the gCLI.
 
Unknown_ml is set to 170 or something like that currently. As well, as roippi says above, mafia is unaware in the relay browser (which you have to use after you get the error report, above) of how much health, attack, or defence Ed (the original) has.
 
Code:
[663] The Lower Chambers (Empty/Rubble)
Encounter: Ed the Undying
Round 0: slyz loses initiative!

> ash last_monster()

Returned: none

> get lastEncounter

Ed the Undying

> ash get_property("lastEncounter").to_monster();

Returned: none
It seems like Theraze nailed the cause.

EDIT:
In the Relay Browser, the name of the second form is still Ed the Undying, although this time Mafia seems to know it's the second form:
Code:
(...)
You gain 24 Beefiness
You gain 65 Mysteriousness
You gain 19 Cheek
Encounter: Ed the Undying
Round 0: slyz wins initiative!
KoLmafia thinks it is round 2 but KoL thinks it is round 1

> ash last_monster()

Returned: Ed the Undying (2)

> get lastEncounter

Ed the Undying

> ash get_property("lastEncounter").to_monster();

Returned: none
In both cases, the source of the page shows:
Code:
<span id='monname'> Ed the Undying</span>
but I don't know if Mafia changed it or if it's the actual KoL HTML.
 
Last edited:
It seems mafia has each of the other forms properly identified with the (2), but the first one doesn't work with that... We'll have to see if the non-numbered Ed properly matches, or if he catches all of the other Eds as well.
 
Maybe it's because the first encounter is the result of a noncombat? I tried to go through what happens in the code but I got lost ^^
 
From consequences.txt:
Code:
MONSTER	Ed the Undying	/ed(\d)\.gif	"Ed the Undying ($1)"

This doesn't work for the first one, because that's not ed1.gif; it's only ed.gif ...
(confirmed just now by looking up http://images.kingdomofloathing.com/adventureimages/ed.gif and http://images.kingdomofloathing.com/adventureimages/ed1.gif and http://images.kingdomofloathing.com/adventureimages/ed2.gif)

You could eighter use
Code:
MONSTER	Ed the Undying	/ed(\d?)\.gif	"Ed the Undying ($1)"
and rename Ed the Undying (1) to Ed the Undying ()
OR
Code:
MONSTER	Ed the Undying	/ed\.gif	"Ed the Undying (1)"
MONSTER	Ed the Undying	/ed(\d)\.gif	"Ed the Undying ($1)"

add support for multiple consequences (right now, there's only one consequence registered for a monster name - this would have to be changed to a list of consequences, with stopping at the first matching consequence)


ETA: I *guess* you could also kludge in a special exception, or bruteforce a s/ed\.gif/ed1.gif/ first, but I strongly suspect that would not be a very good, clean and extensible solution.
 
The first one would be best given the choice, I think... I'll try that one out tonight. Basically, just the ? after the \d so that it's a 0 or 1 option. Kludge is a bad thing, given the choice... Multiple consequences would be another viable option, but...

<looks>

Wait, it looks like there's already support for similarly named monsters in the other monsters above... If we put in a . for the gif name, could that just go to Ed the Undying (1)? Like this...
PHP:
MONSTER Ed the Undying /ed(\d)\.gif "Ed the Undying ($1)"
MONSTER Ed the Undying . "Ed the Undying (1)"

Looks like it should be the same as the method used for the other 4 multiple monsters...

Edit: Attached a patch for consequences. Not sure how long it'll be until I get to test, but shouldn't be more than a day or two. If someone else gets to test first though, let me know and I'll move onto the next attempt.
 

Attachments

Last edited:
Oh look, Consequence has a .next member, they make a linked list (which strikes me as a bad practice, since Java already has containers, and reinventing wheel tends to make the code more difficult to understand for people who just assume that not using standard components means you are not doing what the standard components are there for, but I digress ...)!
That makes your patch the way to go.
 
Yeah, it's been working great for me, I just forgot to let people know that it worked fine. Probably commitable... don't think consequences has been updated to need a new patch.
 
I actually set up to test this, changed consequences.txt inside the .jar, then fought Ed 7 times without really looking .. and now I am doing level-30 run, so no longer being able to test every 3 days x_x
 
Yeah... my only issues were when it wanted to heal between fights, which breaks automation since the healing can't happen... still in a fight. :)
 
Back
Top