;Blood Rage Skill

;GoTo END

Blood = GetUserMana(#USERID)

If Blood < 1
	SendMessageToUser(#USERID,"You are out of blood!",#MSG_CRITICAL)
	GoTo END
EndIf
SetUserMana(#USERID,0)
SendCombatMessage(#USERID,"You use Blood Rage! ")

CreateEffect(15,500,550,#DIR_RIGHT,#MAPID,#XPOS,#YPOS,0,0,0)
CreateEffect(15,500,550,#DIR_LEFT,#MAPID,#XPOS,#YPOS,0,0,0)
CreateEffect(15,500,550,#DIR_UP,#MAPID,#XPOS,#YPOS,0,0,0)
CreateEffect(15,500,550,#DIR_DOWN,#MAPID,#XPOS,#YPOS,0,0,0)


;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MonsterID = GetMonsterAtXY(#MAPID,#XPOS,#YPOS-1)
TargetID = GetUserAtXY(#MAPID,#XPOS,#YPOS-1)

If TargetID=#USERID
	TargetID = 0
EndIf
If GetMapType(#MAPID)=#MAPTYPE_FRIENDLY
	TargetID = 0
Endif
If GetMapType(#MAPID)=#MAPTYPE_PK
	If GetUserGuild(#USERID) <> 0
		If GetUserGuild(TargetID) = GetUserGuild(#USERID)
			TargetID = 0
		EndIf
	EndIf
Endif
If GetMapType(#MAPID)=#MAPTYPE_NEUTRAL
	If GetUserGuild(#USERID) = 0
		TargetID = 0
	ElseIf GetUserGuild(TargetID) = 0
		TargetID = 0
	ElseIf GetUserGuild(TargetID) = GetUserGuild(#USERID)
		TargetID = 0
	EndIf
EndIf

If MonsterID > -1
	UserDamageMonster(MonsterID,Blood,#USERID)
EndIf
If TargetID > 0
	UserDamageUser(#USERID,Blood,TargetID)
Endif
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MonsterID = GetMonsterAtXY(#MAPID,#XPOS+1,#YPOS)
TargetID = GetUserAtXY(#MAPID,#XPOS+1,#YPOS)

If TargetID=#USERID
	TargetID = 0
EndIf
If GetMapType(#MAPID)=#MAPTYPE_FRIENDLY
	TargetID = 0
Endif
If GetMapType(#MAPID)=#MAPTYPE_PK
	If GetUserGuild(#USERID) <> 0
		If GetUserGuild(TargetID) = GetUserGuild(#USERID)
			TargetID = 0
		EndIf
	EndIf
Endif
If GetMapType(#MAPID)=#MAPTYPE_NEUTRAL
	If GetUserGuild(#USERID) = 0
		TargetID = 0
	ElseIf GetUserGuild(TargetID) = 0
		TargetID = 0
	ElseIf GetUserGuild(TargetID) = GetUserGuild(#USERID)
		TargetID = 0
	EndIf
EndIf

If MonsterID > -1
	UserDamageMonster(MonsterID,Blood,#USERID)
EndIf
If TargetID > 0
	UserDamageUser(#USERID,Blood,TargetID)
Endif
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MonsterID = GetMonsterAtXY(#MAPID,#XPOS,#YPOS+1)
TargetID = GetUserAtXY(#MAPID,#XPOS,#YPOS+1)

If TargetID=#USERID
	TargetID = 0
EndIf
If GetMapType(#MAPID)=#MAPTYPE_FRIENDLY
	TargetID = 0
Endif
If GetMapType(#MAPID)=#MAPTYPE_PK
	If GetUserGuild(#USERID) <> 0
		If GetUserGuild(TargetID) = GetUserGuild(#USERID)
			TargetID = 0
		EndIf
	EndIf
Endif
If GetMapType(#MAPID)=#MAPTYPE_NEUTRAL
	If GetUserGuild(#USERID) = 0
		TargetID = 0
	ElseIf GetUserGuild(TargetID) = 0
		TargetID = 0
	ElseIf GetUserGuild(TargetID) = GetUserGuild(#USERID)
		TargetID = 0
	EndIf
EndIf

If MonsterID > -1
	UserDamageMonster(MonsterID,Blood,#USERID)
EndIf
If TargetID > 0
	UserDamageUser(#USERID,Blood,TargetID)
Endif
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MonsterID = GetMonsterAtXY(#MAPID,#XPOS-1,#YPOS)
TargetID = GetUserAtXY(#MAPID,#XPOS-1,#YPOS)

If TargetID=#USERID
	TargetID = 0
EndIf
If GetMapType(#MAPID)=#MAPTYPE_FRIENDLY
	TargetID = 0
Endif
If GetMapType(#MAPID)=#MAPTYPE_PK
	If GetUserGuild(#USERID) <> 0
		If GetUserGuild(TargetID) = GetUserGuild(#USERID)
			TargetID = 0
		EndIf
	EndIf
Endif
If GetMapType(#MAPID)=#MAPTYPE_NEUTRAL
	If GetUserGuild(#USERID) = 0
		TargetID = 0
	ElseIf GetUserGuild(TargetID) = 0
		TargetID = 0
	ElseIf GetUserGuild(TargetID) = GetUserGuild(#USERID)
		TargetID = 0
	EndIf
EndIf

If MonsterID > -1
	UserDamageMonster(MonsterID,Blood,#USERID)
EndIf
If TargetID > 0
	UserDamageUser(#USERID,Blood,TargetID)
Endif
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Label END

Continue = 1