BatBrain -- a central nervous system for consult scripts

Theraze

Active member
Question. The blazing bat (1210) is onlyhurtby <element> (in this case, onlyhurtby cold) else it takes 2 damage or less. Additionally, it's immune to weapons, both in skills and regular attacks. So how should the batfactors line be set? It doesn't appear that there's currently a good way to mark this, as onlyhurtby works with clubs, pottery, and healing currently.

When manually throwing some frozen chunks of ice, it fell quickly, pierced to the quick, but it would be nice to not have an unknown quantity of failure happening before I note its lack of automation.
 

Crowther

Active member
Question. The blazing bat (1210) is onlyhurtby <element> (in this case, onlyhurtby cold) else it takes 2 damage or less. Additionally, it's immune to weapons, both in skills and regular attacks. So how should the batfactors line be set? It doesn't appear that there's currently a good way to mark this, as onlyhurtby works with clubs, pottery, and healing currently.

When manually throwing some frozen chunks of ice, it fell quickly, pierced to the quick, but it would be nice to not have an unknown quantity of failure happening before I note its lack of automation.
Just mark it as 100% resistant (1) to physical (none) and the other non-cold elements. I believe the rest comes from it being cold aligned which mafia tracks. Cold aligned doubles some of the 1 damage to 2 for the two elements it is weak too.
 

Theraze

Active member
Well, I tried this but it didn't appear to be entirely successful.
Code:
monster	1210	blazing bat	0	0	res 1.0 none,hot,spooky,sleaze,stench
> SimpleSmack queueing... (Monster HP: 510, base profit 0)
> → Action 1: skill 4023
> → Outcome: You win!
Round 1: Theraze executes a macro!
Round 1: Theraze casts K?SESOSSESTURM!
Round 2: blazing bat takes 2 damage.
Might need something to reload. We'll see if the next character works better, or if we need to say there's more than 100% resistance to get it to ignore the elemental type, but...
 

Crowther

Active member
Physical resistance and hot alignment are handled by mafia in monsters.txt:
Code:
blazing bat     1210    firebat.gif     Atk: 200 Def: 180 HP: 500 P: beast E: hot Init: 50 Phys: 100
I'm unsure about handling the rest. Checking more...

EDIT: I give up. I thought at one point I knew how to do this. Now I can't.
 
Last edited:

Theraze

Active member
It's shifted several times. It used to all be manual in batfactors, but currently it seems it mostly uses monsters or is static coding for dynamic monsters in BatBrain itself.

But yeah. Nothing seems to quite work perfectly anymore for this, so... I mainly just sort through the problems as they hit my random fax sessions. :)
 

theo1001

Member
Maybe
Code:
monster	1210	blazing bat	3 spooky,sleaze,stench	0

That seems to be what it uses for similar cases (e.g Servant of Lord Flameface)

I am guessing it doesn't need none, hot because mafia already knows it is a hot aligned monster with 100% phys res.
 

Theraze

Active member
Spells work, it's weapon skills that (according to the wiki) don't work. So no northern explosion, if the wiki doesn't lie. :)
 

zarqon

Well-known member
I've uploaded this to batfactors:

Code:
monster	1210	blazing bat	5 none,hot,spooky,stench,sleaze	autohit, dodge 1.0

which ought to handle everything but the monster's unique attack damage, which has to be hardcoded in BatBrain. I've added the code and it will be in the next update.

I hadn't checked mafia's data, but Crowther is quite right, the physical resistance and default monster element stuff is taken from mafia's data, and information specified in batfactors simply overrides existing data. The "none" above could be omitted (in which case the 5 should become a 4).

EDIT: And r109 adds the blazing bat's attack and makes the "dodge" keyword work for the weapon attacks listed on the Wiki, not just "attack".

It also adds a patch submitted by someone, somewhere, somewhen (search can't seem to find it) for the short calculator, so that it only works vs. pygmies and delevels the correct amount. You can all un-blacklist your short calculators now. :)
 
Last edited:

heeheehee

Developer
Staff member
I was wondering about this "onlyhurtby" keyword (since that's not something I remember from the twitch leaks). I imagine that in-game those three cases are all hardcoded in fight.php.

Dodge (well, unhittable(x)) has always worked for weapon-based skills.
 

zarqon

Well-known member
Yes, "onlyhurtby" wasn't in the Twitch leak but I consolidated some special cases there, and made a framework for possible similar mechanics that may arise later. It presently supports all weapon types (i.e. "club", "knife", "accordion") as well as "pottery" and "healing".

Until r109, there was no code anywhere in BatBrain for making the "dodge" keyword apply to weapon-based skills. If your hitchances were being calculated correctly, it must have been through magic! I'll take it. :)
 

zarqon

Well-known member
OMGZ0r it's update 11!1!11!!! Er, r111.

This update focuses on Batfellow. While I still wouldn't attempt to automate Batfellow at present, anyone playing as Batfellow using Batman RE will have accurate information at hand now (i.e. mousing over the monster's attack will tell you how much damage the monster will deal to you). The damage of punches and kicks is now set correctly.* We've added all the monster attacks, correctly reduced by your appropriate Bat-stat (such as Bat-Bulletproofing for ranged weapons, Bat-Stench Resistance for stench attacks, and so forth). We also account for the weapon being wielded by mooks and criminals. It seems that my feature request was pretty niche and unlikely to ever be on anyone's radar, so although I would still appreciate the attack_element field being set for those monsters, the rest has been handled in-script.

Also, now that mafia tracks your Bag o' Tricks usage, we have removed BatBrain's now-redundant code for tracking that.

Cool Enhancement to SimpleSmack

For anyone using SimpleSmack -- the sample consult script in the first post that I've included as an example of how to code consult scripts using BatBrain, which is also the consult script I use for everything -- I've uploaded an update. It adds an example custom sort called decimate_action(), which will find your best attack option that almost kills the monster. I've also added code to use this action versus slimes in the Convention Hall, followed by the G?-gone, so it should be possible to automate the slimes now no matter which skills you have available without changing your CCS.

Enjoy, everyone!

* While the multiplier and modifier are accounted for correctly, the damage for punches and kicks is increased by the amount of times you've used the opposite skill, rather than the amount of times you've switched between them. In practice, however, this leads to BatBrain preferring alternation, which means the incorrectness won't show up unless you manually punch twice in a row, for example, after which BatBrain would incorrectly think your punch still deals 5 (or 10) and your kick now deals 7 (or 14).
 

Magus_Prime

Well-known member
Tried using SimpleSmack against the amorphous blob and got:

Code:
This monster is stun immune! That information should be added to batfactors.

Also got that for the hostile intelligent alien in the Spacegate.
 
Last edited:

fronobulax

Developer
Staff member
So my supposed latest version of batfactors is dated 10/16/2017, Is there a problem with updates as they occur on my machine or have people stopped updating and sharing it? Thanks.
 

zarqon

Well-known member
You acquire an effect:

On Your Honeymoon (24 turns)

Currently traveling Europe. Will be back home and able to fix stuff (if such stuff there be) in late May. Sorry for any inconvenience!
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
You acquire an effect:

On Your Honeymoon (24 turns)

Currently traveling Europe. Will be back home and able to fix stuff (if such stuff there be) in late May. Sorry for any inconvenience!

Remember to use your free kills, maybe hit up the hidden temple
 

fronobulax

Developer
Staff member
batfactors can be edited and uploaded by anyone. We know that won't be zarqon for a few weeks. Has anyone else worked on it since October? I'm still a bit concerned that updates might not be working.
 

Pazleysox

Member
batfactors can be edited and uploaded by anyone. We know that won't be zarqon for a few weeks. Has anyone else worked on it since October? I'm still a bit concerned that updates might not be working.

Having little experience with this script, I did not know this. I am however curious how the script will respond to a monster (Plywood_cultists) that will only take damage from passive sources.

Code:
dodge (X)  The monster has an X percent chance to dodge melee attacks.  
noitems (X)  The monster has an X percent chance of blocking items (e.g. Bonerdagon).  
noskills (X)  The monster has an X percent chance of blocking skills (e.g. Naughty Sorceress).  
spellres (X)  The monster resists X percent of damage from combat spells.

I did bring up a feature request however.
 

Saklad5

Member
Is it possible to make BatBrain understand the Sing Along skill? It has different effects depending on what your SongBoom™ BoomBox is set to. Each of the Sing Along effects can easily be added to batfactors, but I’m not sure how to tell it that the skill changes wildly depending on the BoomBox setting. The latter is tracked by KoLmafia, so it’ll need to check a preference.

I suspect this isn’t actually possible without changing BatBrain itself. I’d implement it by adding a way to enable/disable an entry based on the boolean output of arbitrary ASH code. You could then have an entry for each possibility, and ignore all but one of them based on the booleans.

This would also be extremely helpful for the God Lobster, which has properties that change based on the familiar item you have equipped.
 
Last edited:

zarqon

Well-known member
@fronobulax: Have your updates been working now that I've been uploading some updates to batfactors? Recently went through and added a bunch of missing items and skills.

@Pazleysox: I've been adding information for the FantasyRealm monsters as I'm going through the content now. So BatBrain shouldn't recommend obviously impossible actions against these monsters now, but I'd still recommend fighting most of them manually (perhaps with BatMan RE's assistance) for now, since I've gotten killed by SmartStasis when fighting the spooky ghosts with their spooky aura, for instance.

@Saklad: Yep, I need to add support for both those things.
 
Top