;Necropolis trap

Dodge=Floor(GetUserAgilityTotal(#USERID) * 0.25)

Dodge=50-Dodge
If Dodge < 5
	Dodge = 5
EndIf

If Random(0,Dodge) = 0
	GoTo END
EndIf

CreateEffect(0,500,0,#DIR_RIGHT,GetUserMap(#USERID),GetUserX(#USERID),GetUserY(#USERID),0,0,0)

Damage=Random(5,20)
Damage=Damage-Floor(GetUserEnduranceTotal(#USERID) * 0.25)

If Damage < 5
	Damage=Random(3,7)
EndIf

HP = GetUserHP(#USERID)

If Damage > HP
	SendMessageToAll("* "+GetUserName(#USERID)+" has been killed by a trap!",#MSG_CRITICAL)
Else
	SendCombatMessage(#USERID,"You were hurt by a trap! ")
EndIf

DamageUser(#USERID,Damage)

Label END

Continue = 1