Bug lastEncounter parses monsters with certain articles inconsistently

For monsters with certain articles, lastEncounter strips the article out of the monster name:
[36769] A Recent Fight
Preference lastEncounter changed from Travel to a Recent Fight to pumpkin spice wraith
Encounter: pumpkin spice wraith
But for other articles, it fails to do so:
[38066] A Recent Fight
Preference lastEncounter changed from Travel to a Recent Fight to The Yuleviathan
Encounter: The Yuleviathan
It looks like the articles it searches for are basically hardcoded in CombatActionManager.encounterKey:
Code:
    if (key.startsWith("a ")) {
      key = key.substring(2);
      line = line.substring(2);
    } else if (key.startsWith("an ")) {
      key = key.substring(3);
      line = line.substring(3);
    } else if (key.startsWith("the ")) {
      // It really is "The Man" or "The Big Wisniewski"
    } else if (key.startsWith("some ")) {
      key = key.substring(5);
      line = line.substring(5);
    }

It looks like there are exactly 69 monsters right now that don't fit this set of articles:
> js Monster.all().filter(({ article }) => !["a", "an", "the", "some", ""].includes(article))

Returned: aggregate monster [69]
And there are exactly 6 articles right now that aren't included in this conga line:
> js Array.from(new Set(Monster.all().map(({ article }) => article).filter((article) => !["a", "an", "the", "some", ""].includes(article))))

Returned: aggregate string [6]
0 => The
1 => Some
2 => A
3 => La
4 => El
5 => An
The CrystalBallManager handles a similar problem by referencing MonsterDatabase.findMonster, which seems to properly check all possible monster articles.

I can throw in a PR for this, but I'm not sure the ideal solution. Should CombatActionManager also reference MonsterDatabase.findMonster? Should I just add those additional 6 articles to the chain of else ifs in CombatActionManger.encounterKey? Is there a third, even better solution?
 
I think that since KoL now actually tells us the "article" associated with a monster, perhaps we could do something else entirely - especially since Fight pages now give us the actual monster id and we shouldn't have to parse the monster name at all, in fights at least.
Which is to say, for every monster, have a map from "official article + name" to monsterId, or something, for cases where all we have is a name.
 
Back
Top