BatBrain -- a central nervous system for consult scripts

Fluxxdog

Active member
I guess changing the fvars-line for shieldpower to the following would make it not consider that:
Code:
fvars["shieldpower"] = (item_type(equipped_item($slot[offhand])) == "shield" && current_hit_stat() != $stat[moxie]) ? get_power(equipped_item($slot[offhand])) : 0;
what I did was add this line in to the build_skillz() function:
Code:
        case 2003: case 2005: case 2015: case 2103: case 2105: case 2106: case 2107: if(weapon_type(equipped_item($slot[weapon]))!=$stat[Moxie]) continue;
 

Theraze

Active member
Are there any ranged mysticality weapons? I know most of them are melee, but... any weird exceptions to that rule?
 

Bale

Minion
I just found and debugged another BatBrain error! This one involves stunning before custom actions.

I've been taking some serious hits before olfaction and summoning pasta spirits and I had no idea why SmartStasis wasn't casting entangling noodles since it seems that there's some code in place. Finally I decided to do something about it since I'm a fragile Pastamancer. (SCs and TTs have tons of HP, Saucerors get back HP by attacking & DBs and ATs don't get hit much.)

Anyways: The bug is in stun_action(). The top item on the list was magical mystery juice and stun_action() refused to check another item since on line 939 it has else break; whose purpose there is unknown to me. I commented out line 939 and suddenly it is happy to cast Entangling Noodles before summoning a pasta spirit.

Did I break something by removing that line? Was it vestigial code from an earlier version? Does it need a different fix?

zarqon, since you're probably going to roll out a new version soon thanks to Veracity's Demon of New Wave fix, don't forget to include this!
 
Last edited:

Bale

Minion
Would it perhaps make sense to put a "continue" there instead of a break?

No. It's the last line before the curly-brackets. "Continue" would be exactly the same as nothing at all. The purpose of that break was to ensure that only the first sorted item in opts gets checked which doesn't make much sense to me, especially with the fancy funkslinging check.

Huh. Looking at it I don't think that the fancy funkslinging check actually ensures that it is looking at an item. That doesn't work well either. I really want to know what zarqon says about it. I think he's putting too much faith in his sort algorithm which doesn't guarantee if the character even has any stunning items.
 
Last edited:

Bale

Minion
That's what "continue" does. It's also what the closing curly-bracket does. "continue" would be redundant.
 

Winterbay

Active member
Always struck me as a tad weird. Would make sense for a wand to be moxie/ranged. The only one in the game, though, is the Wand of Nagamar.

Heh, watch the next IotM be a ranged wand ^^

Jick seems (on radio shows) to always state that KoL uses staffs because they are more badass and that the KoL-players are more Gandalf (badass) than Harry Potter (wuss apparently). But then I guess the normal use of a staff is to throw projectiles so I dunno :)
 

Theraze

Active member
Ah... so the long answer is yes, there is currently one weird exception, but it's not one that's popular as a weapon?

Also, looking at the line you suggested putting in for melee weapon detection... is that right? It seems like the only switch(es) you can put it into in build_skillz would be either the damage one, or the "regular damage and still evaluating" one. Neither one should have its damage calculation skipped if it's not a moxie weapon, especially because depending on where that's placed, it would override the existing check.

But the underlying problem is that you want it to not be a moxie weapon to continue... and the "continue" is actually the STOP LOOKING AT THIS, not the thumbs-up in for-loops. I think what you actually want is to add
Code:
        case 2003: case 2005: case 2015: case 2103: case 2105: case 2106: case 2107: if (weapon_type(equipped_item($slot[weapon])) == $stat[Moxie]) continue;
into the line just above the FIRST default.

By not having a break, it will bleed its consideration into the next case type, so that would be (the first) default. We could technically put it into any row below the spring raindrop attack in the first switch, or below the harpoon line in the second switch, but having it there reduces how much useless consideration it makes.

By having it continue on moxie weapons, it skips adding the skill as a valid option if you're using a moxie weapon, which is, I believe, the goal. If, for some reason, you're using the Wand of Nagamar as your weapon, it will still be wrong. If, because they can, another ranged mysticality IotM (or for that matter, ranged mysticality weapon of any sort) is added or converted, we'll probably need a proxy value for ranged/melee weapons. Probably melee, since that's the maximizer string...

Regarding staves... yeah, seems weird that apparently, what mages do with their magical staves is... bash people with them. Forget about spells, what do wizards do? Hulk Smash!
 

Fluxxdog

Active member
Ah... so the long answer is yes, there is currently one weird exception, but it's not one that's popular as a weapon?
No, the short answer is no AFAI or anyone else K. WoN uses muscle. At least, it seems so. Nothing mentioned about it using Mys or Mox.
But the underlying problem is that you want it to not be a moxie weapon to continue... and the "continue" is actually the STOP LOOKING AT THIS, not the thumbs-up in for-loops. I think what you actually want is to add
Code:
        case 2003: case 2005: case 2015: case 2103: case 2105: case 2106: case 2107: if (weapon_type(equipped_item($slot[weapon])) == $stat[Moxie]) continue;
into the line just above the FIRST default.
!$#%$!^!$#%#Q@#$! with a cherry on top!! I swear that was a == and not a != operator! The change I have had an == in it, and I could have sworn I C&Pd. Grr... brain sizzling >.<

On a side note, is there a reason deleveling is considered profitable when you're, say, +400 moxie over the monster's attack? I'll be honest, I'd consider it up to a difference of 20 or so, but after that, deleveling seems overkill (special attacks not withstanding).

Edit: Had to test the wand, just in case:
Shield in hand (er, well, offhand), you bull rush your opponent like Moses, overwhelming its defense.

You wave your Wand of Nagamar at its UPPER THIGH, which transforms into a HIPPER THUG. The thug wanders off to find a groovier locale, and your opponent takes 503 (+15) (+15) (+15) (+15) (+15) damage. WHAM! WHAMMO! POW! WHAM! BOOF! BAM! ZOT! ZAP! WHAM! BAM!
 
Last edited:

Bale

Minion
Debugged another BatBrain bug. (That's my third since the last version was released!)

Line 1018 in enqueue() should be:

Code:
   if (rep.length() > 0) r.append([COLOR="#FF0000"](popped? " && (": "(")[/COLOR]+rep+")");

Yeah, I'm doing all sorts of fun stuff.
 
Last edited:

Bale

Minion
I'd like to make a feature request for BatBrain: I'd appreciate if I had a way to alter the hp threshold for "Danger, Will Robinson". My combat script runs into plenty of situations where one more hit from the enemy will kill me, but I'm guaranteed to kill him before that happens. Unfortunately the script aborts despite my guaranteed victory. This is particularly relevant on the Battlefield in Bees Hates You since the gear starts off slaughtering my HP before the monsters ever have a chance.

Additionally, high level Bees have damage resistance. I was being killed until I added this:

Code:
   case $monster[Beebee King]:
   case $monster[bee thoven]:
   case $monster[Queen Bee]: foreach el in $elements[] mres[el] = 0.5; mres[$element[none]] = 0.5; break;

I am aware that there is nothing on the wiki about Bee Thoven having damage reduction. The wiki is wrong.

Zarqon, could you tell us how the next version of BatBrain is coming along? To test out the full power of BatBrain I made a pretty awesome combat script that I'm thinking about posting, but it will not work unless you fix the three bugs I pointed out earlier in this thread. I fixed those to make my script function so I don't feel I can share my work unless you update. (I'm sure that the users of spamattack see no reason to use mine and it is superior to mine in some respects, but mine has its own advantages thanks to BatBrain being smarter than me and it is way quicker if you've got a ton of skills for it to sort through.)

Well, no rush I suppose since my script still needs some testing for a few combat strategies that have been improved since I was last able to test them.
 
Last edited:

Theraze

Active member
I did note the bee resistances back on post 206 and zarqon was going to look at that when he was doing his Bee run. I'd suggest doing the following though:
case $monster[demon of new wave]: foreach el in $elements[] mres[el] = 0.4; mres[$element[none]] = 0.4; break;
case $monster[queen bee]:
case $monster[beebee king]:
case $monster[bee thoven]: foreach el in $elements[] mres[el] = 0.5;
case $monster[gargantuchicken]:
case $monster[heavy kegtank]:
case $monster[mobile armored sweat lodge]: mres[$element[none]] = 0.5; break;
Basically, put the 'all element' resistance between the demon spirit and the gargantuchicken, since we can reuse the element[none] down there and keep things more ordered. :) It also seems more 'standard' for what's currently done. We don't really have much that has one-off lines... though this section:
case $monster[hulking construct]: mres[$element[none]] = 1;
case $monster[zombo]:
case $monster[spooky hobo]: foreach el in $elements[] mres[el] = 1; break;
should probably have the hulking construct move up to above frosty, since they have the same official resistances. But that's a consistency thing, doesn't change the way it actually runs...
 

Winterbay

Active member
I like the fact that my low level PM suddenly decided to go "thrust smack - spaghetti spear" today. It is fun to see the combinations taking place :)
Since I'm not optimal in any way just having my script picking a combat strategy that is cheap is perfect for me, more advanced things might be a good programming exercise though I guess...
Also: I've noticed that when my spamattack aborts due to the danger-warning it sometimes does that, and sometimes it then loops another round and kills the monster (generally with a 0MP skill).

Also, I've had that change in my local copy a while. The bee thoven does have resistance, but it is also a plural monster so the effect from spells is really close to it not having a resistance which might be what is confusing people. I think that was mentioned on the talk page of the bee thoven (one of the best jokes in the game by the way).
 

Bale

Minion
However, this gives me an idea. I think I'll rework the stasis_action() sort to consider all actions that would never kill the monster equal in terms of damage -- rather than sort by dmg_dealt() as our final criterion, sort by max(dmg_dealt(), monster_stat("hp") / max(1,maxround - round) + 5). That 5 is there as a little cushion against damage range swing. That means that if you're fighting a monster with 900 HP, only an action dealing at least 30 damage even has a chance to kill the monster, so all actions dealing < 30 damage will be considered equally for stasis, sorted by profit.

And, an even better sort for stasis_action() is:

sort opts by -min(kill_rounds(value),maxround - round + 3);

I've tried these both and I'm going to insist that the first one is better, especially for low level characters. The second one tries to choose stasis actions like toss instead of a seal tooth. :(
 

Bale

Minion
Just wanted to make another "BatBrain is smarter than I am" post.

Today I'm playing a muscle class with a shield equipped. My combat script started using saucestorm to kill monsters instead of shieldbutt. LoL! Yeah, the monsters were spooky and saucestorm did double damage since I have Immaculate Seasoning. I never noticed until now that the mp cost for saucestorm is the same as two shieldbutts and since it was easily doing twice as much damage I can only jump with the desire to shake BatBrain's hand. Thank goodness my current consult script doesn't force me to shieldbutt just because I'm a muscle class with a shield equipped.

Normally I would never have thought to do this.


======= Edit: Then there is this charming example!

Code:
Round 2: bale executes a macro!
Round 2: bale casts ENTANGLING NOODLES!
Round 3: bale casts THRUST-SMACK!
Round 4: bl imp takes 59 damage.
Round 4: bale casts CLOBBER!
Round 5: bl imp takes 22 damage.
Round 5: bale casts TOSS!
Round 6: You pick up Princess Vina and toss him at your opponent, dealing 13 damage. Go Princess Vina!
Round 6: bl imp takes 13 damage.
Round 6: bale wins the fight!

Total mana cost = 7. That's also better than entangling noodles + 2 shieldbutts!
 
Last edited:
Top