IF
  See(NearestEnemyOf(Myself))
  See(NearestMyGroupOfType)
  Global("prep","LOCALS",0)
THEN
  RESPONSE #100
    ReallyForceSpell(LastSeenBy(Myself),CLERIC_STRENGTH_OF_ONE)
    ReallyForceSpell(LastSeenBy(Myself),CLERIC_PROTECTION_FROM_EVIL_10_FOOT)
    Shout(100)
    SetGlobal("prep","LOCALS",1)
END

IF
  See(NearestEnemyOf(Myself))
  See(NearestMyGroupOfType)
  Global("prep","LOCALS",1)
THEN
  RESPONSE #100
    SetGlobal("prep","LOCALS",2)
    Shout(100)
    Continue()
END

IF
  Global("prep","LOCALS",2)
  HaveSpell(NPC_BLADE_BARRIER)
THEN
  RESPONSE #100
    Spell(Myself,NPC_BLADE_BARRIER)
    SetGlobal("prep","LOCALS",3)
    Continue()
END

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

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

IF
  See(NearestEnemyOf(Myself))
  See([EVILCUTOFF])
  HaveSpell(CLERIC_MASS_CURE)
  HPPercentLT(Myself,80)
  OR(3)
    HPPercentLT(LastSeenBy(Myself),80)
    HPPercentLT(SecondNearest([EVILCUTOFF]),80)
    HPPercentLT(ThirdNearest([EVILCUTOFF]),80)
THEN
  RESPONSE #100
    Spell(LastSeenBy(Myself),CLERIC_MASS_CURE)
END

IF
  See(NearestEnemyOf(Myself))
  HaveSpell(CLERIC_HOLD_PERSON)
  !StateCheck(LastSeenBy(Myself),STATE_HELPLESS)
THEN
  RESPONSE #100
    Shout(100)
    Spell(NearestEnemyOf(Myself),CLERIC_HOLD_PERSON)
END

IF
  See(NearestEnemyOf(Myself))
  See([EVILCUTOFF])
  HPPercentLT(LastSeenBy(Myself),60)
  HaveSpell(CLERIC_CURE_SERIOUS_WOUNDS)
THEN
  RESPONSE #100
    Spell(LastSeenBy(Myself),CLERIC_CURE_SERIOUS_WOUNDS)
END

IF
  See(NearestEnemyOf(Myself))
  See([EVILCUTOFF])
  HPPercentLT(LastSeenBy(Myself),10)
  HaveSpell(CLERIC_HEAL)
THEN
  RESPONSE #100
    Spell(LastSeenBy(Myself),CLERIC_HEAL)
END

IF
  See(NearestEnemyOf(Myself))
  !Range(LastSeenBy(Myself),4)
  HPPercentLT(Myself,60)
  HaveSpell(CLERIC_CURE_SERIOUS_WOUNDS)
THEN
  RESPONSE #100
    Spell(Myself,CLERIC_CURE_SERIOUS_WOUNDS)
END

IF
  See(NearestEnemyOf(Myself))
  !Range(LastSeenBy(Myself),4)
  HPPercentLT(Myself,10)
  HaveSpell(CLERIC_HEAL)
THEN
  RESPONSE #100
    Spell(Myself,CLERIC_HEAL)
END
