BatBrain -- a central nervous system for consult scripts

BatBrain overvalues the meat value of item drop from CandyBlast. It believes they are worth 46 meat per cast (see here). This is a combination because the code believes a candy drops every cast (it's only 1 in 3) and because unsellable candy are treated as worth 50 meat. The average value per cast in hardcore is closer to 7 meat (I've no idea about aftercore, since those candy are hard to trade). A quick fix is to delete those items from the Candyblast line in batfactors, but that will mean Candyblast might not be used when it is optimal.

EDIT: I'm going to try changing batfactors to list Candyblast as always dropping a dried face. That autosells for 7 meat and while an ugly hack, should get me my optimal usage.
 
Last edited:
Track seal pup wailing in happenings ("sealwail"). The next SS release will then consider seal pups huckleberries until they wail.

Will SS be aware that they will not wail unless they take at least 1 point of damage from an attack, but do not die from that hit? Use a seal tooth and there is a 100% chance that they will wail. This seems rather different from the usual method of dealing with a huckleberry.
 
In theory, it might not work because SS may choose 0-damage options for all 20-odd stasis rounds. In practice, it worked for me. Either way, it's a big improvement on one-hit-killing them.

@Crowther: Thanks for the detailed report. I'm looking at some way of adding a "rate" specification to the "item" keyword, which would help Candyblast and other non-100% item-producing skills to be represented more accurately.
 
@Crowther: Thanks for the detailed report. I'm looking at some way of adding a "rate" specification to the "item" keyword, which would help Candyblast and other non-100% item-producing skills to be represented more accurately.
Cool! That doesn't look like an easy fix. My dried face hack worked out very well and let me finish that classy pasta run efficiently.
 
1.31 Update

I was hoping to release this update on January 31st for obvious reasons, but I found a really nasty little bug and wanted to squash it immediately. Back in March of last year, batfactors was reworked to handle player damage (HP) as a spread. However die_rounds() was still only considering physical damage, meaning that BatBrain was dramatically wrong about your survivability against elemental monsters.

I'm really surprised that this bug was able to exist undetected for so long!

The only other thing in this update is special attacks for elemental hobos (total guesswork: 10% of your max HP -- link to spaded numbers welcomed!) and the frustrating knight. Still, considering the severity of the longstanding bug, a pretty big update.

Enjoy!
 
Nobody noticed the bug for this long you could have waited 4 more days. Releasing 1.31 on 1/27 is just lame.
 
Actually I think I noticed this bug or something similar a couple of days ago although I fear the update did not squash it. I started my whining in the SS thread so that is where today's log is.
 
1.31.1 Update!

Happy 1.31.13! Enjoy 1.31.1. You may think that's cheap, but here's me, not caring: :)

After much sleuthing about and an entire evening spent in the hunt, I'm extremely pleased to report what I believe to be the final death of the persistent Salve/Bandages bug.

The bug was actually a bit more involved than I reported previously. BatBrain had unintentionally been simplifying all monster attacks to be physical, meaning that die_rounds() ignoring elemental damage was actually mostly fine. BatBrain had only been somewhat inaccurate against elemental monsters -- because it was not applying the player's elemental resistances. When I fixed that part in the last update, other parts which were also using that simplification broke. So as it turns out, that was a bug but not the bug.

A much bigger problem was to_profit() ignoring elemental damage to the player. Fixing this will no doubt have numerous repercussions in improving accuracy for anything that deals elemental damage to the player (including monster attacks). Fixing this would probably have eliminated the Bandages issue for the vast majority of people who experienced it before -- but it wouldn't be entirely gone. It would surface, at odd times and places, a vile vermin haunting the dreams of players with in-combat healing options.

The remainder of the bug was hiding, seemingly innocuously, in dmg_taken(), the function which reduces a pdmg spread to a float and applies the player's elemental resistance. For any spread which included healing (stored in the data as negative physical damage), it was returning the healing without bothering to foreach the other elements. This was in the interest of speed, since that function is called hundreds of times and there were no healing actions which also dealt the player damage.

However, that was an incredibly shortsighted speed enhancement, since when merging many advevents to determine everything that happens in a round, there may well be both healing and elemental damage -- such as from elemental monsters. This means that when calculating the profit from healing actions -- say, Lasagna Bandages -- the HP calculation would include the healing from Bandages but not any elemental monster damage!

Now that all of those things have been fixed, I believe this bug ought not surface again. I believe it to be truly dead. However, many have thought the same of bedbugs, or crabs, or James Bond. So I shall stay wary. Yet for the nonce we may enjoy the improvements this update brings to our gaming experience, particularly if we have Bandages/Salve.

If you're using WHAM and have disallowed those skills to avoid the problem of SS stasising with them at senseless times, I'd encourage you to re-allow them and see if they are abused again. I strongly doubt they will be.

One other thing. The double-ice cap has been removed from batfactors, and its effects are added to the monster event only if its stun/dmg effect has not already happened. I was seeing very bad advice with a cap equipped due to the fact that BatBrain assumed the retaliation event would happen every round. This is not a complete fix, since it will still assume that until it actually happens, but it's drastically improved my relay play, at least.

Also, look forward to updates to both SS and BatMan RE within the next hour, adding some nifty support for Siphon Spirits.

Enjoy!
 
1.31.13 breaks SmartStasis 3.17 with
Cannot apply operator * to m_regular() (spread) and ( 1 - m_hit_chance() ) (float) (SmartStasis.ash, line 148)
presumably because I had the misfortune to update after BB was updated but before
Also, look forward to updates to both SS and BatMan RE within the next hour, adding some nifty support for Siphon Spirits.
 
I found a tiny problem: "ceiling" should be "ceil" in batfactors.txt:
Code:
fam     26      Crimbo Elf      (0.3+0.1*ceiling(fweight/6))*0.75*(fweight+4)   0       rate 0.33
I don't actually own a Crimbo Elf, I was just playing with the wardrobe.
 
Another triviality. I don't think BatBrain accounts for the pufferfish's special attack. I find it hard to care, since only someone farming spines would be there. Or someone like me trying to get factoids.
 
Okay, I've made a start at the new Jarlsberg spells. I'm high enough level that I've capped the myst bonus and I haven't tried any bonus spell damage, so I don't know either of those caps. Still, it's a start and predicts my high level Jarlsberg damage pretty closely.
Code:
skill   14000   Curdle  spelldmgpercent*15 stench       0       0
skill   14003   Boil    spelldmgpercent*50 hot  0       0
skill   14004   Fry     spelldmgpercent*95 sleaze       0       0
skill   14014   Chop    spelldmgpercent*50      0       0
skill   14013   Slice   spelldmgpercent*95      0       att -9
skill   14023   Bake    spelldmgpercent*5 hot   0       0
skill   14024   Grill   spelldmgpercent*95*2 hot,spooky 0       0
skill   14033   Freeze  spelldmgpercent*50 cold 0       0
skill   14034   Blend   0       0       stun 3
Hopefully, I'll ascend soon and see if I can figure out the myst bonus factors and caps. I've noticed that BatBrain doesn't account for the rain-doh green lantern, but I think I'll pull an off-hand item for stats next run.
 
Curdle seems to max out at +10 spell damage if my limited testing to be believed.
I guess I'll pull a big bumboozer marble tomorrow, since that should probably cap every spell's bonus damage and I have lots more pulls than I need.

EDIT:

It looks like the only problem skill is bake. This system isn't setup for multi round damage effects and honestly, after playing hundreds of rounds of combat by hand, I don't think it matters much. Bake is too weak to bother. Stringozzi Serpent might be worth the effort, maybe, but bake isn't.

EDIT: I should have said bake, not boil.

EDIT3: It seems only fry, slice, and grill are affected by spell damage bonus and mysticallity. These three spells also have a base range. I've got a few data points, but figuring out the right formula is proving difficult. I believe the other spells are correct as above (except bake, of course).

EDIT4: remove wrong table

EDIT5: Okay, finally got enough data points. There appears to be a cap on the final damage, which doesn't exist on other spells. Grill isn't quite right, since the cap isn't the same for hot and spooky damage. Capped, grill always does 375 hot and 750 spooky.
Code:
skill   14000   Curdle  spelldmgpercent*15 stench       0       0
skill   14003   Boil    spelldmgpercent*50 hot  0       0
skill   14004   Fry     min(spelldmgpercent*({40,45,50}+min(0.3*buffedmys,50)+spelldmg+elembonus),500) sleaze   0       0
skill   14014   Chop    spelldmgpercent*50      0       0
skill   14013   Slice   min(spelldmgpercent*({40,45,50}+min(0.3*buffedmys,50)+spelldmg+elembonus),500)  0       att -9
skill   14023   Bake    spelldmgpercent*5 hot   0       0
skill   14024   Grill   min(spelldmgpercent*({40,45,50}+min(0.3*buffedmys,50)+spelldmg+elembonus)*2,1125) hot,spooky    0       0
skill   14033   Freeze  spelldmgpercent*50 cold 0       0
skill   14034   Blend   0       0       stun 3


EDIT6: I've freed that king, so that's as close as I'll get for a bit. Jick admited these spells follow a new formula and their damage goes down if you lower the MP cost. So much for improving transparency.

EDIT7: Jick says boil doesn't work like I listed it. He's seriously changed things around, but he above worked pretty well for me. I've only got 1.5 more Jarlsberg runs to do, then I'm done with it.

EDIT8: Okay, I've rolled in what Jick wrote. I don't know if/what the inner cap is for boil, chop and freeze, so I left that out. The following is untested, there my be syntax errors. I've already played my turns for the day.
Code:
skill   14000   Curdle  spelldmgpercent*15 stench       0       0
skill   14003   Boil    spelldmgpercent*min({10,12.5,15}+0.4*buffedmys+spelldmg+elembonus,mpcost*10)    hot     0       0
skill   14004   Fry     spelldmgpercent*min({40,45,50}+min(0.3*buffedmys,50)+spelldmg+elembonus,mpcost*10) sleaze       0       0
skill   14014   Chop    spelldmgpercent*min({10,12.5,15}+0.4*buffedmys+spelldmg+elembonus,mpcost*10)    0       0
skill   14013   Slice   spelldmgpercent*min({40,45,50}+min(0.3*buffedmys,50)+spelldmg+elembonus,mpcost*10)      0       att -9
skill   14023   Bake    spelldmgpercent*5 hot   0       0
skill   14024   Grill   spelldmgpercent*min({40,45,50}+min(0.3*buffedmys,50)+spelldmg+elembonus,mpcost*10)*2 hot,spooky 0       0
skill   14033   Freeze  spelldmgpercent*min({10,12.5,15}+0.4*buffedmys+spelldmg+elembonus,mpcost*10) cold       0       0
skill   14034   Blend   0       0       stun 3
TODO: check for inner caps on boil, chop, freeze (~85 myst should show it). Check curdle and bake with very low myst to expose scaling below caps. Something is odd about grill, since hot and spooky don't cap the same.
 
Last edited:
Adding Crowther's Edit8 to batfactors makes AoJ fairly smart for combat, but sometimes it still decides that just attacking is better. I've added the following line:
Code:
   if (my_class() == $class[Avatar of Jarlsberg] && id == "attack") through = 0;
to hitchance just below the other id == "attack" line. This makes it consider any attack with weapon during AoJ as having a 0% chance to hit, and nicely avoids using it without screwing anything else up that I can notice. :)

The only thing I'm not sure about is whether the patriot shield will screw it up and make it think it can get a critical attack in. I'd initially put my check in just under jiggle... that might be safer.

Edit: Changed to use the following:
Code:
   if (my_class() == $class[Avatar of Jarlsberg] && id == "attack") return 0.0;
right after the jiggle line. That should definitely return 0% hitchance for attack, even when OPS-ing.
 
Last edited:
Or, if you are using WHAM, you could change the "attack" case in OK() to:
Code:
case "attack":
                return (my_path() != "Avatar of Jarlsberg" && ((my_path() != "Avatar of Boris" && no_cunctatitis() && no_teleportitis()) ||
                        (my_path() == "Avatar of Boris" && (!have_equipped($item[Trusty]) && no_cunctatitis() && no_teleportitis()) || (contains_text(to_string(m),"Naughty Sorceress") || m == $monster[Bonerdagon] || have_effect($effect[temporary amnesia]) > 0))));
 
True, but since some people use WHAM, some people use SS, and some people use BatRelay, patching BatBrain fixes all 3. :) In some cases, I have had SS decide that attack with weapon is the best stasis option, and if anything happens to combat I do switch the relay browser...
 
In some cases, I have had SS decide that attack with weapon is the best stasis option, and if anything happens to combat I do switch the relay browser...
When I read your patch, my first though was, "That makes it the ideal stasis option." Luckily, there's very little reason for Jarlsberg to stasis. Actually, it's something I love about Jarlsberg. Combat is over very fast. When automated, things just fly by. I still haven't had a chance to try my latest BatFactors. I'm glad to hear they are working.
 
And it's true... if you did want to stasis during AoJ, attack with weapon is your best option. Guaranteed moving a round forwards without any damage caused by your action. :)
 
Back
Top