BatBrain -- a central nervous system for consult scripts

zarqon

Well-known member
@Bale: I've just added code that adds "songduration" to fvars if you have the skill and an equipped accordion. Will tweak batfactors accordingly when I post the update. Thanks Veracity for making that an easy fix!

@heeheehee: Oh my, that is helpful. To help me organize, I've gone through the images and made notes of the flags that are definitely or probably BatBrain-relevant, and added some notes below as to whether I think BatBrain currently handles those flags correctly. All feedback welcomed here -- particularly if you have more information to contribute that would allow BatBrain to more correctly handle one of the flags.

Resistance
BatBrain has fairly decent handling already for most of these flags, but some need work.

  • stunresist: % per round to break out of any stun. BatBrain presently handles this differently to KoL, with a boolean nomultistun, meaning the only available values for this flag according to BatBrain are 100% and 0%. I don't know if any of the 0 < x < 100 values have been spaded anywhere, but if it were to become so, it would be nice for BatBrain to be able to correctly account for stunshruggage as soon as there are values to plug in. Needs addressing.
  • nopowder: if true, shrinking powder doesn't work. BatBrain has no special handling for this item. Which monsters can't be shrunk? Needs addressing.
  • Xresist: % X resistance. All elemental resistance from monster element, special cases, and +ML are handled.
  • damagecapX: per-element damage cap. BatBrain presently uses one shared number for all elements. May need tweaking.
  • mitigation: specify soft cap at X. BatBrain handles this with its damagecap flag (again sharing with the previous). May need tweaking.
  • mitigationrate: specify exponent to apply to all damage above X. Identical to BatBrain's capexp flag.
  • delevelresist: deleveling effects are reduced by %. BatBrain has no handling for this. Has anyone noted any monsters for which this flag is nonzero?
  • combatitemresist: damage from combat items reduced by %. BatBrain handles this with its noitems flag, but the wording here is suspicious. For items that have other effects besides damage, evidently they still take effect. We may need to rejigger BatBrain's flags to match KoL's here.
  • spellresist: damage from spells reduced by %. Correctly handled with the nospells flag.
  • nopotato: potato-types don't work. No handling for this. Again, does anyone know which monsters have this flag set?
  • nostagger: monster cannot be same-round stunned. Handled with BatBrain's nostagger flag.

Misc
The exposure of these KoL flags has shed a lot of light on how things are handled over there. BatBrain seems to have the most important of them fairly well covered, but there are quite a few less common cases that aren't presently accounted for.

  • fratboy: for Zombo's skull ring. BatBrain has no handling for this, but it's easy enough to add the list of affected monsters to the "gear" entry for the ring (which as I just confirmed, already exists but has no information).
  • cavefratboy: for Zombo's skull ring. Same as above.
  • hoboautohit (element, chance): % chance of hobo auto attack of specified element. Evidently the damage formula is hardcoded for all hobo attacks, but the attack chance may be different for different varieties of hobo. BatBrain has had special code for the hobo autoattacks for quite a while in its m_event() function, wherein it assumes that all hobo auto-attacks deal an average of 10% of your max HP per round. Haven't heard any complaints since implementation so calling this handled.
  • crazyoutmoxbonus: Multiplies monster's damage bonus from outmoxing a player by x. This seems new. Anyone know what this is about? Not handled.
  • damageaura (element, amount): Monster has an elemental aura (and can have no more than 2 such auras, evidently). I don't remember coding any support for this. Needs addressing.
  • noncorporeal: scrolls of AFUE insta-kill it. BatBrain has never had handling for the AFUE scroll insta-kill mechanic to begin with. Which monsters do you think this is? Would filtering monsters based on 100% physical resistance and <100% hot resistance (chosen randomly) work?
  • noputty: cannot be puttied. BatBrain doesn't know anything about this, which is mostly fine as putty is flagged as a custom action. SmartStasis checks m.boss so at least it won't attempt to putty bosses, but there are certain monsters which are non-bosses but are also putty-immune. This has mostly not been an issue since players usually don't attempt to putty monsters that can't be puttied. Adding extra support for those other monsters would be mostly needless overhead for a script that really needs to run as swiftly as possible, so I doubt I'll add that support unless mafia were to add a "copyable" proxy field and make it easy.
  • nostatvariance: BatBrain doesn't handle this, but I don't think it's particularly relevant. BatBrain is currently pessimistic about monster stats for Manuel-less fights -- meaning that at worst you may slightly overkill the monster. Don't think this needs to be handled (again, needless overhead).
  • nomlhp: don't increase HP from +ML. Which monsters is this true for? BatBrain doesn't handle this, but should it? Again, a little extra pessimism doesn't hurt.
  • holiday: is a wandering holiday monster, evidently used by KoL for Jarlsberg's pan to not convert special food drops to Cosmic Calories. Don't think BatBrain needs to care about this one.
  • nostats: monster awards no stats. BatBrain has no support for this, and it probably should, given that it considers the meat value of your expected stat gain from defeating the monster as part of the cost of running away. Anyone know which monsters this is true for?
  • autohit: % chance of auto-hitting. BatBrain handles this slightly differently with its nomiss flag, which again only accounts for boolean possibilities. Needs addressing.
  • automiss: % chance of auto-missing. As with the previous, BatBrain handles this with its nohit flag. Needs addressing.

Penetration
I don't think that BatBrain presently has any support for anything in this category -- mostly because this information seemed to remain largely unknown. At various times some new monsters were suspected of having some kind of special mechanic, as they somehow were dealing greater damage than expected, but the mechanic was unknown. This category being revealed provides a very helpful clue towards spading these values.

  • penetration: ignore the first X DA. No handling, and would be tricky to support, as we would have to manually recalculate the player's adjusted DA percent based on the new DA value.
  • drpenetration: ignore the first x DR. Same as previous, but would be trivial to support since calculating the adjusted value only needs basic arithmetic. (Also: The Dr. is in. WAY IN! bwahahaha)
  • [elem]penetration: ignore the first x levels of [elem] resistance. One for each element. This is obviously what our friend the ninja snowman assassin has. This is also not supported, but is unfortunately much more difficult to implement since we will have to manually recalculate the player's resistance to the given element and won't be able to use mafia's built-in calculations.
Implementation of most of these flags in batfactors would probably make use of the currently-unused pdmg field for the "monster" category, and would be specified -- like monster resistances -- as a spread. One of the two physical values would require a separate flag.


Retal
Happy to report that BatBrain has supported these since very early on.

  • apathy/cunct/corrode: 10 turns of x on melee hit. Not sure of the level of support for this, but I don't think it's quite thorough.
  • thorns: x damage on melee hit. Handled by BatBrain's retal flag.
  • hotthorns: Same as previous but for hot damage. Evidently thorns can only deal physical or hot damage. BatBrain is ahead of the curve here, with flexibility to specify other elements or even multiple elements.

So, that's what I've got from looking at those screenshots. Thanks a lot for sharing them heeheehee! Anyone have any feedback about the list? Something I missed?
 

heeheehee

Developer
Staff member
A lot of these weird ones are visibly active in warbears, jickskeletons, or fun-guy playmates. For instance, double-ice still tunes playmates (and does damage if noitems is set, but coldimmunity isn't --- since it's coded weirdly? Damage there seems to be separate from actual use of the item, for some reason). Similarly, shrinking powder doesn't actually do damage; rather, it sets the monster's HP to half of its previous value. I remember testing this with Darth on NS form 3. Also, the notation for triangular distributions is cute, I guess.
 
Last edited:

Magus_Prime

Well-known member
Before they fall too far back in the thread I would like to bring up two things:

Crowther, in post 1384 attached a patch to handle the Fun Guy Mansion monsters and their increasing difficulty.

The following monsters in The Sunken Party Yacht are stun immune according to BatBrain but, at least as of a few days ago, are not marked as such in batfactors:

broctopus
cocktail shrimp
wild girl
 

lostcalpolydude

Developer
Staff member
nostats: monster awards no stats. BatBrain has no support for this, and it probably should, given that it considers the meat value of your expected stat gain from defeating the monster as part of the cost of running away. Anyone know which monsters this is true for?
This is something that mafia should handle (and it would be trivial to add), actually, so this script shouldn't need to handle it (as long as it's using mafia's stat gains for monsters). I can't think of any monsters that use this, though.
 

Theraze

Active member
Regarding delevel resistance, the Rain King takes about half of normal deleveling and I've seen it on some other bosses I think. Since that's apparently a thing, we should probably respond when we see wrong info. Similarly, the hard cap of 40 per element on the Rain King hasn't shown properly in BatMan RE, promising to do over 400 damage per element with my Sauceror.
 

heeheehee

Developer
Staff member
This is something that mafia should handle (and it would be trivial to add), actually, so this script shouldn't need to handle it (as long as it's using mafia's stat gains for monsters). I can't think of any monsters that use this, though.

Lianas, for one? Also, monsters that chain into other combats , often (Ed 1-6, NS 1-2, etc).
 

lostcalpolydude

Developer
Staff member
Dense lianas give normal stats if you don't have a machete equipped. All forms of Ed give stats, NS 1 and 2 sounds correct though.
 

zarqon

Well-known member
So I've had a start at addressing all of this. Things added so far:

  • Support for an "aura" keyword which adds aura damage directly to the base round event. Converted skeletons and video game bosses with auras to use the new keyword and added an aura to batfactors for Frosty (randomly assumed 10 cold damage).
  • Support for the AFUE scroll insta-kill. Rather than listing monsters, I check for 100% physical resistance and <100% hot resistance (to avoid false positives on "unkillable" monsters like the seahorse).
  • Support for shrinking powder not working against certain monsters. Since there weren't many of them (on the Wiki at least), I did list them explicitly. If it turns out that there are a lot more of them, I'll convert this to a batfactors keyword.
  • Support for a "drpenetration" keyword which allows you to specify the monster's DR penetration (that one was easy).

To address all the rest I'm looking to move all those monster-relevant variables under the roof of a single record. This is what I have so far:

PHP:
record monsterdata {
   spread res;         // resistances
   spread pen;         // treats your resistances as X levels lower ($e[none] is for DA)
   boolean seal;       // for purposes of immunity to all non-club damage
   boolean fratboy;    // for purposes of Zombo's ring
   boolean nopotato;   // potatos don't work
   int drpen;          // ignores your first X DR
   int howmany;        // group size
   int maxround;       // max length of combat (default 30)
   int damagecap;      // point beyond which damage is mitigated
   float capexp;       // exponent to apply to damage beyond cap
   float autohit;      // % chance to auto-hit
   float automiss;     // % chance to auto-miss
   float stunres;      // % chance to shrug a stun per round
   float noskills;     // % chance to block skills
   float noitems;      // % chance to block items
   float nostagger;    // % chance to ignore staggers
   float delevelres;   // % of deleveling resisted
   float spellres;     // % damage ignored from spells
   float itemres;      // % damage ignored from items
};

Anyone notice any redundancies or things missing?

@Magus: Thanks for bumping those. I've added the monsters you mentioned to batfactors. Also, I'd looked at Crowther's patch earlier but it was quite large so I wanted to investigate the monsters first (and there was no usable information on the Wiki about their special mechanics). And now, I think I should wait for all of the KoL screenshot stuff to get addressed before applying it, because it will no doubt be applied differently.
 

Cool12309

Member
Getting this error:
Invalid pattern syntax (BatBrain.ash, line 1677)

Which is this:
Code:
" (are|ignore|argue|both roll for initiative and|do rock-paper|glance|glare|look|say |work)",page).find()) set_happened("buddymisfire");
 

Fluxxdog

Active member
lab monkey from The Secret Government Island on Conspiracy Island is stun immune.
No it's not. If you raise it's ML by 150, then it will be, but the critter itself isn't.

Adjusting settings at the Mysterious Control Panel adds bonus ML to creatures in the Mysterious Gov't Lab.

Hope that helps!
 

Magus_Prime

Well-known member
Hmm...that's odd. I had played with the control panel but haven't looked at the wiki for what it did. Thanks for the information. :)

Ughh...The chimeras in Dr. Weirdeaux are giving Batbrain fits.
 
Last edited:

zarqon

Well-known member
@Cool12309: What familiars did you have enthroned and embjorned?

@Magus: Not sure how to avoid false positives in this case. Is there something BatBrain can check to detect control panel +ML? Or is that something mafia does/should track?
 

Fluxxdog

Active member
Each controlPanel# that applies to the monster raises its stats by 150 each and can grant stun resistance and immunity. Exact details are being spaded. However, it is NOT an ML bonus. So no resistances, no first round attacks, and EXP is calculated at a simple ATK/4.

From what I can gather, one button grants multi-stun resistance, immediately shaking of Rain-doh blue balls or gas balloons but not at 100% rate. Two buttons give multi-and single-stun immunity (Unfazed!). I haven't detected anything special about 3 buttons (2 personal and the airborne mutagen) yet, but I'm working on it.
 

zarqon

Well-known member
r48 Update!

Just a note, this is likely to be the last update before things get totally rejiggered as described above.

Most importantly, I am happy to report that this update fixes a longstanding BatBrain bug which has been reported in multiple times and threads and is even now being reported again in the ZLib thread: the elusive "dmg" bug! It always seemed to happen to people using a mosquito or ASL as a familiar, and somehow fvars["dmg"] was not being set prior to evaluating the HP gain granted by said familiar, and somehow it never happened to me and I couldn't figure it out.

UNTIL TODAY! It didn't happen to me, but I did figure it out. Familiar events are converted directly from combat_recs to advevents, which means their dmg and pdmg fields are converted to spreads before to_event() gets called. Thus, referring to "dmg" worked fine in the special field but not in the pdmg field.

So what I've done is not use "dmg" at all in to_event(). Instead, we set "fdmg" (new name to indicate that it only works for familiars) immediately prior to creating the familiar event, then delete it when we're done so it doesn't slow down evaluating other formulas.

Yay!

Other fixes in this update:

  • Add support for "aura" and "drpenetration" keywords, as aforementioned.
  • Support for scroll of AFUE insta-killing incorporeals, also as aforementioned.
  • Shrinking powder doesn't work on Hobopolis bosses or Mayor Ghost, also also as as aforementioned.
  • Correctly handle Accordion Bash, as also also afore as mentioned.
A number of changes were also made to batfactors to correspond with this update, so I recommend deleting your batfactors to force a refresh. Your updated batfactors will include:

  • Most of the Thunder/Rain/Lightning skills. As BatBrain still does not consider Thunder/Rain/Lightning costs, only custom actions and Thunder skills were added at this time.
  • "dmg" keyword changed to "fdmg" to accomodate the update.
  • Zombo's skull ring explicitly lists the monsters it works on
  • Add tiny bowler, opium grenade, and wand of pigification
  • Add three more stun-immune monsters, also as also as
  • Fix various group monster sizes.
  • Fix Saucemageddon formula and AoE.
Enjoy!
 

zarqon

Well-known member
Thanks for all the help Fluxx!

Also, looks like I lied about r48 being the last update before the reworking. I had a bit of time to code up initial support for the chimeras in Dr. Weirdeaux's mansion, so r49 it is. A few things unsupported still but BatBrain at least won't make horrible mistakes like throwing items at a frog head. If anyone has any actual numbers to use for these things I'd love to use them instead of my complete guesses based on about 10 turns in the zone.
 

zarqon

Well-known member
Attention! The r50 Update is the promised reworking of monster attributes. To start, I'll post the same list I posted earlier but with updates about BatBrain's level of handling.

Resistance

  • stunresist: Now handled. Keyword: nostun.
  • nopowder: Now handled. Non-powderable monsters are hardcoded. Presently I just have Hobopolis bosses and Mayor Ghost. Are there others?
  • Xresist: % X resistance. Still just as handled as it was.
  • damagecapX, mitigation, mitigationrate: Handled as before.
  • delevelresist: deleveling effects are reduced by %. Now handled. Keyword: delevelres. Which monsters should we apply this to now?
  • combatitemresist: damage from combat items reduced by %. Still haven't implemented this since I'm not sure of the details. Does anyone know a monster that this is nonzero for? For now BatBrain retains its "noitems" and "noskills" keywords for a monster's chance to block item/skill use, which seems to cover the majority of cases we've found thus far.
  • spellresist: damage from spells reduced by %. Now handled. Keyword: spellres. This keyword replaces the previous "nospells" keyword.
  • nopotato: potato-types don't work. This value can be specified and an appropriate variable is set in BatBrain, but it is presently meaningless. Still needs handling.
  • nostagger: Still handled.

Misc

  • fratboy, cavefratboy: Handled. Qualifying monsters were specified explicitly in batfactors for the ring.
  • hoboautohit (element, chance): No change. Still handled.
  • crazyoutmoxbonus: ?????
  • damageaura (element, amount): Support for this already added with previous update. Keyword: aura.
  • noncorporeal: Handled in previous update. Special handling added for the scroll.
  • noputty, nostatvariance, nomlhp, holiday, nostats: Handling not needed.
  • autohit: % chance of auto-hitting. Now handled. Keyword: autohit. This replaces the previous "nomiss" keyword.
  • automiss: % chance of auto-missing. Now handled. Keyword: automiss. This replaces the previous "nohit" keyword.

Penetration

  • penetration, [elem]penetration: For these, we'll use the previously unused pdmg field to specify a spread. Each element specified will represent levels of elemental penetration. For $element[none], it will represent DA penetration. Inputting this data is supported -- BatBrain will correctly read the pdmg field into the appropriate variable -- but it is not implemented. I believe I'll be wanting to make a feature request for some kind of speculative elemental resistance and damage absorption function(s) before I'm able to implement this. For now the only applicable monster that has been mentioned in this thread is the ninja snowman assassin.
  • drpenetration: ignore the first x DR. Handled since previous update. Keyword: drpenetration.

Retal

  • apathy/cunct/corrode: No change. Could still use a double-check.
  • thorns, hotthorns: Still handled. Keyword: retal.

Now that we have more than one monster able to dodge melee attacks, I've also added support for a "dodge" keyword. This update also fleshes out the chimera support a little more.

So that's a lot of progress towards more accurately mirroring KoL's handling of monsters!

Now to preempt some error reports!

  • I've uploaded a search-and-replaced batfactors to go along with this update, so if you are getting "Unknown keyword found" messages, you probably need to delete batfactors to force a refresh.
  • I suspect that this update may break WHAM. For the most part, it will be easy to fix -- I've moved most of the monster attributes into the monster_stat() function, so in place of nostagger you would instead use monster_stat("nostagger") and so forth. The only tricky bit is that some of the names have changed. The updated list of keywords is available on the batfactors Wiki page.
Enjoy!
 
Last edited:

Magus_Prime

Well-known member
I've posted to the WHAM thread with the changes I've had to make to accommodate Batbrain r50. Only a few changes have so far been necessary.

zarqon: thank you for the detail in your post. It made finding and fixing WHAM much easier than it could have been.
 
Last edited:
Top