mob/verb
kill(mob/M)
Fight(M)
mob/proc
Fight(mob/M)
if(enemy == M) return //we are already fighting this guy
else if(!enemy) spawn Swing() //start swinging
enemy = M
Swing()
usr = src //so AddLife gives credit where it is due
enemy.Fight(src) //make the enemy fight back
while(enemy)
enemy.AddLife(-roll(strength)) //do the damage
sleep(rand(30)) //wait for up to 3 seconds
AddLife(N)
life += N
if(life <= 0)
view() << "[usr] destroys [src]!"
Die()
else if(N < 0)
view() << "[usr] hits [src]."
else usr << "You feel stronger!"
Die()
//dump treasure and die
for(var/T in treasure)
new T(loc)
del src
This is a direct cut from Dan.mud. The Swing() proc has confused me since the day I started using it. (Trinity Star ;) Why is usr = src in there, and how is usr made different from src in this case, and furthermore, you can set usr? Essentially I need an explination of the dynamics here.
~Polatrite~