;"Flame Burst" skill

;The cost of blood the skill takes
BloodCost = 6

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

;The effect graphic to use
Graphic = 0

;The length (in tiles) the burst of fire goes
Length = 4

;The speeddelay that is put on the graphic
SpeedDelay = 200

If GetUserWisdom(#USERID) > 39
   BloodCost = 40
   HealthLoss = 58
   Length = 6
   SpeedDelay = 125
ElseIf GetUserWisdom(#USERID) > 29
   BloodCost = 28
   HealthLoss = 45
ElseIf GetUserWisdom(#USERID) > 19
   BloodCost = 20
   HealthLoss = 30
   Length = 5
   SpeedDelay = 145
ElseIf GetUserWisdom(#USERID) > 9
   BloodCost = 14
   HealthLoss = 17
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
DeltaX = 0
DeltaY = 0
UserID = 0
MonsterID = 0
Damage = 0

If GetUserDirection(#USERID) = #DIR_UP
   DeltaY = -1
ElseIf GetUserDirection(#USERID) = #DIR_RIGHT
   DeltaX = +1
ElseIf GetUserDirection(#USERID) = #DIR_DOWN
   DeltaY = +1
ElseIf GetUserDirection(#USERID) = #DIR_LEFT
   DeltaX = -1
EndIf

CreateEffect(Graphic,350,SpeedDelay,GetUserDirection(#USERID),#MAPID,X+DeltaX,Y+DeltaY,0,#USERID,0)

i = 0
While i < Length
   i = i + 1
   X = X + DeltaX
   Y = Y + DeltaY
   
   Damage = HealthLoss
   
   UserID = GetUserAtXY(#MAPID, X, Y)
   MonsterID = GetMonsterAtXY(#MAPID,X,Y)
   
   If MonsterID <> -1
      DamageMonster(#MAPID,MonsterID,Damage)
   EndIf
   
   If GetMapType(#MAPID) <> #MAPTYPE_FRIENDLY 
      If UserID > 0
         HURT = 1
		If GetUserAccess(UserID) < 5
			HURT = 0
		EndIf
		If GetMapType(#MAPID) = #MAPTYPE_NEUTRAL 
			If GetUserGuild(#USERID) = 0
				HURT = 0
			EndIf
			If GetUserGuild(UserID) = 0
				HURT = 0
			EndIf
			If GetUserGuild(UserID) = GetUserGuild(#USERID)
				HURT = 0
			EndIf
		EndIf
		
		If HURT = 1
			MagicDefense = GetUserWisdom(UserID)
         		MagicDefense = MagicDefense / 5
         		MagicDefense = Floor(MagicDefense)
         		
         		Damage = Damage - MagicDefense
         		If Damage < 5
            		Damage = 5
         		EndIf
         
         		DamageUser(UserID,Damage)
      
         		SendMessageToUser(UserID,"Your flesh burns for "+Damage+" points of damage!", #MSG_CRITICAL)
     	EndIf 
	EndIf
   EndIf
Wend

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

SendMessageToUser(#USERID,"You send forth a burst of flame.", #MSG_EMOTE)

Label END

Continue = 1
