IF
  Die()
THEN
  RESPONSE #100
    ReallyForceSpellDead(Myself,VAMPIRE_GAS_FORM_CHANGE)
END

IF
  !GlobalTimerNotExpired("Cast","LOCALS")
  !GlobalTimerNotExpired("A1","LOCALS")
  Detect(Myself)
  See(Myself)
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  !GlobalTimerNotExpired("Cast","LOCALS")
  !GlobalTimerNotExpired("A1","LOCALS")
  !Allegiance(Myself,ENEMY)
  OR(3)
    !See(NearestEnemyOf(Myself))
    StateCheck(NearestEnemyOf(Myself),0x00000029)
    RandomNumGT(4,1)
  OR(3)
    !See(SecondNearestEnemyOf(Myself))
    StateCheck(SecondNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(5,2)
  OR(3)
    !See(ThirdNearestEnemyOf(Myself))
    StateCheck(ThirdNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(6,3)
  OR(3)
    !See(FourthNearestEnemyOf(Myself))
    StateCheck(FourthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(7,4)
  OR(3)
    !See(FifthNearestEnemyOf(Myself))
    StateCheck(FifthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(8,5)
  OR(3)
    !See(SixthNearestEnemyOf(Myself))
    StateCheck(SixthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(9,6)
  OR(3)
    !See(SeventhNearestEnemyOf(Myself))
    StateCheck(SeventhNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(10,7)
  OR(3)
    !See(EighthNearestEnemyOf(Myself))
    StateCheck(EighthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(11,8)
  OR(3)
    !See(NinthNearestEnemyOf(Myself))
    StateCheck(NinthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(12,9)
  OR(3)
    !See(TenthNearestEnemyOf(Myself))
    StateCheck(TenthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(13,11)
  See(NearestEnemyOf(Myself))
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  !GlobalTimerNotExpired("Cast","LOCALS")
  !GlobalTimerNotExpired("A1","LOCALS")
  Allegiance(Myself,ENEMY)
  OR(3)
    !See([PC])
    StateCheck([PC],0x00000029)
    RandomNumGT(10,4)
  OR(3)
    !See(SecondNearest([PC]))
    StateCheck(SecondNearest([PC]),0x00000029)
    RandomNumGT(11,5)
  OR(3)
    !See(ThirdNearest([PC]))
    StateCheck(ThirdNearest([PC]),0x00000029)
    RandomNumGT(12,6)
  OR(3)
    !See(FourthNearest([PC]))
    StateCheck(FourthNearest([PC]),0x00000029)
    RandomNumGT(13,7)
  OR(3)
    !See(FifthNearest([PC]))
    StateCheck(FifthNearest([PC]),0x00000029)
    RandomNumGT(14,8)
  OR(3)
    !See(SixthNearest([PC]))
    StateCheck(SixthNearest([PC]),0x00000029)
    RandomNumGT(15,9)
  OR(3)
    !See(NearestEnemyOf(Myself))
    StateCheck(NearestEnemyOf(Myself),0x00000029)
    RandomNumGT(4,1)
  OR(3)
    !See(SecondNearestEnemyOf(Myself))
    StateCheck(SecondNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(5,2)
  OR(3)
    !See(ThirdNearestEnemyOf(Myself))
    StateCheck(ThirdNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(6,3)
  OR(3)
    !See(FourthNearestEnemyOf(Myself))
    StateCheck(FourthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(7,4)
  OR(3)
    !See(FifthNearestEnemyOf(Myself))
    StateCheck(FifthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(8,5)
  OR(3)
    !See(SixthNearestEnemyOf(Myself))
    StateCheck(SixthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(9,6)
  OR(3)
    !See(SeventhNearestEnemyOf(Myself))
    StateCheck(SeventhNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(10,7)
  OR(3)
    !See(EighthNearestEnemyOf(Myself))
    StateCheck(EighthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(11,8)
  OR(3)
    !See(NinthNearestEnemyOf(Myself))
    StateCheck(NinthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(12,9)
  OR(3)
    !See(TenthNearestEnemyOf(Myself))
    StateCheck(TenthNearestEnemyOf(Myself),0x00000029)
    RandomNumGT(13,11)
  See(NearestEnemyOf(Myself))
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  !GlobalTimerNotExpired("Cast","LOCALS")
  !GlobalTimerNotExpired("A1","LOCALS")
  See(LastSeenBy(Myself))
  !Range(LastSeenBy(Myself),0)
  !StateCheck(LastSeenBy(Myself),0x00000029)
THEN
  RESPONSE #100
    SetGlobalTimer("Cast","LOCALS",6)
    SetGlobalTimer("A1","LOCALS",9)
    ForceSpell(LastSeenBy(Myself),BRAIN_PSIONIC_BLAST)
END
