Combat in old PennMu code

I’m knee deep in this old code (I’m old and dyslexic, having a hard time updating to Ares).

Have a curious question from the combat log, the Stop Chance number. I’ve found the functions and all, but its breaking my brain as the registers are all numbers. When i get to the fun_stop_chance, do you possibly recall what numbers are being pulled along for the math. I’m getting a div by zero error, I’m sure its how I set up gear stats but don’t know what field I may have botched.

You can find the commented version of the code on my github.

I’m not sure what registers you’re referring to since FUN_STOP_CHANCE doesn’t actually use registers. It’s a beastly computation involving only the protection value of the armor and the penetration value of the weapon. I’m guessing either one of those values is zero.

@@ --------------------------
@@ FUN_STOP_CHANCE
@@ Determines the chance of armor stopping a weapon.  Complex formula
@@ determined through great pain.
@@ %0 = penetration
@@ %1 = protection
@@ --------------------------

Perfect, I’m saving that page, was looking at the wrong docs and not the combat instance doc.

Its the %0 - penetration. Substitution and semantics? I just know Mike and Penn folks would call it a register as the data comes from someplace outside the function?

It all makes sense now, if something has 0 penetration, its very highly unlikely to penetrate armor. It needs a value over 0, otherwise the stop chance goes to 100. Thanks for pointing out the instance document. The answer was right there.

Just a terminology clash. I only ever used ‘register’ to describe the registers accessed via setq and setr but you’re correct – the argument substitutions of %0, %1, etc. are technically registers as well.

Penetration value is allowed to be 0 - a club, for instance, has no penetration. But protection values cannot be 0. If there’s no protection, it probably shouldn’t really be classified as “armor” was the thinking :slight_smile: Protection 0 will cause your divide by zero error.

Thanks for the assistance, not to distract from work with Ares and updates there. All is working :slight_smile:

1 Like