ID:139517
 
Code:
mob
proc
battlerun()
sleep(1)
if(usr.hp<=0)
var/mob/Q=usr.oppo
Q<<"You win the duel!"
usr<<"You lose the duel."
usr.dueling=0
Q.dueling=0
var/obj/Z=locate(/obj/holder)in world
Q.wins+=1
Q.wincheck()
spawn(5)Q.loc=locate(63,39,2)
if(usr.arnum==1)
Z.arena1=0
usr.arnum=0
Q.arnum=0
if(usr.arnum==2)
Z.arena2=0
usr.arnum=0
Q.arnum=0
if(usr.arnum==3)
Z.arena3=0
usr.arnum=0
Q.arnum=0
if(usr.arnum==4)
Z.arena4=0
usr.arnum=0
Q.arnum=0
if(usr.arnum==5)
Z.arena5=0
usr.arnum=0
Q.arnum=0
usr.oppo=null
Q.oppo=null
usr.hp=usr.maxhp
Q.hp=Q.maxhp
if(usr.standing=="Good")
usr.good=1
usr.evil=0
if(usr.standing=="Evil")
usr.evil=1
usr.good=0
if(Q.standing=="Good")
Q.good=1
Q.evil=0
if(Q.standing=="Evil")
Q.evil=1
Q.good=0
else
usr.battlerun()

obj
battlerootentrance
invisibility=1
density=1
Block()
var/obj/Z=locate(/obj/holder)in world
if(Z.arena1==0)
var/mob/ZZ=input("Who do you want to challenge?")as mob in world
var/obj/L=input(ZZ,"[usr.charname] has challenged you to a duel in the Root of Battle. Do you accept?")in list("Accept","Decline")
if(L=="Accept")
Z.arena1=1
usr<<"[ZZ.charname] has accepted your challenge. You both walk into the arena..."
ZZ<<"You accept [usr.charname]'s challenge. You both walk into the arena..."
usr.sight|=BLIND
ZZ.sight|=BLIND
usr.arnum=1
ZZ.arnum=1
sleep(30)
usr.loc=locate(2,2,7)
ZZ.loc=locate(10,3,7)
usr.frozen=1
ZZ.frozen=1
usr.evil=1
ZZ.good=1
usr.sight&=~BLIND
ZZ.sight&=~BLIND
usr<<"3..."
ZZ<<"3..."
sleep(10)
usr<<"2..."
ZZ<<"2..."
sleep(10)
usr<<"1..."
ZZ<<"1..."
sleep(10)
usr<<"GO!"
ZZ<<"GO!"
usr.frozen=0
ZZ.frozen=0
usr.dueling=1
ZZ.dueling=1
usr.battlerun()
ZZ.battlerun()
usr.oppo=ZZ
ZZ.oppo=usr
sleep(600)
if(usr.oppo==ZZ)
usr<<"The match has ended in a draw."
ZZ<<"The match has ended in a draw."
if(usr.standing=="Good")
usr.good=1
usr.evil=0
if(usr.standing=="Evil")
usr.evil=1
usr.good=0
if(ZZ.standing=="Good")
ZZ.good=1
ZZ.evil=0
if(ZZ.standing=="Evil")
ZZ.evil=1
ZZ.good=0
if(usr.arnum==1)
Z.arena1=0
if(usr.arnum==2)
Z.arena2=0
if(usr.arnum==3)
Z.arena3=0
if(usr.arnum==4)
Z.arena4=0
if(usr.arnum==5)
Z.arena5=0
ZZ.loc=locate(63,39,2)
usr.loc=locate(63,39,2)
ZZ.oppo=null
usr.oppo=null
usr.dueling=0
ZZ.dueling=0
else
usr<<"They have declined your request."

mob
proc
die()
if(src.dueling==1)
src.loc=locate(63,39,2)
src.battlerun()
sleep(20)
src.hp=src.maxhp
else
if(src.hp<=0)
src<<"You were knocked out."
src.poisoned=0
src.loc=locate(71,31,2)
src.hp=src.maxhp
src.sight|=BLIND
src.frozen=1
sleep(50)
src<<"You wake up in the Root of Health."
src.sight&=~BLIND
src.frozen=0


Problem description: Basically, this is a code for PvP. But when someone beats the other player in a duel, the winner is stuck in the arena and no one officially wins. A draw doesn't even happen.

Can you explain step by step what exactly that code is doing?