ID:179601
 
Don't worry, I'm not asking for a battle system. I was having a hard time deciding on how to calculate how much damage is done from an attack.

Basically, I want everyone to be able to have a chance to hit and damage anyone else no matter how far appart their skills are. Here's the system I thought up:

There are four basic factors in dealing damage: defense, attack, Maximum Damage, and armor.

Maximum Damage = strength + the weapons power for a melee weapon or Aim + the weapons power for ranged weapons

Attack = Aim + Strength (hitting in the right spot can be just as important as hitting hard)

Defense = Dodge + Constitution

Armor = % of damage the armor absorbs

Here's the calculation for damage:

Damage = Attack/(Attack + Defense) * Maximum Damage

If the attacker's attack is the same as the defenders defense then 50% of Maximum Damage would be done.

Lastly, armor is included.

Final Damage = Damage * (100 - Armor)



I was also gonna have the armor have HP and a tolerance level. If the damage it takes goes over it's tolerance level then it starts losing HP. This basically means enchanted plate mail won't get damaged by a dagger. (It could still slip through and deal damage to the player or simply cause concussion damage from the force of the blow)

If you see any problems with this or you think it could be balanced better I'm open to all suggestions.
I use a list called Strength.
Strength["Mental"]
Strength["Physical"]

Both determine wellness and capability in battle. As for weapons, armour, and magic, it all depends on what they are intended to do. A spell to decrease speed will do just that, regardless of armour. However, for a spell like that, you could factor in Strength["Mental"]. See what you can come up with!
This sounds alot like what Dan did with Night Soil (GoldenStool is a graphical version, but needs updating). Check it out. I think it's under Libs or Demos.

It uses a sigmoidal hit probability so that there is always a chance to hit or miss.

-James
English wrote:
Here's the calculation for damage:

Damage = Attack/(Attack + Defense) * Maximum Damage

If the attacker's attack is the same as the defenders defense then 50% of Maximum Damage would be done.

Lastly, armor is included.

Final Damage = Damage * (100 - Armor)

I was also gonna have the armor have HP and a tolerance level. If the damage it takes goes over it's tolerance level then it starts losing HP. This basically means enchanted plate mail won't get damaged by a dagger. (It could still slip through and deal damage to the player or simply cause concussion damage from the force of the blow)

If you see any problems with this or you think it could be balanced better I'm open to all suggestions.

I think you've gotten a very good start to a very hard problem. Your tolerance level idea is also very good. The only thing that really seems to be missing is a sense of randomness to the attacks.

What you probably want to do is set up a hit chance (with appropriate dodge/miss messages for failed hits) and then calculate hit damage separately. A hit chance along the lines of the Attack/(Attack+Damage) formula you used is a very good choice to start with, only maybe a better choice would be Aim/(Aim+Dodge). Hit chance is a little weird to figure out because there are two ways of not hitting: A simple miss, or a successful dodge; one implies failure of the attacker, the other the skill of the defender, and there are degrees in between.

Actually, I rather favor this idea:
var/rAim=rand(1,Aim)
var/rDodge=rand(1,Dodge)
// HitChance=rAim/(rAim+rDodge)
if(rand(1,rAim+rDodge) > rAim)
// a hit
else if((Aim-rAim)/Aim > rDodge/Dodge)
// if attacker ineptitude > defender skill
// a miss
else
// a dodge

The difference between missing and dodging may be more than mere messages; it might affect the ability of a player to launch their next blow. Of course you have nothing in your battle system for that anyway, but it's worth mentioning regardless.

The calculations of rAim and rDodge are probably a little simplistic. My preferred choice would be rAim=round(sqrt(rand(1,Aim*Aim)),1) and the same for rDodge. This would mean basically that the attacker and defender usually aim or dodge fairly well (within their skill), but sometimes do really poorly. You could also use rAim and rDodge in your damage calculation.

Lummox JR
In response to Lummox JR
Well, it had an error when I tried to post and I lost it so here's the abridged version.

My plan for calculating hits and misses was like this:

if(prob(aim/(aim + dodge) * 100)
//Hit
else
//Miss

As for the damage thing, I agree that I do need to add in some randomness to that. This is kind of a melding of your suggestion and my first system

rAttack = rand(attack/2,attack)
rDefense = rand(defense/2, defense)

rAttack/(rDefense + rAttack) * Max Damage

That way there is more of a random element to it. I would start at 1 with the rand() but I don't want it to fluctuate quite that much.

There are so many possabilities it's a bit overwhelming at times :)