BatBrain -- a central nervous system for consult scripts

My opinion: if KoLmafia adds a feature for the benefit of BatBrain (and other consult scripts), but, due to incomplete data or an otherwise flawed implementation, it's not useful as is, it would be more productive to make a Bug Report to get the deficiencies fixed, rather than to code up workarounds in BatBrain (and other consult scripts) and ignoring the feature; we will end up with ALL consult scripts having accurate data, not just those that chose to ignore the feature

And, as zarqon mentioned, it will simplify BatBrain (and other consult scripts).

Exactly. I was surprised to discover (rediscover?) that this information was available, but wasn't being used. Bug report made so that both KoLmafia and BatBrain can be improved.
 
Last edited:
Mafia's physical resistance information was made available to scripts in mafia in 2013, several years after I had implemented support for monster resistances, so it's not quite right to call BatBrain's handling a workaround, when there was originally nothing to work around. I was slightly amused to discover that my response then was basically the same as my response now. I'm not sure why I never added the code to use mafia's knowledge when present -- maybe I was waiting for a further reply about some of the values? Anyway, I would be happy to work with this information after it's been accuracyfied (EDIT: which appears to be... now. Okay!).

Also, those bat burritos may be the cutest burritos I've ever seen.

Also, WHAAAAATTTT?! $monster[].id is a thing now?!?! We can access monsters directly rather than foreaching the monster category!!

EDIT: Okay, so these are the monsters in batfactors which presently have an ID of 0:

ID of 0: Ancient Protector Spirit (only present due to physical resistance, can be deleted when we use mafia's information)
ID of 0: Batwinged Gremlin
ID of 0: Count Drunkula
ID of 0: Count Drunkula (Hard Mode)
ID of 0: Don Crimbo (cannot be encountered again; may be removed. Not sure why he's in there to begin with!)
ID of 0: Erudite Gremlin
ID of 0: Hulking Construct
ID of 0: Mayor Ghost
ID of 0: Mayor Ghost (Hard Mode)
ID of 0: Servant of Lord Flameface
ID of 0: Spider Gremlin
ID of 0: The Unkillable Skeleton
ID of 0: The Unkillable Skeleton (Hard Mode)
ID of 0: The Whole Kingdom
ID of 0: Vegetable Gremlin
ID of 0: Zombie Homeowners' Association (Hard Mode)

Gremlins and Dread bosses are the vast majority of those. Hmmmm

I'm thinking at the moment I can just index these in batfactors as negative numbers and then fall back to foreaching that limited subset if the monster can't be located directly by ID in batfactors. Exciting times!
 
Last edited:
Another interesting note with ghosts (since they're mentioned in your response then) is that TURDS keys have a 100% success rate when used against ghosts. I guess that is trickling into the public domain; I see no reason to keep that private.
 
r74 Update

Some extremely pleasing updates this time around. Here they are, in no particular order:

Second! As I was investigating all the logic behind stuns, I realized that multi-round stunners should NOT be set to 0 for monsters who are immune to multi-round stunners, despite that seeming to be the perfectly obvious thing to do. In actuality, multi-round stunners still stun the monster, though the stun is immediately shrugged. It still takes a round, however, so we now cap multistuns at no less than 1 round for immune monsters. This could be helpful in many cases; for instance, if you have various sources of passive damage, including your familiar. Those stunned rounds are still productive. In the case that a monster is unfazed and attacks directly, that monster should be specified as "nostagger" which will also reduce multistuns to 0 rather than 1.

First! I'm extremely excited to announce that monsters in batfactors are now indexed by ID! You'll want to be extra sure that you have the current version of batfactors now, because if you don't, your special monster information will be entirely wrong. For monsters with an ID of 0, they are listed at the beginning using negative numbers, and BatBrain foreaches the monster category until it hits a positive number.

Last! We now access the splendidly accurate information in mafia's physical_resistance proxy field and set the monster's resistance from that. The old functionality still exists in case you need to override mafia's information for any reason, but I went through batfactors with a fine-toothed comb and removed all of the physical resistance information (which meant most of the ghost-like monsters could be removed entirely). The comb was purely cosmetic and did not help with that in any way.

Third! A few more fixes for random monster modifiers. Ghostly now grants 90% resistance (though I think that can be removed also, yes? As there was no harm in leaving it there I didn't remove it yet). Also added the "cowardly" and "frozen" attributes, meaning that the monsters miss "occasionally".

Enjoy!

EDIT: Have a question regarding cloned monsters. They count as a group of 2, yes? Can group monsters appear cloned? If so, is their group size doubled?
 
Last edited:
r74 Update
EDIT: Have a question regarding cloned monsters. They count as a group of 2, yes? Can group monsters appear cloned? If so, is their group size doubled?

Not according to wiki, and I think I would have noticed double damage from storms/geysers if it happened (even though I was a muscle class and the only times I casted spells against cloned monsters was when I noticed I am fighting a cloned monster and decided to check if I can do more damage by using skills with group multipliers)

ETA
But, just now ... saucestorm ...
against haunted, stingy, cloned fishy pirate:
Code:
A fog of French dressing vapor deals 308 damage to your opponent before rising to form a cloud overhead.

With a wet thunderclap, a burst of Teriyaki sauce rain falls from the cloud, scorching your foe for 154 damage.

but against ghostly, short, cloud-based fishy pirate
Code:
A chill wind heralds the arrival of a roiling cloud of salad cream overhead. A chill wind also deals 154 damage to your opponent.

With a wet thunderclap, a burst of Hollandaise sauce rain falls from the cloud, scorching your foe for 77 damage.

That looks a lot like "times 2" ... (I have 10 ml, +60% spell damage, and should be hitting the base 50 cap)
 
Last edited:
I don't know whether this would be better here or in the WHAM thread but I have two observations:

1. Belch the Rainbow (fully upgraded) seems to be picked less often against "untouchable" monsters than I would expect. As a Pastamancer "Cannelloni Cannon" is picked far more often, for far less damage.

2. Against "restless" monsters no viable strategy is found more often than not. Most of the time "Saucegeyser" works to kill the monster.

I posted this here due to the recent posts involving Belch the Rainbow and skill weighting.
 
Last edited:
Regarding Rainbow, have you checked your skillLevel117 preference? That should be set to how many times you upgraded it...
 
Okay, r75 changes that and adds guesswork for the cloned modifier.

I still have my two questions, which I shall reiterate for clarity:

1. May I delete BatBrain's handling for ghostly? Can a dev who coded support or someone in the current path verify that when fighting a ghostly monster, last_monster().physical_resistance == 90?

2. Does the cloned modifier alter the group size? xKiv seems to be saying that all signs point to yes. If that is so, does it clone entire groups? In short, if you encounter a cloned clan of cave bars, is the group size +0, +1, or +10?
 
1. May I delete BatBrain's handling for ghostly? Can a dev who coded support or someone in the current path verify that when fighting a ghostly monster, last_monster().physical_resistance == 90?

Code:
			else if ( modifier.equals( "ghostly" ) )
			{
				if ( monster.physicalResistance == 0 )
				{
					monster.physicalResistance = 90;
				}
			}
Looks like it.
 
2. Does the cloned modifier alter the group size? xKiv seems to be saying that all signs point to yes. If that is so, does it clone entire groups? In short, if you encounter a cloned clan of cave bars, is the group size +0, +1, or +10?
Does it even *appear* on already-group monsters?
 
You're fighting a cloned oil cartel
Why yes, yes it does.

You hastily bend your iFlail into a harpoon, and hurl it at your opponents, skewering all three of them and dealing 173 damage. Then you retrieve it and bend it back into an iFlail.
Uhh, I'm not sure if that's conclusive or not. Going to harpoon some beatles.
You hastily bend your iFlail into a harpoon, and hurl it at your opponent, skewering three of them and dealing 429 damage. Then you retrieve it and bend it back into an iFlail.
I guess cloned does nothing against group monsters.
 
It seems there is a strange error

Code:
Base round: 11 damage, 0 player damage, 0 meat
ATT: 153 (3% × (16.15), death in 82)
DEF: 136 (95.45% × 6.27 (8), win in 1)
HP: 19, Value: 629.85 μ, RES: 0 (-1) (-1) (1), Happenings: 0
Info: mafia's monster name 'War Pledge' does not match KoL's monster name 'twirling War Pledge'.
Unexpected error, debug log printed.
Script execution aborted (java.lang.OutOfMemoryError: Java heap space): (BatBrain.ash, line 1776)
Round 13: tipmon1995 attacks!
KoLmafia thinks it is round 14 but KoL thinks it is round 6
Round 14: War Pledge takes 45 damage.
Round 14: Gronald pulls out a tiny bowling ball and hurls it at your opponent, striking him for 12 damage.
Round 14: War Pledge takes 12 damage.
Round 14: tipmon1995 wins the fight!
After Battle: Gronald does a little fairy dance.
You gain 10 Strengthliness
You gain 9 Mysteriousness
You gain 26 Cheek
1 HP costs 3.2μ. ( 82 / 140 )
1 MP costs 8μ. ( 72 / 138 )
Setting monster to War Pledge...
distressed denim pants (5.0 @ +75.17): 568μ * 8.76% = 49.75
bejeweled pledge pin (5.0 @ +75.17): 95μ * 8.76% = 8.32
beer helmet (5.0 @ +75.17): 120μ * 8.76% = 10.51
Value of stat gain: 553.44μ
This monster has a 50% chance of automatically missing you.
You have tiny bowler equipped: 11 damage, aoe 100
Events created: tiny bowler
Base round: 11 damage, 0 player damage, 0 meat
ATT: 165 (3% × (17.68), death in 82)
DEF: 148 (95.45% × 6.27 (8), win in 8)
HP: 180, Value: 622.02 μ, RES: 0 (-1) (-1) (1), Happenings: 0
Info: mafia's monster name 'War Pledge' does not match KoL's monster name 'twirling War Pledge'.
Unexpected error, debug log printed.
Script execution aborted (java.lang.OutOfMemoryError: Java heap space): (BatBrain.ash, line 1776)

[1519] Cobb's Knob Harem
Encounter: Plucked
You lose 3 hit points
You acquire an effect: Knob Goblin Perfume (1)

Something about being out of memory. I have already tried older versions of the daily build and redownloading multiple scripts (wasn't sure if it was batbrain that was causing the problem, I don't know to much about coding) but nothing seems to have fixed it.
 
Something is wrong with the formula in this line:
Code:
fam     102     Imitation Crab  {2+5*famgear,max(2,fweight/2-max(0,(fweight-(20+20*famgear)))*zone(sea))+5*famgear,fweight-max(0,(fweight(20+20*famgear)))*zone(sea)+5*famgear}        0       rate 1
I don't see anything wrong, but WHAM aborts (zlib evaluation error) whenever I have an Imitation Crab (via wardrobe).
 
What did the evaluation error say? That should tell us at what point in the line there is a variable not properly being initialized...
 
What did the evaluation error say? That should tell us at what point in the line there is a variable not properly being initialized...

It expected a "," but found a null string or a blank space, I wasn't sure. I guess I should have mentioned that, even though I found it completely unhelpful.
 
Try reducing that range to just the average. Without actually having poked into it yet, I'm guessing it's due to something like BatBrain's range reduction matcher not accounting for commas in formulas.
 
Back
Top