Modifier Maximizer

From KoLMafia
Jump to: navigation, search



The specification of what attributes to maximize is made by a comma-separated list of keywords, each possibly preceded by a numeric weight. Commas can be omitted if the next item starts with a +, -, or digit. Using just a +, or omitting the weight entirely, is equivalent to a weight of 1. Likewise, using just a – is equivalent to a weight of -1. Non-integer weights can be used, but may not be meaningful with all keywords.

Numeric weights determine how much an individual keyword will be counted toward the score that Mafia assigns to each combination. For instance, "2 item drop" will force item drop to contribute four times as much as, say, ".5 meat drop" in the expression "maximize 2 item drop, .5 meat drop". The weights are simply multiplied with the corresponding modifier, so in the preceding expression, a natty blue ascot would contribute 20*.5 = 10 to your score, while a lucky rabbit's foot would contribute 2*7 + .5*7 = 17.5 to your score.

Numeric Modifiers

The full name of any numeric modifier (as shown by the modref CLI command) is a valid keyword, requesting that its value be maximized. If multiple modifiers are given, their weights specify their relative importance. Negative weights mean that smaller values are more desirable for that modifier.

Shorter forms are allowed for many commonly used modifiers. They can be abbreviated down to just the bold letters:
mus, mys, mox, mainstat, HP, MP, ML, DA, DR, combat rate, item drop, meat drop, experience, adventures
Also, resistance (of any type) can be abbreviated as res, and damage can be abbreviated as dmg. all resistance is a shortcut for giving the same weight to all five basic elements. Likewise, elemental dmg is a shortcut for the five elemental damage types.

Note that many modifiers come in pairs: a base value, plus a percentage boost (such as Moxie and Moxie Percent), or a penalty value. In general, you only need to specify the base modifier, and any related modifiers will automatically be taken into account.

Finally, prismatic (dmg or res) is a derived modifier that attempts to provide a balance of all elemental types. By contrast the elemental modifier will attempt to maximize all elements, even if it means that some of the elements will get no boost at all.


Any numeric modifier keyword can be followed by one or both of these special keywords:
min – The weight specifies the minimum acceptable value for the preceding modifier. If the value is lower, the results will be flagged as a failure.
max – The weight specifies the largest useful value for the preceding modifier. Larger values will be ignored in the score calculation, allowing other specified modifiers to be boosted instead.
Note that the limit keywords won't quite work as expected for a modifier that you're trying to minimize.
If min or max is specified at the start of the expression, it applies to the total score (the sum of each modifier value times its weight). A global max may allow equipment maximization to finish faster, since no further combinations will be considered once the specified value is reached.+
The preference maximizerCombinationLimit (set with set maximizerCombinationLimit = 100000 in CLi) constrains the number of combinations Maximizer will consider. Depending where it is set, this may mean you don't get the best combination, but you may well get a good enough one faster. Depending which equipment you can use, you may find a higher value than 100000 is needed.

Other Modifiers

Boolean modifiers can also be used as keywords. With positive weight, the modifier is required to be true; with negative weight, it is required to be false. There is one shortcut available: sea requires both Adventure Underwater and Underwater Familiar to be true.

The only bitmap modifiers that currently appear useful for maximization are Clownosity and Raveosity, so they are allowed as a special case. The weight specifies the required minimum value; only one value is actually meaningful for each keyword, so 4 clownosity and 7 raveosity are the only useful forms.

String modifiers are not currently meaningful for maximization.


Slot names can be used as keywords:
hat, weapon, offhand, shirt, pants, acc1, acc2, acc3, familiar (stickers and fake hands are not currently planned.)
With positive weights, only the specified slots will be considered for maximization. With negative weights, all but the specified slots will be considered.
empty – With positive weight, consider only slots that are currently empty; with negative weight, only those that aren't empty. Either way, +slot and -slot can be used to further refine the selected slots.
handed – With a weight of 1, only 1-handed weapons will be considered. With a larger weight, only weapons with at least that handedness will be considered.
melee – With positive weight, only melee weapons will be considered. With negative weight, only ranged weapons will be considered.
type text – Only weapons with a type containing text are considered; for example, type club if you plan to do some Seal Clubbing.
shield – With positive weight, only shields will be considered for your off-hand. Implies 1 handed.
current - By default Maximizer considers your current equipment in Hardcore and Ronin. With -current keyword it does not, with +current keyword in aftercore it forces it to be considered. Not considering current equipment will reduce the number of combinations considered, but will sometimes mean changes of equipment are suggested even though they don't improve what you are wearing.
equip item – The specified item is required (positive weight) or forbidden (negative weight). Multiple uses of +equip require all of the items to be equipped.
outfit name – The specified standard outfit is required or forbidden. If the name is omitted, the currently equipped outfit is used. Multiple uses of +outfit are satisfied by any one of the outfits (since you can't be wearing more than one at a time).
If both +equip and +outfit are used together, either one will satisfy the condition – all of the items, or one of the outfits. This special case is needed to be able to specify the conditions for adventuring in the Pirate Cove.
tiebreaker – With negative weight, disables the use of a tiebreaker function that tries to choose equipment with generally beneficial attributes, even if not explicitly requested. There are only a few cases where this would be desirable: maximizing +combat or -combat (since there's usually only one item that can help), adv and/or PvP fights at rollover, and familiar weight when facing the Naughty Sorceress familiars.
effective - With positive weight, will choose weapons that are based on your muscle or moxie, whichever is higher. Useful for moxie classes with Tricky Knifework.


By default, the Modifier Maximizer does not recommend familiars, since there are many possible factors in choosing one beyond those that can be expressed via modifiers. However, you can request that specific familiars be compared with your current one:
switch familiar – With positive weight, the familiar is added to the list to be considered (unless the player lacks that familiar, or is already using it, in which case there is no effect). With negative weight, the familiar is added to the list only if the player lacks the previously specified familiar. For example, switch hobo monkey, -switch leprechaun will only consider the leprechaun if the player doesn't have the monkey.


All suggestions are based on the assumption that you will be adventuring in the currently selected location, with all your current effects, prior to the next rollover (since some things depend on the moon phases). For best results, make sure the proper location is selected before maximizing. This is especially true in The Sea and clan dungeons, which have many location-specific modifiers.

Among effects, stat equalizer potions have a major effect on the suggested boosts, since they change the relative importance of additive and percentage stat boosts. Likewise, elemental phials make certain resistance boosts pointless. If you plan to use an equalizer or phial while adventuring, please use them first so that the suggestions take them into account.


If the Max Price field is zero or blank, the limit will be the smaller of your available meat, or your autoBuyPriceLimit (default 20,000). The other options should be self-explanatory.

You can select multiple boosts, and the title of the list will indicate the net effect of applying them all – note that this isn't always just the sum of their individual effects.


The Modifier Maximizer can be invoked from the gCLI or a script via maximize expression, and will behave as if you'd selected Equipment: on-hand only, Max Price: don't check, and turned off the Include option. The best equipment will automatically be equipped (unless you invoked the command as maximize? expression), but you'll still need to visit the GUI to apply effect boosts – there are too many factors in choosing between the available boosts for that to be safely automated. An error will be generated if the equipment changes weren't sufficient to fulfill all min keywords in the expression.

Limitations & Bugs

This is still a work-in-progress, so don't expect everything to work perfectly at the moment. However, here are some details that are especially broken:

  • Items that can be installed at your campground for a bonus (such as Hobopolis bedding) aren't considered.
  • Your song limit isn't considered when recommending buffs, nor are any daily casting limits.
  • Mutually exclusive effects aren't handled properly.
  • Weapon Damage, Ranged Damage, and Spell Damage are calculated assuming 100 points of base damage – in other words, additive and percentage boosts are considered to have exactly equal worth. It's possible that Weapon and Ranged damage might use a better estimate of the base damage in the future, but for Spell Damage, the proper base depends on which spell you end up using.
  • Effects which vary in power based on how many turns are left (love songs, Mallowed Out, etc.) are handled poorly. If you don't have the effect, they'll be suggested based on the results you'd get from having a single turn of it. If you have the effect already, extending it to raise the power won't even be considered. Similar problems occur with effects that are based on how full or drunk you currently are.

Useful Expressions

MP regen: .5 mp regen max, .5 mp regen min

Pirates: mainstat, +outfit swashbuckling

War: mainstat, +outfit frat warrior

Shieldbutting: muscle, +shield

More Information

Here is the expression used as tiebreaker:

"1 familiar weight, 1 familiar experience, 1 initiative, 5 exp, 1 item, 1 meat, 0.1 DA 1000 max, 1 DR, 0.5 all res, -10 mana cost, 1.0 mus, 0.5 mys, 1.0 mox, 1.5 mainstat, 1 HP, 1 MP, 1 weapon damage, 1 ranged damage, 1 spell damage, 1 cold damage, 1 hot damage, 1 sleaze damage, 1 spooky damage, 1 stench damage, 1 cold spell damage, 1 hot spell damage, 1 sleaze spell damage, 1 spooky spell damage, 1 stench spell damage, 1 critical, -1 fumble, 1 HP regen max, 3 MP regen max, 1 critical hit percent, 0.1 food drop, 0.1 booze drop, 0.1 hat drop, 0.1 weapon drop, 0.1 offhand drop, 0.1 shirt drop, 0.1 pants drop, 0.1 accessory drop, 1 DB combat damage";

See this thread for details.

See Also