Feature - Implemented Ability to give a flat bonus to the scores of certain items in the maximizer

soolar

Member
I would love to be able to give certain items that are useful for things other than just their numeric modifiers a bonus score to account for their useful abilities without outright forcing their equipment, so that they can become naturally equipped if I don't have anything particularly well suited to my current task.

For example, the mafia thumb ring (or whichever one it is that gives adventures), and screege's spectacles for the bonus meat stuff. There are other items I've thought I'd like to do this with, but those are the ones that I know I would right off the top of my head.

I've toyed around with ideas for how to implement this via ASH, and the only way I can see to do it is to give these items a flat score, instead of a bonus score (in case they're already naturally suited to my current statement), unless I want to effectively implement my own maximizer from scratch in ASH.

One way I can see to do this that seems reasonable to me is to have the +equip (and maybe -equip too) accept a numeric argument, something like "+100equip mafia thumb ring" to give the thumb ring 100 bonus points, but not necessarily outright force its equipment. Or it could just be a new keyword, like "+100bonus mafia thumb ring" or something, if +/-equip already accepts a numeric argument for some other reason that I've missed. Could likewise accept negatives to subtract from the score, although I don't have an actual use-case for negatives in mind yet.
 

fronobulax

Developer
Staff member
I think I understand what you want although I don't understand the maximizer enough to assess how feasible the request is.

That said, I dealt with a similar problem by defining an outfit that had all of those things I would be glad to wear for some secondary reason. I would wear it, maximize against something and then tweak the maximizer string until I got the result I thought I wanted. Forcing it to only change equipment if there was something better was obviously key.

I can imagine automating this is awkward - you would have to handle the possibility that the secondary items were not available before getting naked and equipping them and you would have to do some experimentation until you embedded a maximizer string in code.
 

soolar

Member
I've written a patch which I have tested for the last couple days and it definitely seems to work. I went with using bonus as a new keyword. Patch is attached. Java is not my strongest language, so please do let me know if there are any issues with it and I'll try to fix them.
 

Attachments

  • maximizerbonus.patch
    4.6 KB · Views: 10

lostcalpolydude

Developer
Staff member
The help text in data/maximizer-help.html also needs updating.

I'm also curious how this affects performance, but I'm probably not the person to evaluate that.
 

Crowther

Active member
Hmm. I would actually use this. I have aftercore scripts that use the maximize and have trouble, because my stats might not be high enough yet to equip a specific item. I do worry about performance. The maximizer code is very touchy.
 

soolar

Member
I'll try out profiling the maximizer with and without my patch and see if there is a noteworthy performance hit, but especially with a minor optimization I've made since the posted patch I don't think there will be... Can't say for sure until I've tried it though.
 

soolar

Member
Alright, I've done some performance testing. There seems to be a minor hit, but I really do mean minor. It adds up to less than a second in a large aftercore inventory with no combination limit. Here are the maximizer strings and the durations they took to run, in a situation where I built mafia, launch it, immediately ran the three maximizer requests, then quit, so no other factors should be impacting it.

WITH change:
5 exp, item, 0.2 meat, mp regen, 0.2 mainstat, 0.1 moxie, 0.5 hp regen, mp, hp
140400 combinations checked, best score 9,894.47 (29.758 Seconds)
5 exp, item, 0.2 meat, mp regen, 0.2 mainstat, 0.1 moxie, 0.5 hp regen, mp, hp, food drop
140400 combinations checked, best score 9,960.47 (26.713 Seconds)
5 exp, item, 0.2 meat, mp regen, 0.2 mainstat, 0.1 moxie, 0.5 hp regen, mp, hp, food drop, candy drop
140400 combinations checked, best score 9,960.47 (26.825 Seconds)

WITHOUT change:
5 exp, item, 0.2 meat, mp regen, 0.2 mainstat, 0.1 moxie, 0.5 hp regen, mp, hp
140400 combinations checked, best score 9,894.47 (29.611 Seconds)
5 exp, item, 0.2 meat, mp regen, 0.2 mainstat, 0.1 moxie, 0.5 hp regen, mp, hp, food drop
140400 combinations checked, best score 9,960.47 (26.616 Seconds)
5 exp, item, 0.2 meat, mp regen, 0.2 mainstat, 0.1 moxie, 0.5 hp regen, mp, hp, food drop, candy drop
140400 combinations checked, best score 9,960.47 (26.528 Seconds)

If you can think of a better way to test the performance or any other situations I should expand my testing to, I'll be happy to investigate further.

I've attached a new patch with a minor optimization I made and with maximizer-help.html updated.
 

Attachments

  • maximizerbonus2.patch
    6.5 KB · Views: 9

MCroft

Developer
Staff member
I'm going to take a look. Can you add some test cases to the maximizerTest for this?
 

MCroft

Developer
Staff member
I'm committing it. It passes all reasonable tests

You may want to address some of my abusive tests below.

three issues:
Rich (BB code):
mus , 10 bonus helmet turtle, -20 bonus helmet turtle, + hat
pull and equip hat oversized skullcap(+21)
mus, bonus
Unrecognized keyword: bonus
mus, 1000 bonus true grit
[true grit] cannot be equipped.
No idea if other keywords are smart about +10 and -20, but these are the things I checked.
#3 is the same as if you try to +equip an item, but bonus makes a different kind of sense than +equip
 
Last edited:
Top