;"Judgement" attack scroll (Use once)

;The cost of blood the skill takes
BloodCost = 6

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

;The effect graphic to use
Graphic = 2

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

If GetUserWisdom(#USERID) > 39
   BloodCost = 40
   HealthLoss = 70
ElseIf GetUserWisdom(#USERID) > 29
   BloodCost = 28
   HealthLoss = 55
ElseIf GetUserWisdom(#USERID) > 19
   BloodCost = 20
   HealthLoss = 40
ElseIf GetUserWisdom(#USERID) > 9
   BloodCost = 14
   HealthLoss = 25
EndIf

X = 0
Y = 0
UserID = 0
MonsterID = 0
Damage = 0
Length = #MAPWIDTHHEIGHT 


SendMessageToUser(#USERID,"You used the Judgement scroll.", #MSG_EMOTE)

While X < 21
   Y = 0
   CreateEffect(Graphic,450,SpeedDelay,#DIR_DOWN,#MAPID,X,Y,0,#USERID,0)
   CreateEffect(Graphic,450,SpeedDelay,#DIR_DOWN,#MAPID,X,Y+4,0,#USERID,0)
   CreateEffect(Graphic,450,SpeedDelay,#DIR_DOWN,#MAPID,X,Y+8,0,#USERID,0)
   CreateEffect(Graphic,450,SpeedDelay,#DIR_DOWN,#MAPID,X,Y+12,0,#USERID,0)
   CreateEffect(Graphic,450,SpeedDelay,#DIR_DOWN,#MAPID,X,Y+16,0,#USERID,0)
   
   ;Y = 0
   
   i = 0
   While i < Length
      i = i + 1
      Y = Y + 1
      
      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
            If UserID <> #USERID
               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 peels back as holy wrath consume you!", #MSG_CRITICAL)
            EndIf
         Endif
      EndIf
   Wend
   X = X + 4
Wend

Label END

Continue = 1