If someone casts a spell, it inflicts damage upon them, too. I was wondering what I could replace/add in/make to fix this.
Here is the coding for a spell used:
//Player Versus Player//
proc/FireBolTP()
if (MP < 1+(fireboltlevel*2))
usr << "Not enough MP"
else // if you have enough MP
//find the closest enemy
var/list/J[1]
var/C = 1
var/mob/players/M
for(M as mob in oview(3))
if (istype(M,/mob/players))
J[C] = M
C++
J.len++
if(J[1]!=null) // if you found one
MP -= 1+(fireboltlevel*2) // decrement MP by cost
M = J[1] // reference to the enemy
missile(/obj/spells/firebolt,usr,M) // visuals
sleep(get_dist(usr,M)) // wait until the spell reaches the enemy
var/damage = round(((rand(2+(fireboltlevel*2),4+(fireboltlevel*3)))*((Intelligence/100)+1)),1) // calculate dmg
if(M) // exception catching, have to make sure that the enemy is still there
if (M.Fireres>0) // if it has resistance to fire
damage -= round(damage*(M.Fireres/100),1) // do less damage
M.HP -= damage // actually deal the damage
s_damage(M, damage, "red") // and show it
//usr << "You cast FireBolt for \blue[damage] damage"
checkdeadplayers(M) // checks to see if the enemy is dead
that might work