proc/Attack(mob/M)
var/damage = (usr.toughness/2)/ (M.protection/2)
var/accuracy = usr.precision
var/evasion = M.swiftness
if(accuracy < evasion)
if(accuracy < evasion/1.5)
//do a million inefficient accuracy checks
//add some alternate damage(plus rand(1,3) and minus rand(1,3)
This gets pretty bad with somebody of a toughness stat of 30 and one with a protection stat of 5-15. ANybody have any similar problems or have any tips?
Unless you were to use round() to round off either /2 value to a whole number, the /2 in both stats will cancel out, so it works out just to usr.toughness/M.protection.
Randomness would probably be helpful here, such as damage=rand(1,usr.toughness)/M.protection. However, that's only part of the solution.
As you say, the numbers are too big based on stats. Damage in battle, however, usually has more to do with the type of weapon involved, the momentum of the blow, the defender's vulnerability to them, the skill of the strike (factoring in defensive maneuvers), and any armor blocking it.
Weapon type is constant for the weapon, and won't change; a few of its factors in battle, like sharpness, could change, but otherwise it's set. The momentum of a blow has to do with the attacker's strength; a strike might be strong but go wild, whereas a carefully thought-out strike might be only a medium blow; only with luck and a good opening can an attacker acheive both a strong blow and a skilled one. (Projectiles are an obvious exception to this.) The defender's vulnerability is a stat of major importance--by which I mean their physical resistance to the weapon, not their ability to dodge; think of this like constitution. Armor will absorb most of the energy of a strike--unless penetrated. If the weapon type is one that can penetrate armor, its ability to do so will depend on the skill of the strike.
I'm going to make up a few formulas here, which probably aren't good but may be tweakable.
proc/sigma(x) return 2**x/(1+2**x)
var/luck=rand(1,100)/100
var/strikestrength = attacker.strength*(2-(1-attacker.recklessness)*(1-luck))/2
var/strikeskill = sigma( (1-attacker.recklessness)*attacker.skill*attacker.swiftness - (1+defender.feint-defender*recklessness)*defender.skill*defen der.swiftness )
I didn't touch armor calculations, in which you'd have to determine the piece of armor hit, the type of armor and whether the weapon involved would hurt it (or whether the armor could absorb the blow), if the weapon would pierce the armor, and so on.
The amount of damage without armor would be mostly dependent on the strength of the blow, but would be increased by a particularly skilled blow. The result would then be modified by the defender's constitution (again, physical vulnerability), and probably cut down considerably.
Lummox JR