;"Restore Other" skill

;The cost of blood the skill takes
BloodCost = 3

;The amount of HP the skill will heal
HealthGain = 7

;The effect graphic to use
Graphic = 1

If GetUserWisdom(#USERID) > 39
   BloodCost = 25
   HealthGain = 65
ElseIf GetUserWisdom(#USERID) > 29
   BloodCost = 20
   HealthGain = 50
ElseIf GetUserWisdom(#USERID) > 19
   BloodCost = 15
   HealthGain = 35
ElseIf GetUserWisdom(#USERID) > 9
   BloodCost = 10
   HealthGain = 20
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
If GetUserDirection(#USERID) = #DIR_UP
   UserID = GetUserAtXY(#MAPID,X,Y-1)
ElseIf GetUserDirection(#USERID) = #DIR_RIGHT
   UserID = GetUserAtXY(#MAPID,X+1,Y)
ElseIf GetUserDirection(#USERID) = #DIR_DOWN
   UserID = GetUserAtXY(#MAPID,X,Y+1)
ElseIf GetUserDirection(#USERID) = #DIR_LEFT
   UserID = GetUserAtXY(#MAPID,X-1,Y)
EndIf

If UserID = 0
   UserID = GetUserID(GetUserMessage(#USERID))
   If UserID > 0
      If IsOnline(UserID) = 0
		SendMessageToUser(#USERID,GetUserName(UserID)+" is not online.",#MSG_EMOTE)
          GoTo END
	  EndIf
	 If GetUserMap(UserID) <> #MAPID
		If GetUserAccess(#USERID) < 6
			SendMessageToUser(#USERID,GetUserName(UserID)+" is too far away to heal.",#MSG_EMOTE)
          	GoTo END
		EndIf
	 EndIf
   Else
      SendMessageToUser(#USERID,"There is no one close enough to restore.",#MSG_EMOTE)
      GoTo END
   EndIf
EndIf

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

Health = GetUserHP(UserID)
If Health < GetUserMaxHP(UserID)
	Health = Health + HealthGain
	If Health > GetUserMaxHP(UserID)
		Health = GetUserMaxHP(UserID)
	EndIf
	SetUserHP(UserID, Health)
EndIf

SendMessageToUser(UserID,"Your flesh regenerates.", #MSG_EMOTE)
CreateEffect(Graphic,350,0,#DIR_UP,GetUserMap(UserID),GetUserX(UserID),GetUserY(UserID),0,UserID,0)
SendMessageToUser(#USERID,"You restore the flesh of "+GetUserName(UserID)+".", #MSG_EMOTE)

Label END

Continue = 1
