Feature - Implemented Tracking Combat Monster Level

Theraze

Active member
Eventually it will, but not initially? If it were immediately detected, then we could go with the high number. At that point, we could just swap the numbers over.

Since the delevelling numbers aren't actually tracked in the code at all currently, there's nothing to allow for ranges to be handled easily without either making a new data file or a map at the top of FightRequest... May be worth doing eventually, but I'd rather it just worked first before I start making it more complicated and configurable.

I'll add in the additional skills soon, but the biggest hitch I've run into is the combat item parsing. The FightRequest.parseCombatItems function appears to just be used to fix the inventory numbers for combat items... it doesn't appear to be used for actually processing fight item messages. If nothing actually does the parsing, as I said earlier, I'll need to add the detection in myself, but if there's anything that parses it already, NOT duplicating code-checks would be a good thing. :)
 

Winterbay

Active member
I'm going to go out on a limb here and assume that they are not detected at the moment, not in a reliable way anyway, since the detection of lost combat items seems to happen at the beginning of a battle when the (known) inventory seems to be checked against the list of currently available combat items. ("Adjusting numbers of X by Y" is a quite common message I feel).

That said I tried going into the Haiku dungeon but my level 18 DB had trouble not one hit killing the darn monsters in a reliable way and the messages I got out of using my dwarven mattock did not seem to indicate any specific messages. It'll be a couple of days (aiming for the level 30 trophy) before I ascend again (into AT) so it will be a while before I can help out with that.
 

Theraze

Active member
Thanks... I'll be eagerly waiting to see what the haiku equivalent of the looks weaker message is... In the meantime, I THINK that the actual item usage processing is done in FightRequest.registerRequest... That's where item usage logging happens, so I'm going to believe it that it's also the location it actually gets used. If that's the case, I'll put them all into a new function called FightRequest.processCombatItems... Since I need to call it at least twice, once for item1 and once for item2, I may as well put them into a discrete function so it only needs to get updated once for new values. If this works, combat items will be tracked... all we need is updated values (I used low, not low-mid values initially), a few more skills that generally look spaded already and should be VERY easy to add, and then the extra haiku tracking... Hopefully if tomorrow goes well I should have an updated patch with item ML tracking in.

Edit: Too tired to update the numbers properly now, but here's a snippet of gCLI from my current build:
> monster_level_adjustment

Returned: 0
Round 2: Marigron uses the spectre scepter!
Round 3: lobsterfrogman takes 9 damage.
You gain 9 hit points

> monster_level_adjustment

Returned: -1
Round 3: Marigron uses the spectre scepter!
You gain 4 hit points
Round 4: lobsterfrogman takes 8 damage.
You gain 8 hit points

> monster_level_adjustment

Returned: -2
 
Last edited:

Winterbay

Active member
Ok, so I managed to get myself poisoned enough that I could go two rounds without killing the monster. Equipping nothing but the yak whip (-2 to -4 in ML according to the wiki) and using normal attacks I did a bunch of rounds and noticed the following texts:

Code:
You're the bus driver
so you take your foe to school:
11 damage.

-

Justice comes swiftly
courtesy of your weapon
you do 10 damage.

-

You do 10 damage
like a peaceful summer rain
that does 10 damage.

-

You do 10 damage
like a peaceful summer rain
that does 10 damage.

-

You deal 9 damage
with a thrust of your weapon.
Nearby, a loon honks.

-

Justice comes swiftly
courtesy of your weapon
you do 9 damage.

-

Your weapon flashes
a flock of herons takes flight
you hit 13 times

Using a normal weapon (well Clown hammer) I got the following messages:

Code:
11 damage
as the stars wheel overhead
monster vertigo.

-

Frogs avert their eyes
as you strike for 10 damage
sissy little frogs.

-

Curiosity
dealt 9 damage to the cat.
Like you to your foe.

-

Frogs avert their eyes
as you strike for 8 damage
sissy little frogs.

-

You do 8 damage
like a peaceful summer rain
that does 8 damage.

-

You deal 9 damage
with a thrust of your weapon.
Nearby, a loon honks.

-

Curiosity
dealt 9 damage to the cat.
Like you to your foe.

There is quite a large over-lap between the two sets which, to me at least, indicates that there might not be any specific message for the Haiku dungeon. More testing will be needed though I guess.
 

Theraze

Active member
No message about the enemy being weakened or anything like that? Maybe they just forgot to add a weakening haiku message... if so, likely nothing we can detect on, unless we want to detect based on damage instead of actually seeing the message, which presents problems for damage item usage and so on... Probably best to skip detecting weapon weakening in the haiku dungeon presently, since it's not really a viable place for much besides amusement. Though I may still put together a "detected haiku" check... maybe attach an encounter/weapon check to round 0.

Edit: Monsters healing in the logs.
[1263] Defiled Cranny
Encounter: Lunchtime
Encounter: huge ghuol
Strategy: C:\Program Files (x86)\KoLMafia\ccs\default.ccs [default]
Round 0: Teravhew loses initiative!
(unable to macrofy due to action: consult SmartStasis.ash)
Round 1: Teravhew uses the can of Ghuol-B-Gone™!
Round 2: huge ghuol takes 68 damage.
Round 2: huge ghuol takes 3 damage.
You gain 3 hit points
Round 2: huge ghuol heals 10 hit points.
Round 2: Teravhew uses the can of Ghuol-B-Gone™!
Round 3: huge ghuol takes 73 damage.
You gain 198 Meat
You acquire an item: ghuol egg
You acquire an item: ghuol ears
You gain 9 Beefiness
You gain 19 Wizardliness
You gain 28 Smarm

Okay, will be implementing the following items, for now. If there are any others that delevel, or my numbers look wrong anywhere, let me know.
Source Type Min Max
kite 12 12
The Big Book of Pirate Insults 10 10
off-white plastic oyster egg 7 7
possessed top 6 6
top 6 6
ferret bait 5 5
sake bomb 5 5
wussiness potion 5 5
vial of patchouli oil 4 4
Knob Goblin stink bomb 3 3
disease 2 2
64735 scroll 1 3
668 scroll 1 3
spectre scepter 1 3
barbed-wire fence 1 7
tropical orchid 1 7
mylar scout drone 10 12
powdered organs 10 12
depantsing bomb 15 20
sausage bomb 15 20
gob of wet hair 2 3
shaving cream 2 3
Cloaca grenade Attack 2 2
Dyspepsi grenade Attack 2 2
bronzed locust 20 30
golden ring 20 30
Miniborg Destroy-O-Bot 3 5
Miniborg strangler 3 5
plot hole 3 5
patchouli incense stick 3 5
handful of sawdust 4 10
fancy bath salts 4 5
roofie 4 5
inkwell 4 7
Zombo's empty eye 40 40
handful of sand 5 10
Tom's of the Spanish Main Toothpaste 6 8
black pepper 7 10
superamplified boom box 8 10
macrame net 8 10
palm-frond net 8 12
divine cracker 10 12

30669 scroll 1 3
33398 scroll 1 3
8-ball 1 3
potion of confusion 2 3
potion of sleepiness 2 3
potion of ettin strength Attack 20 30
potion of mental acuity 10 15
potion of blessing Defence 20 30
potion of teleportation Defence 15 20
potion of healing Healing 14 16

Entries on the bottom are either not listed in the monster level page of the wiki, or I somehow missed seeing them. As well, I added the healing bang-potion, since I'm making this patch track monster healing as well, so bang-heal-potion use should display as healing the monster...

I followed the suggestion from the discussion of bang potions for ettin strength and mental acuity... since blessing is 20-30 defence for moxie, ettin is likely 20-30 attack and mental acuity likely splits the two. If anyone has more accurate information on this, it would be appreciated.

I'm hoping to spin a new patch either after work or inlaws, depending on how much the code fights. The reason I'm listing min/max is that I'm planning on saving min/max values, and modifying based on a number set at the top of the function. Eventually, this could be set by the user. What I'm currently planning is 0 (default) for low, 1 for 25%, 2 for 50%, 3 for 75%, and 4 for 100% of the range. So 1-9, you're looking at 1/3/5/7/9 as those numbers. Mostly because I don't think people really need to make it more granular, since the delevelling isn't that broad in terms of range. I'll probably floor the ranges as well, so in a 1-3 range, 0/1 return 1, 2/3 return 2, and 4 returns 3. The point of this is that once I actually decide that everything is as accurate as we can make it, we can start to use these numbers based on mobs missing/hitting and dodging/being-hit to figure out with ML/MA/MD the mob is currently at. The main difficulty here is that there are so many different hit/miss/dodge messages to deduce between...
 
Last edited:

Theraze

Active member
Okay, new patch up that supports combat item usage. New function, processCombatItem is called during registerRequest, when the item is actually used. Most items have a range of min/max ML, though a few are just MA or MD, and there's one that heals the monster. All of these I'm aware of should be tracked. This should also successfully track bang potions, though it's possible that it may not before identification, as my function is called during the request itself, and the identification function is called during updateCombatData. I'm hooked into there so that I can guarantee using the right itemId, without needing to slow users down any more by complicated reparsings of messages, but it does mean that the first usage of a specific bang potion will likely not update monster stats correctly.

Sidenote on processCombatItem, added a 'range' value that can be set from 0-4. It decides which 25% of range you want based on the value. Defaulted/set it to 1 currently (25% of the range, so a 1-9 ML delevel reads as 3), but may eventually allow this to be set as a user or global variable.

Besides this, also added successfully insulting pirates delevelling them by 10.

Remaining: Additional skills, jiggling chefstaves, familiars... and what else?

Edit: Heh. Oops. Used .equals instead of .contains for the Bang names, which doesn't work since each ascension the exact names will likely be different. Changed it on my copy, but won't upload until the next patch since nobody else compiles test versions of this anyways. :D
 
Last edited:

Veracity

Developer
Staff member
New function, processCombatItem is called during registerRequest, when the item is actually used.
That can't be right. registerRequest is called when we are about to submit a URL - and that is all the info you have available.
FightRequest.payItemCost is called with the actual response text and the itemId that was used.
 

zarqon

Well-known member
Just a note about ranges: assuming you're using mid-low for deleveling, that should translate to mid-high for anything that buffs the monster. In other words, if an item heals or +levels the monster for 6-10 HP/ML, the calculation should use 9 rather than 7.
 

Theraze

Active member
Re: Veracity - I looked at that but rejected it... not sure why at the moment, probably because it was only the two toys and shrinking powder. I'll merge into there and take over. :D

Re: zarqon - Yes... the only positive item I've noted so far creates an effect (memory of aggressiveness, I think?), which is checked outside the immediate combat rules... I don't need to do anything regarding its information, because it's tracked by KoLmafia already. On our positive bang potions, they do that by reversing the min/max... which reminds me, they buff the monster, so I really need to swap those. :D

In the last few hours, I've added the wing buffet, the bird, whirlwind, and spray sap. Now that I noticed the mighty shout I'll verify its number and add it as well. [Edit: Mighty Shout isn't listed as delevelling anywhere except in your post. Is this verified?]

Then check on how best to handle jiggling chefstaves... it was going to be easy adding to the request, but I'll actually need to look now that I'm merging payItemCost into oblivion. Not sure if that gets called on chefstaves yet... Anyways, on to adding mighty shout, chefstaff (easy if only one, especially if it passes along the itemId) and the massive movement, made more difficult by that it's not ALL items in there that have something happening... ah well. :)
 
Last edited:

Veracity

Developer
Staff member
Re: Veracity - I looked at that but rejected it... not sure why at the moment, probably because it was only the two toys and shrinking powder.
Well, you can either merge in with the "correct" way to do things, as created by those who came before you, or you can put it somewhere else and guarantee that your code will never make it into an official release.

I'm glad you are reconsidering.

Edit: payItemCost is called by payActionCost, I believe, which is where skills and so on get accounted for. When in doubt, look at the big picture and update the routine that is already dealing with what you are adding - unless you are adding something completely, brand-spanking new - which you are not.
 
Last edited:

zarqon

Well-known member
Scratch Mighty Shout, not sure where I found that information -- it's not presently on the Wiki. My post did leave out Shieldbutt, though (delevel 5).

Looks like the list here is fairly comprehensive, and sortable!
http://kol.coldfront.net/thekolwiki/index.php/Monster_level#Combat_Effects

Also, hope you're matching all the plural/singular words (i.e. "its/their"), not just "opponent/opponents".

I'm throwing all this stuff at you because I love that it's getting done, and want to make sure it's done right. Thanks again.
 
Last edited:

Theraze

Active member
Well, you can either merge in with the "correct" way to do things, as created by those who came before you, or you can put it somewhere else and guarantee that your code will never make it into an official release.

I'm glad you are reconsidering.

Edit: payItemCost is called by payActionCost, I believe, which is where skills and so on get accounted for. When in doubt, look at the big picture and update the routine that is already dealing with what you are adding - unless you are adding something completely, brand-spanking new - which you are not.

Well, I'd been asking for where the 'right' place was since 9/29, and didn't get the right location until after I'd made a workaround... Wasn't that I wanted to do it there, was that it was a necessity due to information given.

Anyways, putting it into payItemCost means I get to verify jiggling the chefstaff instead of just expecting it to only get called on jiggle. It's been done, but I need to test it before I'll spin another patch.
 

zarqon

Well-known member
Also didn't see this in your first post yet: Boss Bat also has a vampiric MP-draining attack.

Also I wonder about these MP-draining attacks, if you have 0 MP, what will the message say? Is it capped at 1, even if you don't have any MP (like the message for healing when already at maximum -- "You gain 1 HP")? It's a possible source of incorrect monster HP calculation.
 

Veracity

Developer
Staff member
Well, I'd been asking for where the 'right' place was since 9/29, and didn't get the right location until after I'd made a workaround... Wasn't that I wanted to do it there, was that it was a necessity due to information given.
Oh my god! You asked five days ago and didn't get an answer until yesterday! It's as if everybody who might be able to answer our question had more important things to do in their lives than to immediately Snap To It and help you with your project!

I suggest that you continue to study the code and learn more about how it is put together. Chances are, there is one "right" place to add something - and it will be obvious to you, once you understand the code well enough.

And, because I'm feeling sort of irked, I'll comment that that when I was talking with zarqon about monster level tracking in KoLmafia, many months ago, it was all cool - until he publicly stated that he was stopping work on BatMan because KoLmafia core support for it wasn't coming along as fast as he wanted. At which point, I shrugged, and turned my attention elsewhere; I don't use scripts, will never even look at BatMan, and, although I am happy that people write things like it, I refuse to be blackmailed or guilt-tripped into spending my precious time supporting 3rd-party add-ons (or is it 4th-party; is KoLmafia itself a 3rd-party add-on to KoL?) unless it's something I will personally use or will find personally fulfilling to work on - and that last category has been shrinking rapidly, just as my interest in getting my Startup company going has increased.

Curmudgeonly yours,
Bah, Humbug.
 

Theraze

Active member
Boss Bat was actually already there, bizarrely, as the only detected mob healing. But only detected if you had logging monster health on... it would detect the damage done, wouldn't detect damage healed. Bizarre. Resolved in the patch.

I'd actually been looking at that list. Not sure how I managed to miss out on the scrolls and 8-ball, but they're all in now. I think.

Believe that delevelling messages just use opponent/opponents, but I'm not sure... I'd need something that's a definite non-gendered to test out an "it" mob. Something more non-gendered than anything in the Haunted Ballroom, which already seemed about as non-specific as I could easily think through...

Anyways, I THINK that I'm up to testing items... and Psalm of Pointiness hits should now delevel...

If the items work properly, I get the 'joy' of adding tons of familiars to the familiar action segment... Whee. Heh.
 

Theraze

Active member
Oh my god! You asked five days ago and didn't get an answer until yesterday! It's as if everybody who might be able to answer our question had more important things to do in their lives than to immediately Snap To It and help you with your project!

I suggest that you continue to study the code and learn more about how it is put together. Chances are, there is one "right" place to add something - and it will be obvious to you, once you understand the code well enough.

And, because I'm feeling sort of irked, I'll comment that that when I was talking with zarqon about monster level tracking in KoLmafia, many months ago, it was all cool - until he publicly stated that he was stopping work on BatMan because KoLmafia core support for it wasn't coming along as fast as he wanted. At which point, I shrugged, and turned my attention elsewhere; I don't use scripts, will never even look at BatMan, and, although I am happy that people write things like it, I refuse to be blackmailed or guilt-tripped into spending my precious time supporting 3rd-party add-ons (or is it 4th-party; is KoLmafia itself a 3rd-party add-on to KoL?) unless it's something I will personally use or will find personally fulfilling to work on - and that last category has been shrinking rapidly, just as my interest in getting my Startup company going has increased.

Curmudgeonly yours,
Bah, Humbug.

:) Sorry, I wasn't trying to complain hard and annoy. I was just trying to say that as those actually appeared to be linked to the function name - namely, both of the toys were there to pay their item costs, and I wasn't trying to do something based on the item cost, rather parsing item actions - it didn't appear to be the proper location to put it. My goal was NOT to hijack functions that aren't meant for things...

As I said, I looked through the code, saw that function, considered it, looked at what it had been used for, the items currently using it made sense in context of function name, and delevelling seemed a major change to its current purpose, so decided that a function specifically for parsing combat item usage would make the most sense. If it was meant as a general "parse item usage" function though, as you suggested, I'm happy to glom on there.

I've actually been looking for the right place for a bit over a month off and on... it's been why I delayed in doing this until now. Everytime I looked for where to attach combat items, I couldn't find anywhere that seemed 'right' and so I'd give up on the project. It took until this time where I decided I didn't care about getting combat items in initially and I'd start with weapon delevelling that I spent enough time to find (and reject) the right place. :)
 

zarqon

Well-known member
I believe I explicitly mentioned in this post that I was not intending the halt of BatMan development as pressure to the devs -- I understand that it's my project, not yours, and any help you provide is at your own discretion. Blackmail was not my intent; I just needed to give an explanation to people as to why BatMan was not forthcoming. I do not have an entitlement attitude; I appreciate all that you have done and have said so many times. I really have no idea where you picked up that attitude from me.
 

Theraze

Active member
Anyways, since the move, we have the following quote:
[2442] Haunted Kitchen
Encounter: zombie chef
Round 0: Marigron wins initiative!
Round 1: Marigron tries to steal an item!
Round 2: Marigron uses the spectre scepter!

> monster_level_adjustment

Returned: -1
Round 3: Marigron uses the spectre scepter!
You gain 4 hit points

> monster_level_adjustment

Returned: -1
Basically, the spectre scepter is properly detecting as delevelling on green ray, not on the others. Verification both that it's properly running in payItemCost and that both the item detection and text search are working right as well.

Edit: Ah yes, since it worked right, spun a new update patch that should be closer to Veracity approvable. :) If there's other spots where I'm doing it wrong, please let me know and I'll do my best to fix it up asap. :)
 
Last edited:

slyz

Developer
It seems like a lot of hard-coding is going on. Maybe a data file with info on combat items should be created for this?
 
Top