Calculating the amount of damage based on level and bonus

Im trying to come up with a simple but effective way to apply damage based on the players level and bonus.
The bonus, which is the equipment.
And the level, which is the attack level out of 100.

Im also trying to achieve the same effect with ai, the damage at a random range and divided by the players defence bonus and level.

I thought id seen it all in my maths class but this one really hits you. I have seen some algorithms used in diablo and runescape ( Combat level | RuneScape Wiki | Fandom ) to calculate levels but i cant get my head around it, any mathematics that can help me out?

AI.js

var damageMax = 10;
var damageMin = 5;

Attack();
var damage = Random.Range(damageMin, damageMax);
bonus = GameObject.FindWithTag("Player").GetComponent("Stats").defence;

target.SendMessage("ApplyDamage", Mathf.Round(damage / (bonus / 2)), SendMessageOptions.DontRequireReceiver);

anyone?

Yeah I couldn’t really follow that formula, I’m not familiar with the game which probably helped make it more confusing since I didn’t understand what any of the stats/values/levels are constrained by.

Anyways, maybe you could use more reference from different games. From what you said it doesn’t seem like you need to have a huge confusing formula, and possibly a simpler more readable one would lend better to what you want to do. It would also probably make it easier to balance and tweak.

http://www.uesp.net/wiki/Oblivion:The_Complete_Damage_Formula

You can find plenty more links by googling damage formula