ID:160595
 
Im trying to create a more in depth damage system that depends on several variables. The players have several variables these being the ones that effect damage (Strength, Defense, Intellect, and Agility). But I want the attacks to get stronger as they level up. So Ive found that I cant get it with the right math to make an even system to prevent 1 hit kills or take forever to kill someone. Im looking to make it around 10-15 direct hits to kill something of the same level. this is my current code for Health and the damage
src.MaxHealth=100+(50*src.Level)+(src.True_Stamina*8)


D=F-src.Defense//F is either the intellect or strength depending on type of attack
var/damage=((D+2)*(M.Level+rand(1,5)))
if(damage<0)
damage=0
src.Health-=damage
Personally, I like the formula (attack-defense)+attack_damage. It's simple, yet effective. If that still does too much damage, you can offset it by using (attack-defense)/offset+attack_damage. Remember to round it, though! If you use this formula, remember that the total damage can end up being less than the attack damage.
In response to Jeff8500
And that it can also end up being negative (healing).
In response to Kaioken
He had if(damage<0) damage = 0 in there, so that wouldn't be the case :P
In response to Jeff8500
It's still a thing 'to remember', regardless. :P