IF
    HPLT(Myself,1)
    Global("ClrDead","AR0700",0)
THEN
    RESPONSE #100
        SetGlobal("ClrDead","AR0700",1)
END

IF
    Detect([PC])
    !See(LastSeenBy(Myself))
    HaveSpell(CLERIC_TRUE_SIGHT)
THEN
    RESPONSE #100
        Spell(Myself,CLERIC_TRUE_SIGHT)
END

IF
    See(NearestEnemyOf(Myself))
    HaveSpell(CLERIC_FLAME_STRIKE)
THEN
    RESPONSE #100
        PlaySound("lhMIS12a")
        Spell(NearestEnemyOf(Myself),CLERIC_FLAME_STRIKE)
        Spell(NearestEnemyOf(Myself),CLERIC_UNHOLY_BLIGHT)
END

IF
    See(NearestEnemyOf(Myself))
    HaveSpell(CLERIC_DRAW_UPON_HOLY_MIGHT)
THEN
    RESPONSE #100
        PlaySound("lhMIS12b")
        Spell(Myself,CLERIC_DRAW_UPON_HOLY_MIGHT)
        ApplySpell(Myself,CLERIC_BLADE_BARRIER)
        ReallyForceSpell(NearestEnemyOf(Myself),CLERIC_SUMMON_INSECTS)
END

IF
    See(NearestEnemyOf(Myself))
    HaveSpell(CLERIC_CREEPING_DOOM)
    !Range(NearestEnemyOf(Myself),5)
THEN
    RESPONSE #100
        Spell(NearestEnemyOf(Myself),CLERIC_CREEPING_DOOM)
END

IF
    See(NearestEnemyOf(Myself))
    See(NearestMyGroupOfType)
    HaveSpell(CLERIC_MASS_CURE)
    HPPercentLT(Myself,80)
    OR(3)
        HPPercentLT(LastSeenBy(Myself),80)
        HPPercentLT(SecondNearestMyGroupOfType,80)
        HPPercentLT(ThirdNearestMyGroupOfType,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
        Spell(NearestEnemyOf(Myself),CLERIC_HOLD_PERSON)
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

IF
    See(NearestEnemyOf(Myself))
THEN
    RESPONSE #100
        EquipMostDamagingMelee()
        AttackOneRound(NearestEnemyOf(Myself))
END

IF
    !See([ANYONE])
THEN
    RESPONSE #100
        Spell(Myself,CLERIC_ANIMATE_DEAD)
END


