;"Burning Touch" skill

SendMessageToUser(#USERID,"Error: You don't have that skill!",#MSG_CRITICAL)
SetUserSkill(#USERID, 16, 0)
GoTo END

;The cost of blood the skill takes
BloodCost = 5

;The amount of damage the skill will do
HealthLoss = 8

;The effect graphic to use
Graphic = 0

If GetUserWisdom(#USERID) > 39
   BloodCost = 35
   HealthLoss = 85
ElseIf GetUserWisdom(#USERID) > 29
   BloodCost = 24
   HealthLoss = 65
ElseIf GetUserWisdom(#USERID) > 19
   BloodCost = 18
   HealthLoss = 45
ElseIf GetUserWisdom(#USERID) > 9
   BloodCost = 12
   HealthLoss = 25
EndIf

If GetUserMana(#USERID) < BloodCost
   SendMessageToUser(#USERID,"You do not have the required blood to use this skill!", #MSG_CRITICAL)
   GoTo END
EndIf

X = #XPOS
Y = #YPOS
UserID = 0
MonsterID = 0
If GetUserDirection(#USERID) = #DIR_UP
   UserID = GetUserAtXY(#MAPID,X,Y-1)
   MonsterID = GetMonsterAtXY(#MAPID, X, Y-1)
   CreateEffect(Graphic,350,0,#DIR_UP,#MAPID,X,Y-1,0,#USERID,0)
ElseIf GetUserDirection(#USERID) = #DIR_RIGHT
   UserID = GetUserAtXY(#MAPID,X+1,Y)
   MonsterID = GetMonsterAtXY(#MAPID, X+1, Y)
   CreateEffect(Graphic,350,0,#DIR_RIGHT,#MAPID,X+1,Y,0,#USERID,0)
ElseIf GetUserDirection(#USERID) = #DIR_DOWN
   UserID = GetUserAtXY(#MAPID,X,Y+1)
   MonsterID = GetMonsterAtXY(#MAPID, X, Y+1)
   CreateEffect(Graphic,350,0,#DIR_DOWN,#MAPID,X,Y+1,0,#USERID,0)
ElseIf GetUserDirection(#USERID) = #DIR_LEFT
   UserID = GetUserAtXY(#MAPID,X-1,Y)
   MonsterID = GetMonsterAtXY(#MAPID, X-1, Y)
   CreateEffect(Graphic,350,0,#DIR_LEFT,#MAPID,X-1,Y,0,#USERID,0)
EndIf

Blood = GetUserMana(#USERID)
Blood = Blood - BloodCost
SetUserMana(#USERID,Blood)

If MonsterID > -1
   DamageMonster(#MAPID, MonsterID,HealthLoss)

   SendMessageToUser(#USERID,"You burn the monster for "+HealthLoss+" points of damage.", #MSG_EMOTE)
EndIf

If UserID > 0
   If GetUserAccess(UserID) > 5
		GoTo END
	EndIf
	If GetMapType(#MAPID) = #MAPTYPE_FRIENDLY 
		GoTo END
	EndIf
	If GetMapType(#MAPID) = #MAPTYPE_NEUTRAL 
		UserGuild = GetUserGuild(#USERID)
		TargetGuild = GetUserGuild(UserID)
		
		If UserGuild = 0
			GoTo END
		EndIf
		If TargetGuild = 0
			GoTo END
		EndIf
		If TargetGuild = UserGuild
			GoTo END
		EndIf
	EndIf

	MagicDefense = GetUserWisdom(UserID)
   MagicDefense = MagicDefense / 5
   MagicDefense = Floor(MagicDefense)
   
   HealthLoss = HealthLoss - MagicDefense
   If HealthLoss < 5
      HealthLoss = 5
   EndIf
   
   If UserID > 0
      DamageUser(UserID,HealthLoss)
   EndIf

   SendMessageToUser(UserID,"Your flesh burns!", #MSG_CRITICAL)
   SendMessageToUser(#USERID,"You burn "+GetUserName(UserID)+" for "+HealthLoss+" points of damage.", #MSG_EMOTE)
EndIf

Label END

Continue = 1