;'Echo Blast' Skill script

BloodCost=0

Effect1=6
Effect2=3

Damage1=Floor(GetUserWisdom(#USERID)*1.25)
Damage2=Floor(Damage1*0.75)

If GetUserMana(#USERID) < BloodCost
	SendMessageToUser(#USERID,"You don't have enough blood for this skill.",#MSG_CRITICAL)
	GoTo END
EndIf

SendMessageToUser(#USERID,"You force a wave of echoes through the air.",#MSG_EMOTE)

PlusX=0
PlusY=0

If GetUserDirection(#USERID) = #DIR_UP
	PlusX=0
	PlusY=-1
ElseIf GetUserDirection(#USERID) = #DIR_DOWN
	PlusX=0
	PlusY=1
ElseIf GetUserDirection(#USERID) = #DIR_LEFT
	PlusX=-1
	PlusY=0
ElseIf GetUserDirection(#USERID) = #DIR_RIGHT
	PlusX=1
	PlusY=0
EndIf



;CreateEffect(Effect1,600,200,GetUserDirection(#USERID),#MAPID,#XPOS,#YPOS,0,#USERID,1)
CreateEffect(Effect1,600,200,GetUserDirection(#USERID),#MAPID,#XPOS+PlusX,#YPOS+PlusY,0,#USERID,0)
;CreateEffect(Graphic,600,200,GetUserDirection(UserID),#MAPID,#XPOS+XPlus,#YPOS+YPlus,0,UserID,0)
;CreateEffect 

;Disable Errors
;DisableError()

Loops = 7

i = 0
While i < Loops 
	i=i+1
	UserID = GetUserAtXY(#MAPID,#XPOS+PlusX*i,#YPOS+PlusY*i)
	MonsterID = GetMonsterAtXY(#MAPID,#XPOS+PlusX*i,#YPOS+PlusY*i)

	MonDmg = Damage1+Damage2-10
	UserDmg1 = Damage1 - Floor(GetUserWisdom(UserID)/2)
	UserDmg2 = Damage2 - Floor(GetUserWisdom(UserID)/2)
	
	If MonDmg < 10
		MonDmg = 10
	EndIf
	If UserDmg1 < 8
		UserDmg1 = 8
	EndIf
	If UserDmg2 < 5
		UserDmg2 = 5
	EndIf
	
	If MonsterID > -1
		DamageMonster(#MAPID, MonsterID, MonDmg)
	EndIf
	
	If UserID <> 0
		If GetMapType(#MAPID) = #MAPTYPE_FRIENDLY 
			GoTo SKIP
		EndIf
		If GetMapType(#MAPID) = #MAPTYPE_NEUTRAL
			If GetUserGuild(UserID) = 0
				GoTo SKIP
			ElseIf GetUserGuild(#USERID) = 0
				GoTo SKIP
			EndIf
		EndIf
		
		If UserID = #USERID
			GoTo SKIP
		ElseIf GetUserGuild(UserID) = GetUserGuild(#USERID)
			GoTo SKIP
		ElseIf GetUserAccess(UserID) > 5
			GoTo SKIP
		EndIf
		
		SendMessageToUser(UserID,"A echoing force rips through your body!",#MSG_CRITICAL)
		
		DamageUser(UserID,UserDmg1)
		Timer(241,3000,UserID,UserDmg2,0)
		
		Label SKIP
	EndIf
Wend

;Enable Errors
;EnableError()

Label END

Continue = 1