ID:151428
 
Hiya guys, I just wanted to hear you all's opinions on how damage should be calculated, and basically to draw some suggestions to me. My combat system is very simple, there is a Strength and a Defense stat, and the damage is the current strength of the attacker - the defense of the defendor, then divided by 2. Every time damage is inflicted, the attacker receives half the damage in strength exp, and the defender receives half the damage in defense exp.

When the exp for one of the skills reaches (skill level * 50) they gain a level in it. Like Runescape, you know. I'm having a hard time figuring out if my monsters are too strong or too weak, though, so I was wondering what would be an ideal damage calculator.

One of my monsters is the Deer. It has 3 health and maxhealth (A bit low, but they're gotta have to be killable from the very beginning, with a bit of luck) and 2 strength and defense. Compared to Spiders and Rats which inflicts 0 damage, this one can kill a new player fairly quickly (New players start with 10 health and 1 in each skill). So any suggestions to improving my NPC stats/damage calculation? I'll post the attack code I use below, along with the NPC monsters.

mob
verb
Attack()
set category = "Combat"
if(usr.Attacking == 0)//if the person is not attacking
for(var/mob/M in get_step(src,usr.dir)) //this is hardest part of the code lol, basically, if their is a mob in the persons next step and in the persons direction
var/damage = usr.curstrength - M.curdefense / rand(1,10)//varible damage equal to the value of 10
var/misschance = rand(1,5)
if(misschance == 1)
damage = 0
usr << "You completely miss your opponent!"
return
if(damage <= 0)
damage = 0
M.health -= damage//the person infront of you looses the variable damage(10)
usr.comexp=damage/2
M.defcomexp=damage/2
spawn() usr.strcheck()
spawn() M.defcheck()
view(6) <<" [M] got hit by [src] for [damage] damage!"//outputs to the world what happend
usr.Attacking = 1//the persons attacking variable goes to 1, disabling it from attacking again
spawn(7)//waits 7 milliseconds in the background
usr.Attacking = 0//allows the person to attack again
spawn() M.DeathCheck()


Credit to whoever made it. I added a "misschance" var to make it possible to miss with your attacks (The opponents are 100% accurate though, I'll find a way to fix it), and I'm thinking of adding an Accuracu skill of some sort. The monsters for now...

mob
monster
Rat
icon = 'rat.dmi'
npc = 1
enemy = 1
health = 1
mhealth = 1
curstrength = 0
curdefense = 0
Spider
icon = 'Monsters.dmi'
npc = 1
enemy = 1
health = 1
mhealth = 1
curstrength = 0
curdefense = 0
Deer
icon = 'deer.dmi'
npc = 1
enemy = 1
health = 3
mhealth = 3
curstrength = 2
curdefense = 2
Boar
icon = 'boar.dmi'
npc = 1
enemy = 1
health = 5
mhealth = 5
curstrength = 5
curdefense = 5


Note that Boars are nearly unbeatable at the first levels without proper equipment, which seems kind-of wrong since it's stats aren't all that high. Or what are your opinions?
I must only point out that the random amount you're taking off isn't based on any player stats. That isn't going to work well for a number of a reasons. Once the player gets to a high enough level, 10 would be nothing to them and would seem strange to have such a tiny amount shaved off all the time. The next would be that it's punishing players for no reason and I don't think they'd be happy about it.

Just my thoughts.
In response to Kyle_ZX
I believe I have made a bug in that coding...Somehow. The calculation should mean that after usr.curstrength - M.curdefense is calculated, it would be divided by 1 to 10, meaning that the min damage would be the damage divided by 10 and the highest wouldnt be divided at all.

That's what it's supposed to be <:| I noticed too that it rarely ever goes out of the tenth of the original damage.

I suck at explaining, man.
Just a minor thing, but DeathCheck() should be moved up to a few lines because currently the enemy dies after the person can attack again, which seems like a useless delay.
In response to Hypnautilus
Whoa, I didn't even notice. I changed it for the next version.