IF
  See([PC])
  Global("duegskel","GLOBAL",0)
  Range([PC],20)
THEN
  RESPONSE #100
    StartDialogNoSet([PC])
END

IF
  Allegiance(Myself,NEUTRAL)
  AttackedBy([ANYONE],DEFAULT)
THEN
  RESPONSE #100
    Shout(99)
    Enemy()
END

IF
  Allegiance(Myself,NEUTRAL)
  Heard([ANYONE],99)
THEN
  RESPONSE #100
    Shout(99)
    Enemy()
END

IF
  HPPercentLT(Myself,35)
  HasItem("POTN08",Myself)
THEN
  RESPONSE #100
    UseItem("POTN08",Myself)
    Continue()
END

IF
  See(NearestEnemyOf(Myself))
  HaveSpell(WIZARD_MIRROR_IMAGE)
THEN
  RESPONSE #100
    Spell(Myself,WIZARD_MIRROR_IMAGE)
END

IF
  See(NearestEnemyOf(Myself))
  HaveSpell(WIZARD_FLAME_ARROW)
THEN
  RESPONSE #100
    Spell(NearestEnemyOf(Myself),WIZARD_FLAME_ARROW)
END

IF
  See(NearestEnemyOf(Myself))
  HaveSpell(WIZARD_AGANNAZAR_SCORCHER)
THEN
  RESPONSE #100
    Spell(SecondNearestEnemyOf(Myself),WIZARD_AGANNAZAR_SCORCHER)
END

IF
  See(NearestEnemyOf(Myself))
  HaveSpell(WIZARD_MAGIC_MISSILE)
THEN
  RESPONSE #100
    Spell(NearestEnemyOf(Myself),WIZARD_MAGIC_MISSILE)
END

IF
  HPPercentLT(Myself,10)
THEN
  RESPONSE #100
    EscapeArea()
END

IF
  See(NearestEnemyOf(Myself))
  Range(NearestEnemyOf(Myself),4)
THEN
  RESPONSE #100
    EquipMostDamagingMelee()
    AttackReevaluate(NearestEnemyOf(Myself),30)
END

IF
  See(NearestEnemyOf(Myself))
THEN
  RESPONSE #100
    EquipRanged()
    AttackReevaluate(NearestEnemyOf(Myself),30)
END

