IF
  See(Nearestenemyof(Myself))
  Global("TimerPrep","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal("TimerPrep","LOCALS",1)
    SetGlobalTimer("DrankPotionTimer","LOCALS",0)
    SetGlobalTimer("CalledForHealing","LOCALS",0)
    SetGlobalTimer("GaveAwayPotion","LOCALS",0)
    SetGlobalTimer("TrueSight_Used","LOCALS",0)
    SetGlobalTimer("SpecialDefenseUp","LOCALS",0)
    SetGlobalTimer("SpellDefense1_On","LOCALS",0)
    SetGlobalTimer("WeaponDefense_On","LOCALS",0)
    SetGlobalTimer("FireShield_On","LOCALS",0)
    SetGlobalTimer("Shield_On","LOCALS",0)
    SetGlobalTimer("TeleportField_On","LOCALS",0)
END

IF
  OR(5)
    See(Nearestenemyoftype([PC.0.0.BARD_ALL]))
    See(Nearestenemyoftype([PC.0.0.DRUID_ALL]))
    See(Nearestenemyoftype([PC.0.0.CLERIC_ALL]))
    See(Nearestenemyoftype([PC.0.0.LONG_BOW]))
    See(Nearestenemyoftype([PC.0.0.SORCERER]))
  Global("SpellTrigger1","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal("SpellTrigger1","LOCALS",1)
    IncrementGlobal("NumDefenses","LOCALS",3)
    SetGlobalTimer("SpecialDefenseUp","LOCALS",72)
    SetGlobalTimer("WeaponDefense_On","LOCALS",24)
    SetGlobalTimer("SpellDefense1_On","LOCALS",30)
    FaceObject(Lastseenby(Myself))
    DisplayString(Myself,39968)
    ReallyForceSpell(Myself,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)
    ReallyForceSpell(Myself,WIZARD_SPELL_DEFLECTION)
    ReallyForceSpell(Myself,WIZARD_MISLEAD)
END

IF
  See(Nearestenemyof(Myself))
  RandomNum(3,1)
  Global("SpellSequencer1","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal("SpellSequencer1","LOCALS",1)
    DisplayString(Myself,39969)
    ReallyForceSpell(Myself,WIZARD_HASTE)
    ReallyForceSpell(Myself,WIZARD_STONE_SKIN)
    ReallyForceSpell(Myself,WIZARD_SPIRIT_ARMOR)
END

IF
  See([PC])
  Allegiance(Myself,ENEMY)
  !StateCheck(Myself,STATE_INVISIBLE)
  !StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
  Global("Contingency1","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal("Contingency1","LOCALS",1)
    IncrementGlobal("NumDefenses","LOCALS",1)
    SetGlobalTimer("SpecialDefenseUp","LOCALS",54)
    FaceObject(Lastseenby(Myself))
    DisplayString(Myself,73139)
    ReallyForceSpell(Myself,WIZARD_SHADOW_DOOR)
END

IF
  See(Nearestenemyof(Myself))
  RandomNum(2,1)
  Global("MinorSequencer1","LOCALS",0)
  !StateCheck(Myself,STATE_MIRRORIMAGE)
  !StateCheck(Myself,STATE_BLUR)
THEN
  RESPONSE #100
    SetGlobal("MinorSequencer1","LOCALS",1)
    FaceObject(Lastseenby(Myself))
    DisplayString(Myself,8635)
    ReallyForceSpell(Myself,WIZARD_MIRROR_IMAGE)
    ReallyForceSpell(Myself,WIZARD_BLUR)
END

