Page 1 of 8

MECHANICS: Combat skills formulas

Posted: Fri Dec 21, 2018 4:24 am
by stark
Vampa provided me a bit ago with the code for bash, stab, charge & kick and I've been working on extracting the relevant formulas from there so that we can all have equal footing in terms of understanding of game mechanics.

I've put my findings into an interactive playground where you can plug in stats and see what the resulting chances are.

https://writtenrealms.com/wot/playground/bash
https://writtenrealms.com/wot/playground/stab
https://writtenrealms.com/wot/playground/charge
https://writtenrealms.com/wot/playground/kick
https://writtenrealms.com/wot/playground/melee

Below is a text-only breakdown for each, with more information on things like damage where applicable.

Bash Chance

1) Start with a 30% probability
2) If the BMI difference between the characters is greater than 1 (where BMI is calculated as (naked weight + equipped weight) * 10 / height in inches ^ 2), add floor(bmi difference) * 10 to the probability. In practice, this means that BMI has no effect in player vs player combat, but does come into play vs certain mobs (ever wonder why the black ooze is unbashable by anything but a club?)
3) If the weapon is 10 lbs or heavier, add weight / 5 * ob / 3 + pb / 4 - db * 3 / 2 to the probability, up to 30% (where db is that of the victim)
3b) If the weapon is less than 10 lbs, add ob / 2 + pb / 4 - db * 3 / 2, up to 20%
4) If attacker is mounted, add 5%
5) Multiply probability by bash skill / 99
6) If the probability is less than 0, set it to 0
7) If wielding a club, add weapon skill / 10 to the probability
8) If probability is greater than 95, set to 95
9) If the victim is sleeping, double the probability

Stab Chance

1) start with a 55% probability
2) add 2x level difference to the probability (capped at level 30)
3) multiply probability by stab skill / 99
4) multiply probability by weapon_skill / 99
5) If encumbrance is over 50%, the probability is reduced by 10 * ((carrying + equipped) * 10 / (can carry + can equip) - 5)
6) If the victim has notice on, the probability is reduced by notice / 5
7) If the victim is sleeping, the probability gets doubled
8) If the attacker is not hidden, the probability is set to 0.
9) If the attacker has sneak on (whether or not the sneak was successful in hiding the attacker's entrance), the probability gets increased by the max of 0 or (sneak_skill - 1d101) / 10. This is where no-hide stabs come from. If a stabber doesn't prac sneak, they will never land a no-hide stab.

Stab Damage

1) roll weapon damage + 2d3
2) if weapon has level 1 or level 2 ward, add a 2d4 roll
3) select a random value between 10x and 15x the damage roll
4) damage gets multiplied by stab skill / 100
5) if the attacker is berserk, the damage is doubled, and if at that point damage is greater than 250, the damage gets multiplied by 3/4
6) If the victim is undead, divide damage by 3
7) If victim is sleeping, damage is tripled
8) If victim is either resting or sitting, damage is multiplied by 1.5

Charge Chance

1) start with a 55% probability
2) add 2x level difference to the probability (capped at level 30)
3) multiply probability by charge skill / 99
4) multiply probability by weapon_skill / 99
5) If the attacker is not flying, reduce the probability by 15 in forest rooms, 25 in hills and swamplands, and 75 in mountains
6) If the attacker is flying, half the probability
7) If encumbrance is over 50%, the probability is reduced by 10 * ((carrying + equipped) * 10 / (can carry + can equip) - 5)
8) If victim is sleeping, double the probability

Charge damage

1) roll weapon damage
2) if weapon has level 1 or level 2 ward, add a 2d4 roll
3) select a random value between 7x and 11x and the damage roll
4) damage gets multiplied by charge skill / 100
5) if the attacker is berserk, the damage is doubled
6) If the victim is undead, divide damage by 3
7) If victim is sleeping, damage is tripled
8) If victim is either resting or sitting, damage is multiplied by 1.5

Kick Chance

1) If kick chance is < 14, probability is 0
2) If kick chance >= 15, set probability to kick skill / 2 + ob / 3 - db / 2

Kick Damage / move loss

I can't give too much insight here without reading other functions in the code (that I don't have), hopefully in time I'll be able to update this. I can provide a couple insights though:
1) boots with more total durability take away more moves
2) damage is a function of your strength, where the roll is something like 1d(str/2) with some other modifiers that I'm not sure about.

Note on fear: bash, charge, stab & kick all share a 75% failure rate if the attacker is feared.

Note on integers truncation throughout the code, the probability is always an integer. This means that when some part of a formula yields non-integer value, that value is truncated to an integer before the probability is altered. This is why for example having 99 clubs gives a 9% bash bonus and not 10. 99/10 truncated is 9, even though in floating point arithmetic the value would be much closer to 10.

Note on levels difference: these cap at 30, So for the purposes of these formulas, the difference between 51 and 30 is 0.

Post here if you have questions, I will add this to the wiki once I've gathered a little feedback here, if applicable.

Aureus edit: Updated

Re: Combat skills formulas

Posted: Fri Dec 21, 2018 6:04 am
by Adael
I’m confused somewhat by the charge. It seems to give that, for same level players, you will _never_ land a charge in mountain zones (more specifically, a -25% chance to do so). But surely there must be evidence of such charges landing, in AoW or player memory?

Also, are you allowed to post the raw C/C++ code (I forget which the MUD is written in, or perhaps it’s a hybrid) somewhere? Would be curious to see it myself also.

Re: Combat skills formulas

Posted: Fri Dec 21, 2018 6:11 am
by stark
The only way that I can see that a charge in mountain terrains can land is 1) if the attacker is flying or 2) if the level difference is greater than 13, so theoretically a level 30 has a 1% chance to charge a level 17 in mountain terrain.

If someone has a log of a charge landing in mountains after 2005, please post. I'd love to see it and will start scratching my head a lot :)

With regards to the code, I'm not at liberty to do so, that's a Vampa request.

Re: Combat skills formulas

Posted: Fri Dec 21, 2018 9:21 am
by Adael
Your posted calculation of BMI=(total weight)*10/(total height in inches) doesn't seem to match with what is shown on your site.

ex: 5'8'' defender, 154 naked, 20 lbs worn, BMI=(174)*10/(68)=25.588. Website gives the BMI as 0.376 though.

EDIT: further question regarding that. Does the BMI difference count as a _signed_ difference. ie, if my BMI is 38 and my opponent's is 32, would the -6 difference take away from probability I land a bash against him?

EDIT_2: suppose I have 190 ob and an 18 lb weapon in abs, so no pb, and am trying to bash a 140 db dodger. Using "add weight / 5 + ob / 3 + pb / 4 - db * 3 / 2 to the probability", I get (ignoring whether weight is weapon weight or player weight) roughly, weight/5+63-210. I'd have to have a few hundred lbs of weight to make a difference to the probability, but your site suggests I somehow get a +18% from stats. Curious how that might be?

Re: Combat skills formulas

Posted: Fri Dec 21, 2018 9:48 am
by stark
Sorry it's over height squared, updated post above.

BMI is indeed a signed difference. -6 points would give you a 60% bash handicap. That's why it's impossible to land bashes on black oozes, which have a BMI of 18 according to Palameon. It gives such a penalty (-180%) that it doesn't matter how much ob / weapon weight you have, you'll miss. Unless you're wielding a club.

Edit: I found this post by Thuvia very helpful in understanding BMI math: http://wotmudarchives.org/forum/viewtop ... f=4&t=2348

Re: Combat skills formulas

Posted: Fri Dec 21, 2018 9:53 am
by Adael
In that case, BMI difference = opponent BMI - my BMI, correct?

Re: Combat skills formulas

Posted: Fri Dec 21, 2018 9:58 am
by stark
It's the other way around. BMI difference is your BMI - your opponent. If you have a BMI of 3 and your opponent has a BMI of 1, difference is 3 - 1 or 20% bash chance bonus. If your BMI is 1 and your opponent's is 3, the difference is -2 and you have a 20% malus.

Re: Combat skills formulas

Posted: Fri Dec 21, 2018 10:04 am
by Adael
Got it, easier to bash things less stocky than you (very loosely speaking).

Re: Combat skills formulas

Posted: Fri Dec 21, 2018 10:07 am
by stark
With regards to your second edit, there was another typo in the formula for bash in my post, it's weight / 5 TIMES ob / 3, rather than plus. Thank for spotting that :)

Re: Combat skills formulas

Posted: Fri Dec 21, 2018 10:08 am
by Adael
Ah, wonderful thanks! And is the weight for that, like with BMI, naked weight + worn weight (so NOT including inventory weight)?