BatBrain -- a central nervous system for consult scripts

heeheehee

Developer
Staff member
1. I think Mafia started setting physical_resistance based off of ML back in August, and recently I changed it so that the ML-based value wouldn't be cached indefinitely. Maybe physical_resistance should take into account current ML for any monster proxy record, or maybe it shouldn't.

2. Why is elemental multiplying as a SC necessarily a bad thing? class(Seal Clubber)*expr would probably handle that.
 

zarqon

Well-known member
r86 Update

So, thanks to the awesome new lastCombatStarted property, we can now have a CID (combat ID) which uniquely identifies a combat. I plan on using this to speed BatBrain up considerably, particularly when facing the same monster multiple times in a row. But for now, I've simply reworked happenings to track all events by CID rather than by total turns played. This prevents pesky errors that would show up when using free runaways, or when faxputtying, or in other scenarios. BatBrain would erroneously believe the brand new combat to be already complete, and wouldn't do anything. I don't know if the error was happening for the new free snowman fights because I'd fixed it here before I ever encountered them, but I suspect it was. So that's an excellent step forward.

Also, as previously discussed, I've opened up all the melee skills to ranged weapons, since that evidently changed some time ago. Also, for most of the Smacks, the bonus to attack is now at least 30. Still to do is handling the conditionally doubled elemental damage.

And, I've also added initial support for the new snowmen, though BatBrain's recommendations will probably be off until mafia's knowledge of their stats matches reality. Also, all the penetration-based stuff isn't supported yet (though it could be if someone could point me to a way to know what your cold resistance is after losing a level of resistance, or what your DA percent is after losing, say, 10 DA).

Some other enhancements:

  • For familiars that drop items during combat, assume that any matching item could be the item dropped by your familiar rather than filtering them on a shortlist first. This will hopefully eliminate some cases of erroneous stasising for items that have already dropped. Also it eliminates a hardcoded list, which of course I always like.
  • Only print informational image mismatch messages if no match is found in ALL of the monster images, not just the first.
  • Support for Crab Claw Technique.
  • Value Soulsauce as MP for now. Though it's certainly not a 1:1 relationship, a positive value is an improvement.
  • Properly account for additional resistances from +ML, as previously discussed here. No more double-dipping!
Enjoy!
 

zarqon

Well-known member
Note: In the interest of furthering interest in BatBrain and helping to narrow down the source of errors, I have included a small sample script, SimpleSmack.ash, in the first post. This short and sweet little combat script is the script I use for everything, and relies entirely on SS and BatBrain to complete combats, with very little by way of special situational handling. Disclaimer: Use at your own risk, though as stated I do use it for everything so dangers are few.

If you are encountering an error running, say, WHAM, you might try SimpleSmack just to see if the error continues. If so, you can be sure the source of the error lies with BatBrain or SmartStasis, and you can leave WHAM out of it! If the error happens with WHAM but not SimpleSmack, then it's anybody's guess and we'll need a high-verbosity combat output to be able to investigate further. Thanks!
 

Bale

Minion
That's pretty nice. I'm sure it will teach people a lot about how to make use of BatBrain for their personal purposes. I know that I learned a thing or two which I can use to update my own combat script.

As for debugging problems, I'm sure that if people remember it's existence, it will help a lot. I expect to make a lot of posts responding to people who didn't try out their problem with SimpleSmack, but it will still make the conversations simpler.
 

Theraze

Active member
Thanks. Trying SimpleSmack and it seems nifty. I did do the full names for chilled monkey brain technique and drunken baby style to remove the warnings, but otherwise it seems to run fast in aftercore farming.
 

Marty Knee

New member
I keep getting this whenever I try to use WHAM:

Bad monster value: "X-32-F Combat Training Snowman" (BatBrain.ash, line 1735)
Consult script 'WHAM.ash' not found.
You're on your own, partner.

Is there a fix for this or am I out of luck for now?
 

fronobulax

Developer
Staff member
This monster is stun immune! That information should be added to batfactors.

I believe the monster in question is the Sorceress if you broke the mirror while climbing the tower. SC Sauceror in a 2016 Standard if that makes a difference.
 

zarqon

Well-known member
I've mostly finished a serious revamp of how monster data is handled (again), to allow for monsters to be cached per session as you encounter them, ideally giving BatBrain a bit more speed. While doing this, I found yet another issue with elemental resistance granted by +ML. The "new and improved" information was that KoL uses the higher of the monster's existing resistance and the bonus resistance from +ML. However, simply maxing the two won't work since BatBrain also considers vulnerability to be negative resistance. If a stench-aligned monster has +50 ML, what is its cold resistance? Does the negative flip to positive, or does the vulnerability simply override any bonus resistance granted?

@frono: Thanks for the report. Now, how to tell if you've broken the mirror? Am I right in supposing that checking for Confidence! wouldn't be sufficient because you can lose the effect if you adventure somewhere else before reaching the NS?
 

heeheehee

Developer
Staff member
While doing this, I found yet another issue with elemental resistance granted by +ML. The "new and improved" information was that KoL uses the higher of the monster's existing resistance and the bonus resistance from +ML. However, simply maxing the two won't work since BatBrain also considers vulnerability to be negative resistance. If a stench-aligned monster has +50 ML, what is its cold resistance? Does the negative flip to positive, or does the vulnerability simply override any bonus resistance granted?

Elemental weakness multiplies with elemental resistance (so a stench monster with 50% elemental resist would take 1x cold damage), iirc, but it's fundamentally different from elemental resistance on a monster (see: N-stone golem in Fernswarthy's, zombies in Dread for examples of monsters with elemental resistance).
 

zarqon

Well-known member
Elemental weakness multiplies with elemental resistance

I think I get you. To clarify: say we have a stench-aligned monster with no special resistances. That monster will be vulnerable to sleaze and cold, taking 200% damage from them. Now, say we are running +50 ML. Our monster's spooky and hot resistance will be 20%, the bonus from running +50 ML. Its stench resistance will still be the maximum (all damage reduced to 1). But for the elements it's vulnerable to, it will take 160% damage (200% reduced by 20%), yes?

There aren't any monsters which are only slightly weak to an element, are there? Assuming not, so since the resistance bug is rather severe we have ourselves an update:

r87 Update!

In addition to fixing the rather serious elemental resistance bug as mentioned above, this update brings us a fairly significant overhaul of the way monster data is handled by BatBrain. Unfortunately, this update breaks most of the scripts that rely on BatBrain, as forewarned in the WHAM thread, however I posted a version of WHAM that works with the update and I'm also about to update all the rest so it should be quite painless for most of you.

All the monster data which was previously stored in a float[string] map -- and even some of the global variables -- has now been moved into a monster_data record type. Each record contains all the special information we need for a given monster which can't be obtained by mafia's functions or proxy records. Further, we now statically maintain a database of monsters. Each time you encounter a monster, if the monster's record is already cached, we'll just use that data rather than rebuilding it from scratch. Of course, some monsters are variable -- such as Fun-Guy playmates or the recent combat training snowmen -- and should never be cached; so for these monsters we now support a "variable" monster keyword.

I've also added another new keyword for monsters: "onlyhurtby". Use this keyword for monsters that can only be damaged in special ways. Presently supported: "pottery", "healing", and all weapon types (this keyword obsoletes the "seal" keyword which will eventually be removed).

Some other goodies that made their respective ways into this update:

  • Temporarily blacklist your fizzing spore pods until you have blown up the cave wall with them.
  • Correctly apply the "dodge" monster keyword.
  • Correctly handle the "underwater" keyword. After batfactors was being loaded statically, underwater options were being permanently removed whenever you adventured terrestrially. Now they are filtered in to_event() so those underwater-only options will now show up for all you divers out there.
  • Rather than adding tons of player damage (what really happens), don't even allow options dealing more than 39 damage into opts vs. mine crabs.
  • Use a global variable "where" throughout the BatBrain environment instead of my_location(). Another step toward extracombat uses of BatBrain.
  • Support for the ice hotel bell.
  • Support (and by "support" I mean "ignore") a few more training snowman parts.
Enjoy!
 
Last edited:

Magus_Prime

Well-known member
I've found myself using SimpleSmack.ash in aftercore as it's faster than WHAM. I updated my copy to reflect the changes to BatBrain but would ask that you consider making it available via SVN.

Thank you for all the work you've done and continue to do on these scripts.
 

zarqon

Well-known member
Ah, but I also updated SimpleSmack in the first post when I updated BatBrain. And I had originally considered adding it to the BatBrain SVN but I'm afraid people will begin to treat it as an "official" script that I "support" rather than a personal example made public so that people can tinker with it if it pleases them.

Anyone else agree it should be in the SVN? I'm willing to dump it there but may become peevish if people start reporting bugs in it. -___-

And, you're welcome and thank you!
 

Magus_Prime

Well-known member
Ah. Silly me for not looking. The necessary changes were, with the information provided in the WHAM thread on the record structure, simple. You do raise a good point in terms of support.

I've run several thousand turns with SimpleSmack and the only issues I've encountered have been:

1. Some SnoJo combats aren't handled well
2. A SmartStasis issue

Number one may no longer be an issue with this update to BatBrain.
Number two is something that may be an edge case: I wish SmartStasis would realize that if:

a) I'm wearing a mayfly bait necklace and
b) I'm in a zone that would benefit from the use of summon mayfly swarm

that SmartStasis would use the skill. I'm using it right now to get extra currency drops in charter zones.
 

heeheehee

Developer
Staff member
I think I get you. To clarify: say we have a stench-aligned monster with no special resistances. That monster will be vulnerable to sleaze and cold, taking 200% damage from them. Now, say we are running +50 ML. Our monster's spooky and hot resistance will be 20%, the bonus from running +50 ML. Its stench resistance will still be the maximum (all damage reduced to 1). But for the elements it's vulnerable to, it will take 160% damage (200% reduced by 20%), yes?

There aren't any monsters which are only slightly weak to an element, are there? Assuming not, so since the resistance bug is rather severe we have ourselves an update:

First point is correct. I'm not aware of any monsters that have negative elemental resistance, unless you count those that result from running negative ML (which in turn only applies if the resistance is previously unset).
 

Theraze

Active member
Only SimpleSmack issue I've had is that it expects the wall of meat to be a good spot to stasis. Sometimes it works, sometimes it runs stasis until death. Otherwise it's done well in general though.
 

heeheehee

Developer
Staff member
From the new content (probably not relevant until the monsters get added to Mafia):

Clara has 50% resistance, a softcap of 500, and an exponent of 0.5.
Unusual construct has 50% resistance, a softcap of 500, and an exponent of 0.5.
Granny Heckleton has 50% resistance, a softcap of 200, and an exponent of 0.5.

restless ghosts have 100% physical resistance.
 
Top