Winterbay's Helpful Automatic Monsterbasher (WHAM)

Okay, I tried replacing WHAM's call to SmartStasis with main@SmartStasis(initround, foe, pg) and it failed, just as before. Why would SmartStasis fail to work properly only when called by WHAM?

Just to ensure I wasn't losing my mind I tried SmartStasis solo again and use a lasso like a champ.

Now my CCS looks like this:
Code:
[default]
consult SmartStasis.ash
consult WHAM.ash

That works wonderfully. For now I'm using that and I've commented out the line in wham's main where it calls smartstasis.

Code:
[904] An Octopus's Garden
Encounter: octopus gardener
Round 0: bale loses initiative!
Round 1: bale executes a macro!
Round 1: bale uses the Rain-Doh blue balls and uses the sea lasso!
Round 2: octopus gardener takes 14 damage.
Round 2: octopus gardener drops 233 attack power.
Round 2: octopus gardener drops 322 defense.
Round 2: Coco rolls the plastic pumpkin bucket at it. It promptly trips over it and falls, taking 41 damage.
Round 2: octopus gardener takes 41 damage.
[COLOR="#800080"]WHAM: Starting evaluation and performing of attack
WHAM: We are going to 1-shot with attack with your weapon.[/COLOR]
Round 2: bale executes a macro!
Round 2: bale attacks!
Round 3: octopus gardener takes 1690 damage.
Round 3: bale wins the fight!
Your familiar gains a pound: Coco, the 14 lb. Grouper Groupie
You gain 10 Muscularity Points
You gain 144 Meat
After Battle: Coco shakes her dorsal fin, and her pectoral fins, to music only she can hear. If you were a fish, it'd probably be a little titillating, so thank goodness you're not a fish.Coco holds out the plastic pumpkin bucket, hoping for extra goodies.
A dolphin stole: soggy seed packet
You gain 59 Fortitude
You gain 29 Magicalness
You gain 26 Chutzpah

This problem makes no sense to me.
 
Last edited:
I don't really see how the implementation could be a problem seeing as WHAM_bulid_custom does the exact same call as SS only with the added check of the WHAM_UseSeaLasso-variable. It then, at the end, calls build_custom

WHAM:
Code:
    if(my_location().zone == "The Sea" && item_amount($item[sea  lasso]) > 0 && vars["WHAM_UseSeaLasso"] == "true" &&  get_property("lassoTraining") != "expertly")
        encustom(get_action($item[sea lasso]));

SS:
Code:
if (my_location().zone == "The Sea" &&  get_property("lassoTraining") != "expertly" && m !=  $monster[wild seahorse]) encustom($item[sea lasso]);

encustom($item) calls encustom(advevent) which is the version WHAM uses so that code is identical only slightly more function calls.

That said, WHAM_bulid_custom then calls build_custom which is the SS function that contains the sea lasso thing so even if WHAM_build_custom failed to lasso the monster build_custom should take over and do it for you (unless BatBrain has set the fight to finished).

COuld you run a fight which should lasso at verbosity 9 so I can see the printout?
 
One possibility is that somehow opts[] is empty when the build_custom functions get called. Does WHAM call act() absolutely first thing?

EDIT: A finisher script should probably never call main@SmartStasis. SmartStasis assumes the actions following it are inflexible macro/CCS commands and thus does some things which a combat script might not desire:

1) It adds Cyrpt mini-boss finishers as custom actions. A BatBrain powered script such as WHAM could take advantage of attack_action() to decide whether or not this was actually the best attack.
2) It performs a stun action if it thinks your attack action is likely to take more than one round and it will be profitable. A BatBrain powered script may want to make that call using different logic or at a different place.

Further, a calling script may wish to change the order of some things:

1) A calling script may want to delay certain custom actions, such as insults, until the monster is mostly dead.
2) A calling script may wish to add certain other custom actions after build_custom is called, but before attempting custom actions.
 
Last edited:
Yes it does. One thing: Bale do you have WHAM_noitemsplease set to true? If so all items gets removed form vars[] before initialising with act() which would probably explain things.
 
His posted combat did list only 57 options in opts[], which seems low for aftercore unless you're the sort to keep most of your inventory in Hangk's or the closet.
 
Yes it does. One thing: Bale do you have WHAM_noitemsplease set to true? If so all items gets removed form vars[] before initialising with act() which would probably explain things.

Huh? You solved my problem!

I didn't even know that option existed! How did it get set to true? I certainly didn't change it any time recently. I think. I'm puzzled and sorry to have troubled you over something that turns out to have been user error.


His posted combat did list only 57 options in opts[], which seems low for aftercore unless you're the sort to keep most of your inventory in Hangk's or the closet.

I am that sort. I did create OCD Inventory after all! But it should still have more than 57 options as we've now discovered.

Once again, I apologize for having a problem which was my own damn fault.
 
Last edited:
No problem. I didn't even remember that I changed that setting to remove all items from factors rather than just disallow them in ok() :)
 
Looks like the problem might just be that LTS/TS don't currently allow for fumbling/missing. And QWOP makes those skills miss as well, and that missing is currently handled through the fumbling code.

While I can't prove that it was in effect for Magus_Prime, it meets the given facts. :) Except possibly about believing the Attack would do actual damage, but... that could be expected through passive/familiar damage.

LTS / LS also (last time I ran Bat Brain) overestimate damage from open hand attacks, as they don't actually change open hand attack damage, as they only multiply base weapon damage, which is zero open hand.
 
Yes it does. One thing: Bale do you have WHAM_noitemsplease set to true? If so all items gets removed form vars[] before initialising with act() which would probably explain things.


Incidentally, I believe that was the same problem I was having with the lasso. I am not a big fan of unlocking all of my items to be used by WHAM, though I don't have problems with the occasional necessary item like the sea lasso. Is there a way to make exceptions to the 'no items' rule? Kind of a reverse version of blocking certain skills/spells?
 
Last edited:
If you want "some items, please" this ought to work. It blacklists all combat items not present in exceptions. Further, if you change your mind, it un-blacklists items present in exceptions if you add them later.

PHP:
boolean[item] exceptions = $items[sea lasso, other stuff you want to whitelist];

int[string] blist;
file_to_map("BatMan_blacklist_"+replace_string(my_name()," ","_")+".txt",blist);
foreach i in $items[] if (i.combat)
   if (exceptions contains i) remove blist["use "+to_int(i)];
     else if (!(blist contains "use "+to_int(i)) && !i.reusable) blist["use "+to_int(i)] = 0;
map_to_file(blist,"BatMan_blacklist_"+replace_string(my_name()," ","_")+".txt");

Save it as "whitelist.ash" or somesuch and rerun it any time you edit the exceptions.
 
Last edited:
If you want "some items, please" this ought to work. It blacklists all combat items not present in exceptions. Further, if you change your mind, it un-blacklists items present in exceptions if you add them later.

PHP:
boolean[item] exceptions = $items[sea lasso, other stuff you want to whitelist];

int[string] blist;
file_to_map("BatMan_blacklist_"+replace_string(my_name()," ","_")+".txt",blist);
foreach i in $items[] if (i.combat)
   if (exceptions contains i) remove blist["use "+to_int(i)];
     else if (!(blist contains "use "+to_int(i))) blist["use "+to_int(i)] = 0;
map_to_file(blist,"BatMan_blacklist_"+replace_string(my_name()," ","_")+".txt");

Save it as "whitelist.ash" or somesuch and rerun it any time you edit the exceptions.
That's smart. I could probably mod it to allow reusable items. Although as Veracity pointed out KoL descriptions, mafia's flags and what really happens in KoL aren't entirely in agreement.
 
I noted something weird about reusable items and the Bonerdagon/Sorceress. It seems that they never block them. I wonder if that's a KoL bug?

@Darzil: I would love it if you could tell me how to fix the formulas for TS/LTS. As I mentioned before, BatBrain follows the formulas given on the Wiki, which I re-examined after you mentioned that before. How are those formulas wrong?
 
Back in the day, when they did block them, you would lose the item in question.

I was not aware that this had changed. edit: if they no longer destroy items, then that may correspond to this change. I don't remember, since I don't usually use items in those fights anyhow.
 
Back in the day, when they did block them, you would lose the item in question.

I was not aware that this had changed. edit: if they no longer destroy items, then that may correspond to this change. I don't remember, since I don't usually use items in those fights anyhow.
They would destroy the item and it destroyed quest items, IotM and other things that shouldn't be destroyed. They kept having to fix stuff and return stuff to people. I can see why they changed it to keep things simple.
 
No pick pocket attempt? It looks like I'd survive it easily. I realize that a 10% chance of a fat wallet is low, but you'll fail every attempt you don't make. I don't see the wallet mentioned though in the factors for the combat, so maybe it's missing? The monster has other items too that are worth something. ;)

Also, the output has a typo. :D "WHAM: Checking to see if WHAM sould adjust the unknown_ml for Wealthy Pirate.".




Code:
[692] The Poop Deck
Encounter: wealthy pirate
Round 0: chef_rannos wins initiative!
1 HP costs 1.329μ. ( 160 / 160 )
1 MP costs 4.651μ. ( 112 / 167 )
WHAM: We currently think that the round number is: 0 and that the turn number is 691.
WHAM: Checking to see if WHAM sould adjust the unknown_ml for Wealthy Pirate.
WHAM: No need to do anything with Wealthy Pirate.
WHAM: Setting up variables via BatBrain
booty chest charrrm (10.0 @ +70): 110μ * 17% = 18.7
solid gold pegleg (5.0 @ +70): 500μ * 8.5% = 42.5
Value of stat gain: 483.44μ
booty chest charrrm (10.0 @ +70): 110μ * 17% = 18.7
solid gold pegleg (5.0 @ +70): 500μ * 8.5% = 42.5
Value of stat gain: 483.44μ
ATT: 182 (50.29% × 29.16, death in 11)
DEF: 170 (8.8% × 9.81 (10), win in 10)
HP: 177, Value: 894.64 μ, RES: 0
Parsed round number: 1
Building options...
Options built! (69 actions)
WHAM: We currently think that the round number is: 1 and that the turn number is 691.
WHAM: Current MP = 112 out of 167.
WHAM: You have no profitable MP restoratives.
WHAM: Current HP = 160 out of 160.
WHAM: You have no profitable HP restoratives.
WHAM: You are fighting a Wealthy Pirate. Mafia considers that this monster has an attack of 182 or 182 when given a monster name.
WHAM: Mafia further considers that this monster has a defense value of 170 or 170 when given a monster name.
WHAM: Mafia further further considers that this monster has a HP value of 172 or 172 when given a monster name.
WHAM: Your current ML-adjustment is: 62.
WHAM: You have muscle = 80, mysticality = 83, and moxie = 141
WHAM: Monster HP is 177.0.
WHAM: WHAM added the following to BatRound: if pastround 29; abort "Stopping fight because it has gone on for too long (set WHAM_maxround to a higher value if you think this was in error)"; endif; 
use 2947 is not OK since it is marked as a custom action.
use 829 is not OK since it is marked as a custom action.
skill 15 is not OK since it is marked as a custom action.
skill 19 is not OK since it is marked as a custom action.
booty chest charrrm (10.0 @ +70): 110μ * 17% = 18.7
solid gold pegleg (5.0 @ +70): 500μ * 8.5% = 42.5
Value of stat gain: 483.44μ
WHAM: Attack option chosen: skill 3005 (round 1, profit: 6.12)
WHAM: Running SmartStasis
Profit per round: ActionProfitDamageOtherbase; Rogue Program (0μ)39.14μ8.42 (0 μ/dmg)46.5% stun chance MP: 8.42
Building custom WHAM actions...
Custom WHAM actions built! (0 actions)
Building custom actions...
Custom actions built! (0 actions)
use 829 is not OK since it is marked as a custom action.
WHAM: Stasis option chosen: skill 4014 (round 1, profit: 15.42)
booty chest charrrm (10.0 @ +70): 110μ * 17% = 18.7
solid gold pegleg (5.0 @ +70): 500μ * 8.5% = 42.5
Value of stat gain: 483.44μ
WHAM: Attack option chosen: skill 3005 (round 1, profit: 6.12)
This monster is not your huckleberry.
Stasis loop complete.
WHAM: SmartStasis complete.
WHAM: Running SmartStasis took 0.32 seconds.
WHAM: SS did not finish the fight, continuing with script execution. 
WHAM: We currently think that the round number is: 1 and that the turn number is 691.
WHAM: Starting evaluation and performing of attack
WHAM: We currently think that the round number is: 1 and that the turn number is 691.
booty chest charrrm (10.0 @ +70): 110μ * 17% = 18.7
solid gold pegleg (5.0 @ +70): 500μ * 8.5% = 42.5
Value of stat gain: 483.44μ
WHAM: Attack option chosen: skill 3005 (round 1, profit: 6.12)
WHAM: Stun option chosen: skill 3004 (round 1, profit: 25.19)
Monster HP is 172 according to Mafia and 177.0 according to BatBrain.
WHAM: We can't Saucesplash.
true, false, false, false, false
WHAM: We estimate the round number to currently be 1 (loop variable 0)
Queued: skill 3004
Building options...
Options built! (69 actions)
Monster HP is 172 according to Mafia and 168.585 according to BatBrain (loop variable i = 1).
Queued: skill 3005
Building options...
Options built! (69 actions)
booty chest charrrm (10.0 @ +70): 110μ * 17% = 18.7
solid gold pegleg (5.0 @ +70): 500μ * 8.5% = 42.5
Value of stat gain: 483.44μ
WHAM: Attack option chosen: skill 3005 (round 3, profit: 11.23)
WHAM: We estimate the round number to currently be 3 (loop variable 2)
Monster HP is 172 according to Mafia and 82.83000000000001 according to BatBrain (loop variable i = 2).
Queued: skill 3005
Building options...
Options built! (69 actions)
Parsed round number: 1
Building options...
Options built! (69 actions)
WHAM: Evaluating the attack but not performing it took 0.43 seconds.
WHAM: Enqueuing a stun to help with the battle
Queued: skill 3004
Building options...
Options built! (69 actions)
WHAM: We can't Saucesplash.
true, false, false, false, false
WHAM: Enqueueing Cannelloni Cannon (macroid skill 3005). Estimated damage: 77.34.
Queued: skill 3005
Building options...
Options built! (69 actions)
WHAM: Successfully enqueued Cannelloni Cannon.
WHAM: We can't Saucesplash.
true, false, false, false, true
WHAM: Enqueueing Cannelloni Cannon (macroid skill 3005). Estimated damage: 77.34.
Queued: skill 3005
Building options...
Options built! (69 actions)
WHAM: Successfully enqueued Cannelloni Cannon.
WHAM: We are going to 3-shot with Entangling Noodles, Cannelloni Cannon and Cannelloni Cannon.
Constructed macro: scrollwhendone; sub batround; if pastround 29; abort "Stopping fight because it has gone on for too long (set WHAM_maxround to a higher value if you think this was in error)"; endif; endsub; skill 3004; call batround; skill 3005; call batround; skill 3005; call batround; 
Round 1: chef_rannos executes a macro!
Round 1: chef_rannos casts ENTANGLING NOODLES!
Round 2: MP-Gamer drives a square around him, trapping him in a glowing orange box. That's a good deal, that orange box!
Round 2: chef_rannos casts CANNELLONI CANNON!
Round 3: wealthy pirate takes 72 damage.
Round 3: MP-Gamer drives a square around him, trapping him in a glowing orange box. That's a good deal, that orange box!
Round 3: chef_rannos casts CANNELLONI CANNON!
Round 4: wealthy pirate takes 82 damage.
Happened: skill 3004
Happened: skill 3005
Happened: skill 3005
Parsed round number: 4
Building options...
Options built! (68 actions)
WHAM: Evaluating the attack and performing it took 1.64 seconds.
WHAM: Current monster HP is calculated to 23.0
WHAM: We currently think that the round number is: 4 and that the turn number is 691.
WHAM: We currently think that the round number is: 4 and that the turn number is 691.
WHAM: Starting evaluation and performing of attack
WHAM: We currently think that the round number is: 4 and that the turn number is 691.
WHAM: Attack option chosen: jiggle (round 4, profit: 39.14)
use 2947 is not OK since it is marked as a custom action.
use 829 is not OK since it is marked as a custom action.
skill 15 is not OK since it is marked as a custom action.
skill 19 is not OK since it is marked as a custom action.
WHAM: No profitable stun option
Monster HP is 18 according to Mafia and 23.0 according to BatBrain.
WHAM: We can't Saucesplash.
true, false, false, false, true
WHAM: We estimate the round number to currently be 4 (loop variable 0)
Monster HP is 18 according to Mafia and 23.0 according to BatBrain (loop variable i = 0).
Queued: jiggle
Building options...
Options built! (67 actions)
booty chest charrrm (10.0 @ +70): 110μ * 17% = 18.7
solid gold pegleg (5.0 @ +70): 500μ * 8.5% = 42.5
Value of stat gain: 483.44μ
WHAM: Attack option chosen: use 2678 (round 5, profit: 32.95)
WHAM: We estimate the round number to currently be 5 (loop variable 1)
Monster HP is 18 according to Mafia and 7.085000000000001 according to BatBrain (loop variable i = 1).
Queued: use 2678
Building options...
Options built! (67 actions)
Happened: skill 3004
Happened: skill 3005
Happened: skill 3005
Parsed round number: 4
Building options...
Options built! (68 actions)
WHAM: Evaluating the attack but not performing it took 0.30 seconds.
WHAM: We can't Saucesplash.
true, false, false, false, true
WHAM: Enqueueing jiggle your chefstaff (macroid jiggle). Estimated damage: 7.5.
Queued: jiggle
Building options...
Options built! (67 actions)
WHAM: Successfully enqueued jiggle your chefstaff.
WHAM: We can't Saucesplash.
true, false, false, false, true
WHAM: Enqueueing spectre scepter (macroid use 2678). Estimated damage: 4.25.
Queued: use 2678
Building options...
Options built! (67 actions)
WHAM: Successfully enqueued spectre scepter.
WHAM: We are going to 2-shot with jiggle your chefstaff and spectre scepter.
Constructed macro: scrollwhendone; sub batround; if pastround 29; abort "Stopping fight because it has gone on for too long (set WHAM_maxround to a higher value if you think this was in error)"; endif; endsub; jiggle; call batround; use 2678; call batround; 
Round 4: chef_rannos executes a macro!
Round 4: chef_rannos jiggles the Staff of the November Jack-O-Lantern
Round 5: You jiggle your staff, stirring up the rotting guts of the drooping pumpkin. Bowled over by the stench and the sadness, he suffers 8 damage and pauses to regain his composure.
Round 5: wealthy pirate takes 8 damage.
Round 5: chef_rannos uses the spectre scepter!
Round 6: wealthy pirate takes 10 damage.
Round 6: chef_rannos wins the fight!
You gain 3 hit points
You gain 3 Mojo Points
You gain 298 Meat
You gain 13 Beefiness
You gain 10 Mysteriousness
You gain 26 Chutzpah
Happened: jiggle
Happened: use 2678
Parsed round number: 0
WHAM: Evaluating the attack and performing it took 2.73 seconds.


EDIT: It tried to steal dance cards and stone wool, and that was basically it for me today. In the Hidden City, Poop Deck and Belowdecks it did not attempt a pick pocket. None of those items are really essential, but hey, shinies. :D
 
Last edited:
@Darzil: I would love it if you could tell me how to fix the formulas for TS/LTS. As I mentioned before, BatBrain follows the formulas given on the Wiki, which I re-examined after you mentioned that before. How are those formulas wrong?

In BatBrain, you have the equation :
res[$element[none]] = max(0,max(0,floor((ranged ? my_stat("Moxie") : my_stat("Muscle"))*ltsadj*radj) - monster_stat("def")) +
max(1,numeric_modifier("Weapon Damage") + 0.5) * (critchance()+1.0) * ts +
to_int(ranged)*numeric_modifier("Ranged Damage")) * (100 + numeric_modifier("Weapon Damage Percent") +
to_int(ranged)*numeric_modifier("Ranged Damage Percent"))/100;

The section of that max(1,numeric_modifier("Weapon Damage") + 0.5) * (critchance()+1.0) * ts appears to multiply bonus weapon damage by the thrust smack bonus, but the wiki equation doesn't, it has that bonus only apply to base weapon damage. The wiki equation appears to equal what happens in game, as unless Muscle is high compared to target, empty hand thrust smack and lunging thrust smack does the same damage as base attack. Crit chance is also included here, and not on the wiki. Again, in game, unless Muscle is high compared to target crits do no extra damage either. I think you just need to lose "* (critchance()+1.0) * ts". It'll be overvaluing the damage generally, but is most obvious in unarmed combat where Weapon Damage bonus is often high, but base Weapon Damage is zero.
 
Thanks Darzil. And you are quite right -- the use of the Weapon Damage modifier is wrong. I think I must have tested this with a weapon equipped and no bonus weapon damage, since numeric_modifier("Weapon Damage") includes 15% of your weapon power along with your bonus weapon damage. We need to separate those. Does the following change solve the issue?

PHP:
   res[$element[none]] = max(0,max(0,floor((ranged ? my_stat("Moxie") : my_stat("Muscle"))*ltsadj*radj) - monster_stat("def")) +
      max(1,get_power(equipped_item($slot[weapon]))*0.15 + 0.5) * (critchance()+1.0) * ts + 
      numeric_modifier("Weapon Damage") - get_power(equipped_item($slot[weapon]))*0.15 + 
      to_int(ranged)*numeric_modifier("Ranged Damage")) * (100 + numeric_modifier("Weapon Damage Percent") +
      to_int(ranged)*numeric_modifier("Ranged Damage Percent"))/100;

The crit chance is included on the Wiki, where it says "Crit Multiplier". It's 1 for a regular hit and 2 for a critical hit (leaving aside Legendary Luck for the nonce), and since BatBrain averages that, it sets it to 1.X, where X is your chance of critical hits. Likewise the "ts" bit is included on the Wiki, as the "Attack-type Weapon Damage Multiplier". I feel that omitting those would probably break something.
 
Observation suggests the max should include up to the *ts bit, as a crit or ts <>0 doesn't increase unarmed damage (unless you outmuscle monster, by an amount that varies according to ts value), but that isn't what the wiki says.

I suspect that :
+ [(Weapon Damage) or 1 if barehanded or with a 0-power weapon ] × Crit Multiplier × Attack-type Weapon Damage Multiplier
should be :
+ [(Weapon Damage) ] × Crit Multiplier × Attack-type Weapon Damage Multiplier or 1 if barehanded or with a 0-power weapon

But would need testing to see if that's true with 0-power weapon as well as barehanded.

Did the crit chance and ts bits not get added onto base weapon damage elsewhere, as it looked like this function only covered bonus damage? Or was this not previously being applied, leaving base damage under represented and bonus damage under represented ?
 
Base weapon damage is included in numeric_modifier("Weapon Damage"). If you equip a weapon and then "modtrace weapon damage" you'll see that 15% of your weapon power is included along with any bonus weapon damage. That's why I subtracted it back out when adding the bonus weapon damage in the "fixed" version above. The function currently in BatBrain is multiplying base weapon damage and bonus weapon damage by crit and ts, which appears to be wrong.

To remove crit and ts entirely for unarmed characters, I'm thinking this will do the trick:

PHP:
   res[$element[none]] = max(0,max(0,floor((ranged ? my_stat("Moxie") : my_stat("Muscle"))*ltsadj*radj) - monster_stat("def")) +
      (unarmed() ? 1 : max(1,get_power(equipped_item($slot[weapon]))*0.15 + 0.5) * (critchance()+1.0) * ts) + 
      numeric_modifier("Weapon Damage") - get_power(equipped_item($slot[weapon]))*0.15 + 
      to_int(ranged)*numeric_modifier("Ranged Damage")) * (100 + numeric_modifier("Weapon Damage Percent") +
      to_int(ranged)*numeric_modifier("Ranged Damage Percent"))/100;

With your approval, I'll spin a BatBrain update including that.
 
Back
Top