IF
  See(NearestEnemyOf(Myself))
  HaveSpell(WIZARD_GHOST_ARMOR)
  CheckStatGT(Myself,2,ARMORCLASS)
  RandomNumLT(118,40)
THEN
  RESPONSE #100
    Spell(Myself,WIZARD_GHOST_ARMOR)
END

IF
  OR(3)
    See(NearestEnemyOf(Myself))
    See(SecondNearestEnemyOf(Myself))
    See(ThirdNearestEnemyOf(Myself))
  HaveSpell(WIZARD_LIGHTNING_BOLT)
  CheckStatLT(LastSeenBy(Myself),50,RESISTELECTRICITY)
  CheckStatLT(LastSeenBy(Myself),50,RESISTMAGIC)
  !HasBounceEffects(LastSeenBy(Myself))
  !Range(LastSeenBy(Myself),6)
  RandomNumLT(72,25)
THEN
  RESPONSE #100
    Spell(LastSeenBy(Myself),WIZARD_LIGHTNING_BOLT)
END

IF
  See(NearestEnemyOf(Myself))
  HaveSpell(WIZARD_AGANNAZAR_SCORCHER)
  CheckStatLT(LastSeenBy(Myself),50,RESISTMAGIC)
  CheckStatLT(LastSeenBy(Myself),50,RESISTMAGICFIRE)
  RandomNumLT(75,16)
THEN
  RESPONSE #100
    Spell(LastSeenBy(Myself),WIZARD_AGANNAZAR_SCORCHER)
END

IF
  See(NearestEnemyOf(Myself))
  HaveSpell(WIZARD_MELF_ACID_ARROW)
  CheckStatLT(LastSeenBy(Myself),50,RESISTMAGIC)
  RandomNumLT(76,16)
THEN
  RESPONSE #100
    Spell(LastSeenBy(Myself),WIZARD_MELF_ACID_ARROW)
END

IF
  OR(7)
    See(NearestEnemyOf(Myself))
    See(SecondNearestEnemyOf(Myself))
    See(ThirdNearestEnemyOf(Myself))
    See(FourthNearestEnemyOf(Myself))
    See(FifthNearestEnemyOf(Myself))
    See(SixthNearestEnemyOf(Myself))
    See(TenthNearestEnemyOf(Myself))
  HaveSpell(WIZARD_STINKING_CLOUD)
  !Range(LastSeenBy(Myself),10)
  !StateCheck(LastSeenBy(Myself),STATE_HELPLESS)
  !StateCheck(LastSeenBy(Myself),STATE_SLEEPING)
  RandomNumLT(143,32)
THEN
  RESPONSE #100
    Spell(LastSeenBy(Myself),WIZARD_STINKING_CLOUD)
END

IF
  OR(3)
    See(NearestEnemyOf(Myself))
    See(SecondNearestEnemyOf(Myself))
    See(ThirdNearestEnemyOf(Myself))
  HaveSpell(WIZARD_MAGIC_MISSILE)
  CheckStatLT(LastSeenBy(Myself),50,RESISTMAGIC)
  !HasBounceEffects(LastSeenBy(Myself))
  RandomNumLT(79,28)
THEN
  RESPONSE #100
    Spell(LastSeenBy(Myself),WIZARD_MAGIC_MISSILE)
END

IF
  See(NearestEnemyOf(Myself))
  !StateCheck(Myself,STATE_INVISIBLE)
THEN
  RESPONSE #100
    AttackReevaluate(NearestEnemyOf(Myself),15)
END

