IF
  Die()
THEN
  RESPONSE #100
    Shout(66)
END

IF
  Global("BPCHARM","LOCALS",1)
  !StateCheck(Myself,STATE_CHARMED)
THEN
  RESPONSE #100
    SetGlobal("BPCHARM","LOCALS",0)
    ClearActions(Myself)
    Continue()
END

IF
  Name("SUELLE2",Myself)
  GlobalGT("TalkEllesime","GLOBAL",0)
THEN
  RESPONSE #100
    DestroySelf()
END

IF
  !Allegiance(Myself,ENEMY)
  AttackedBy([PC],DEFAULT)
THEN
  RESPONSE #100
    Shout(199)
    Enemy()
END

IF
  !Allegiance(Myself,ENEMY)
  Heard([0.0.ELF.0.SULDANESSALLAR],199)
THEN
  RESPONSE #100
    Shout(199)
    Enemy()
END

IF
  Allegiance(LastSummonerOf(Myself),ENEMY)
  !Allegiance(Myself,ENEMY)
THEN
  RESPONSE #100
    Enemy()
END

IF
  !Detect(NearestEnemyOf(Myself))
  !Allegiance(Myself,EVILCUTOFF)
THEN
  RESPONSE #100
END

IF
  Range(NearestEnemyOf(Myself),2)
  OR(2)
    CheckStatGT(NearestEnemyOf(Myself),0,121)
    CheckStatGT(NearestEnemyOf(Myself),0,125)
THEN
  RESPONSE #80
    RunAwayFrom(NearestEnemyOf(Myself),4)
  RESPONSE #20
    Continue()
END

IF
  Global("BPRC","LOCALS",0)
  Class(Myself,CLERIC_ALL)
THEN
  RESPONSE #100
    SetGlobal("BPRC","LOCALS",1)
END

IF
  Global("BPRC","LOCALS",0)
THEN
  RESPONSE #100
    ChangeClass(Myself,CLERIC)
    SetGlobal("BPRC","LOCALS",1)
END

IF
  HPPercentLT(Myself,35)
  HaveSpell(CLERIC_HEAL)
  !GlobalTimerNotExpired("BPT","LOCALS")
  Global("SNAFU","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(Myself,CLERIC_HEAL)
END

IF
  HasItem("potn55",Myself)  // ~Potion of Superior Healing~
  !GlobalTimerNotExpired("POT","LOCALS")
  HPPercentLT(Myself,60)
THEN
  RESPONSE #100
    DisplayStringHead(Myself,46150)  // ~quaffs a potion~
    SetGlobalTimer("POT","LOCALS",ONE_ROUND)
    UseItem("potn55",Myself)  // ~Potion of Superior Healing~
END

IF
  HasItem("potn52",Myself)  // ~Potion of Extra Healing~
  !GlobalTimerNotExpired("POT","LOCALS")
  HPPercentLT(Myself,70)
THEN
  RESPONSE #100
    DisplayStringHead(Myself,46150)  // ~quaffs a potion~
    SetGlobalTimer("POT","LOCALS",ONE_ROUND)
    UseItem("potn52",Myself)  // ~Potion of Extra Healing~
END

IF
  HPPercentLT(Myself,65)
  HaveSpell(CLERIC_CURE_SERIOUS_WOUNDS)
  !GlobalTimerNotExpired("BPT","LOCALS")
  Global("SNAFU","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(Myself,CLERIC_CURE_SERIOUS_WOUNDS)
END

IF
  HPPercentLT(Myself,70)
  HaveSpell(CLERIC_CURE_MEDIUM_WOUNDS)
  !GlobalTimerNotExpired("BPT","LOCALS")
  Global("SNAFU","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(Myself,CLERIC_CURE_MEDIUM_WOUNDS)
END

IF
  HasItem("POTN08",Myself)  // ~Potion of Healing~
  !GlobalTimerNotExpired("POT","LOCALS")
  HPPercentLT(Myself,85)
  RandomNumLT(80,21)
THEN
  RESPONSE #100
    SetGlobalTimer("POT","LOCALS",ONE_ROUND)
    UseItem("POTN08",Myself)  // ~Potion of Healing~
    DisplayStringHead(Myself,46150)  // ~quaffs a potion~
END

IF
  ActionListEmpty()
  HPPercentLT(Myself,35)
  !GlobalTimerNotExpired("BPW","LOCALS")
  See([NEUTRAL.0.ELF.0.SULDANESSALLAR])
THEN
  RESPONSE #80
    SetGlobalTimer("BPW","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,72808)  // ~I need healing!~
    Shout(123)
  RESPONSE #20
    Continue()
END

IF
  CheckStatGT(Myself,10,180)
  CheckStatGT(Myself,5,INT)
  OR(2)
    See(LastAttackerOf(Myself))
    See(LastHitter(Myself))
  CheckStatLT(LastSeenBy(Myself),11,180)
  !GlobalTimerNotExpired("BPCHASE","LOCALS")
THEN
  RESPONSE #100
    SetGlobalTimer("BPCHASE","LOCALS",TWO_ROUNDS)
    DisplayStringHead(Myself,@0)
    EquipMostDamagingMelee()
    MoveToObject(LastSeenBy(Myself))
    AttackOneRound(LastSeenBy(Myself))
END

IF
  CheckStatGT(Myself,10,180)
  CheckStatGT(Myself,5,INT)
  See(TenthNearestEnemyOf(Myself))
  CheckStatLT(LastSeenBy(Myself),11,180)
  !GlobalTimerNotExpired("BPCHASE","LOCALS")
THEN
  RESPONSE #100
    SetGlobalTimer("BPCHASE","LOCALS",TWO_ROUNDS)
    DisplayStringHead(Myself,@0)
    EquipMostDamagingMelee()
    MoveToObject(LastSeenBy(Myself))
    AttackOneRound(LastSeenBy(Myself))
END

IF
  CheckStatGT(Myself,10,180)
  CheckStatGT(Myself,5,INT)
  See(TenthNearest)
  CheckStatLT(TenthNearest,11,180)
  !GlobalTimerNotExpired("BPCHASE","LOCALS")
THEN
  RESPONSE #100
    SetGlobalTimer("BPCHASE","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,@0)
    MoveToObject(TenthNearest)
END

IF
  CheckStatGT(Myself,10,180)
  CheckStatGT(Myself,5,INT)
  !GlobalTimerNotExpired("BPCHASE","LOCALS")
  See(Nearest)
  CheckStatGT(Nearest,10,180)
THEN
  RESPONSE #100
    SetGlobalTimer("BPCHASE","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,@0)
    RunAwayFrom(Nearest,15)
END

IF
  CheckStatGT(Myself,10,180)
  CheckStatGT(Myself,5,INT)
  !GlobalTimerNotExpired("BPCHASE","LOCALS")
  !See(Nearest)
THEN
  RESPONSE #100
    SetGlobal("BPCHASER","LOCALS",1)
    SetGlobalTimer("BPCHASE","LOCALS",TWO_ROUNDS)
    DisplayStringHead(Myself,@0)
    MoveToObject(Player1)
END


IF
  StateCheck(Myself,STATE_POISONED)
  HasItem("potn17",Myself)
  !GlobalTimerNotExpired("POT","LOCALS")
THEN
  RESPONSE #100
    SetGlobalTimer("POT","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,46150)
    UseItem("potn17",Myself)
END

IF
  StateCheck(Myself,STATE_POISONED)
  HasItem("potn20",Myself)
  !GlobalTimerNotExpired("POT","LOCALS")
THEN
  RESPONSE #100
    SetGlobalTimer("POT","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,46150)
    UseItem("potn20",Myself)
END

IF
  ActionListEmpty()
  StateCheck(Myself,STATE_POISONED)
  !GlobalTimerNotExpired("PSH","LOCALS")
  !HasItem("POTN17",Myself)
  !HasItem("POTN20",Myself)
  !HaveSpell(CLERIC_NEUTRALIZE_POISON)
  !HaveSpell(CLERIC_SLOW_POISON)
THEN
  RESPONSE #100
    Shout(83)
    DisplayStringHead(Myself,@1)
    SetGlobalTimer("PSH","LOCALS",ONE_ROUND)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_TRUE_SIGHT)
  CheckStat(Myself,0,118)
  !GlobalTimerNotExpired("BPT","LOCALS")
  Exists(LastAttackerOf(Myself))
  OR(8)
    !See([EVILCUTOFF])
    !See(LastAttackerOf(Myself))
    StateCheck(NearestEnemyOf(Myself),STATE_MIRRORIMAGE)
    StateCheck(NearestEnemyOf(Myself),STATE_ILLUSIONS)
    StateCheck(NearestEnemyOf(Myself),STATE_BLUR)
    Gender(NearestEnemyOf(Myself),ILLUSIONARY)
    Specifics(NearestEnemyOf(Myself),SIMULACRUM)
    Specifics(NearestEnemyOf(Myself),NEEDS_BREACH)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,@2)
    Spell(Myself,CLERIC_TRUE_SIGHT)
END

IF
  ActionListEmpty()
  HaveSpell(NPC_BLADE_BARRIER)
  Allegiance(Myself,ENEMY)
  !CombatCounter(0)
  !GlobalTimerNotExpired("BPT","LOCALS")
  CheckStat(Myself,0,121)
  RandomNumLT(5,3)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(Myself,NPC_BLADE_BARRIER)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_BLADE_BARRIER)
  !Allegiance(Myself,ENEMY)
  !CombatCounter(0)
  !GlobalTimerNotExpired("BPT","LOCALS")
  CheckStat(Myself,0,121)
  RandomNumLT(5,3)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(Myself,CLERIC_BLADE_BARRIER)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_PHYSICAL_MIRROR)
  CheckStat(Myself,0,122)
  !CombatCounter(0)
  !GlobalTimerNotExpired("BPT","LOCALS")
  OR(2)
    HitBy([ANYONE],MISSILE)
    RandomNumLT(4,3)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(Myself,CLERIC_PHYSICAL_MIRROR)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_FREE_ACTION)
  !CombatCounter(0)
  !GlobalTimerNotExpired("BPT","LOCALS")
  CheckStat(Myself,0,131)
  OR(4)
    RandomNum(3,1)
    StateCheck(Myself,STATE_HELPLESS)
    !CheckStat(Myself,0,WEB)
    !CheckStat(Myself,0,ENTANGLE)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(Myself,CLERIC_FREE_ACTION)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_STRENGTH_OF_ONE)
  !GlobalTimerNotExpired("BPT","LOCALS")
  Global("SNAFU","LOCALS",0)
  See([0.HUMANOID.ELF.0.SULDANESSALLAR])
  CheckStatLT(Myself,2,SCRIPTINGSTATE6)
  CheckStatLT(Myself,19,STR)
  CheckStatLT(Myself,50,STREXTRA)
  CheckStatLT(LastSeenBy(Myself),19,STR)
  CheckStatLT(LastSeenBy(Myself),50,STREXTRA)
  RandomNumLT(8,3)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(Myself,CLERIC_STRENGTH_OF_ONE)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_DEATH_WARD)
  !GlobalTimerNotExpired("BPT","LOCALS")
  Global("SNAFU","LOCALS",0)
  CheckStat(Myself,0,SCRIPTINGSTATE2)
  RandomNumLT(9,4)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(Myself,CLERIC_DEATH_WARD)
END

IF
  ActionListEmpty()
  HasItem("potn10",Myself)  // ~Potion of Invisibility~
  !GlobalTimerNotExpired("BPT","LOCALS")
  !StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
  !StateCheck(Myself,STATE_INVISIBLE)
  RandomNumLT(40,17)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,46150)  // ~quaffs a potion~
    UseItem("potn10",Myself)  // ~Potion of Invisibility~
END

IF
  ActionListEmpty()
  HasItem("potn14",Myself)  // ~Oil of Speed~
  !GlobalTimerNotExpired("BPT","LOCALS")
  !StateCheck(Myself,STATE_HASTED)
  RandomNumLT(42,17)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,46150)  // ~quaffs a potion~
    UseItem("potn14",Myself)  // ~Oil of Speed~
END

IF
  HaveSpell(CLERIC_DISPEL_MAGIC)
  !GlobalTimerNotExpired("BPT","LOCALS")
  Global("SNAFU","LOCALS",0)
  See([0.HUMANOID.ELF.0.SULDANESSALLAR])
  OR(9)
    StateCheck(LastSeenBy(Myself),STATE_CHARMED)
    StateCheck(LastSeenBy(Myself),STATE_CONFUSED)
    StateCheck(LastSeenBy(Myself),STATE_SILENCED)
    StateCheck(LastSeenBy(Myself),STATE_HELPLESS)
    StateCheck(LastSeenBy(Myself),STATE_BLIND)
    StateCheck(LastSeenBy(Myself),STATE_STUNNED)
    StateCheck(LastSeenBy(Myself),STATE_SLOWED)
    StateCheck(LastSeenBy(Myself),STATE_SLEEPING)
    StateCheck(LastSeenBy(Myself),STATE_FEEBLEMINDED)
  OR(2)
    !HasImmunityEffects(Myself)
    !Range([NEUTRAL.HUMANOID.ELF.0.SULDANESSALLAR],15)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell([NEUTRAL.HUMANOID.ELF.0.SULDANESSALLAR],CLERIC_DISPEL_MAGIC)
END

IF
  ActionListEmpty()
  OR(3)
    Heard(ThirdNearest([0.HUMANOID.ELF.0.SULDANESSALLAR]),123)
    Heard(SecondNearest([0.HUMANOID.ELF.0.SULDANESSALLAR]),123)
    Heard([0.HUMANOID.ELF.0.SULDANESSALLAR],123)
  Range(LastHeardBy(Myself),15)
  !HPPercentLT(Myself,35)
  HPGT(LastHeardBy(Myself),0)
  !GlobalTimerNotExpired("FH","LOCALS")
  !GlobalTimerNotExpired("BPT","LOCALS")
  HaveSpell(CLERIC_MASS_CURE)
  !CombatCounter(0)
THEN
  RESPONSE #100
    SetGlobalTimer("FH","LOCALS",TWO_ROUNDS)
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    SetInterrupt(FALSE)
    Spell(LastHeardBy(Myself),CLERIC_MASS_CURE)
    SetInterrupt(TRUE)
END

IF
  ActionListEmpty()
  OR(3)
    Heard(ThirdNearest([0.HUMANOID.ELF.0.SULDANESSALLAR]),123)
    Heard(SecondNearest([0.HUMANOID.ELF.0.SULDANESSALLAR]),123)
    Heard([0.HUMANOID.ELF.0.SULDANESSALLAR],123)
  Range(LastHeardBy(Myself),15)
  !HPPercentLT(Myself,35)
  HPGT(LastHeardBy(Myself),0)
  !GlobalTimerNotExpired("FH","LOCALS")
  !GlobalTimerNotExpired("BPT","LOCALS")
  HaveSpell(CLERIC_HEAL)
  !CombatCounter(0)
THEN
  RESPONSE #100
    SetGlobalTimer("FH","LOCALS",TWO_ROUNDS)
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    SetInterrupt(FALSE)
    Spell(LastHeardBy(Myself),CLERIC_HEAL)
    SetInterrupt(TRUE)
END

IF
  ActionListEmpty()
  OR(3)
    Heard(ThirdNearest([0.HUMANOID.ELF.0.SULDANESSALLAR]),123)
    Heard(SecondNearest([0.HUMANOID.ELF.0.SULDANESSALLAR]),123)
    Heard([0.HUMANOID.ELF.0.SULDANESSALLAR],123)
  Range(LastHeardBy(Myself),15)
  !HPPercentLT(Myself,35)
  HPGT(LastHeardBy(Myself),0)
  !GlobalTimerNotExpired("FH","LOCALS")
  !GlobalTimerNotExpired("BPT","LOCALS")
  HaveSpell(CLERIC_CURE_CRITICAL_WOUNDS)
  !CombatCounter(0)
THEN
  RESPONSE #100
    SetGlobalTimer("FH","LOCALS",TWO_ROUNDS)
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    SetInterrupt(FALSE)
    Spell(LastHeardBy(Myself),CLERIC_CURE_CRITICAL_WOUNDS)
    SetInterrupt(TRUE)
END

IF
  ActionListEmpty()
  OR(3)
    Heard(ThirdNearest([0.HUMANOID.ELF.0.SULDANESSALLAR]),123)
    Heard(SecondNearest([0.HUMANOID.ELF.0.SULDANESSALLAR]),123)
    Heard([0.HUMANOID.ELF.0.SULDANESSALLAR],123)
  Range(LastHeardBy(Myself),15)
  !HPPercentLT(Myself,35)
  HPGT(LastHeardBy(Myself),0)
  !GlobalTimerNotExpired("FH","LOCALS")
  !GlobalTimerNotExpired("BPT","LOCALS")
  HaveSpell(CLERIC_CURE_SERIOUS_WOUNDS)
  !CombatCounter(0)
THEN
  RESPONSE #100
    SetGlobalTimer("FH","LOCALS",TWO_ROUNDS)
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    SetInterrupt(FALSE)
    Spell(LastHeardBy(Myself),CLERIC_CURE_SERIOUS_WOUNDS)
    SetInterrupt(TRUE)
END

IF
  ActionListEmpty()
  OR(3)
    Heard(ThirdNearest([0.HUMANOID.ELF.0.SULDANESSALLAR]),123)
    Heard(SecondNearest([0.HUMANOID.ELF.0.SULDANESSALLAR]),123)
    Heard([0.HUMANOID.ELF.0.SULDANESSALLAR],123)
  Range(LastHeardBy(Myself),15)
  !HPPercentLT(Myself,35)
  HPGT(LastHeardBy(Myself),0)
  !GlobalTimerNotExpired("FH","LOCALS")
  !GlobalTimerNotExpired("BPT","LOCALS")
  HaveSpell(CLERIC_CURE_MEDIUM_WOUNDS)
  !CombatCounter(0)
THEN
  RESPONSE #100
    SetGlobalTimer("FH","LOCALS",TWO_ROUNDS)
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    SetInterrupt(FALSE)
    Spell(LastHeardBy(Myself),CLERIC_CURE_MEDIUM_WOUNDS)
    SetInterrupt(TRUE)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_FREE_ACTION)
  !GlobalTimerNotExpired("BPT","LOCALS")
  See([NEUTRAL.HUMANOID.ELF.0.SULDANESSALLAR])
  OR(3)
    StateCheck(LastSeenBy(Myself),STATE_HELPLESS)
    CheckStatGT(LastSeenBy(Myself),0,WEB)
    CheckStatGT(LastSeenBy(Myself),0,ENTANGLE)
  !StateCheck(LastSeenBy(Myself),0)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),CLERIC_FREE_ACTION)
END

IF
  OR(6)
    See([0.0.GOLEM])
    See([0.0.DEMONIC])
    See([0.0.RAKSHASA])
    See([0.0.ELF.0.5])
    See([0.0.ELF.CLERIC.5])
    See([0.0.ELF.MAGE.5])
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  Allegiance(Myself,ENEMY)
  OR(6)
    See(NearestEnemyOf(Myself))
    See(WeakestOf)
    See(WorstAC)
    See(MostDamagedOf)
    See(LastAttackerOf(Myself))
    See(LastHitter(Myself))
  RandomNumLT(28,22)
  OR(4)
    See([GOODCUTOFF.0.0.0.0.SUMMONED_DEMON])
    See([GOODCUTOFF.0.0.0.0.SUMMONED])
    See([GOODCUTOFF.0.0.0.SIMULACRUM])
    See([GOODCUTOFF.0.0.0.0.ILLUSIONARY])
  RandomNumLT(29,23)
  OR(7)
    See([PC.0.0.RANGER_ALL])
    See([PC.0.0.PALADIN_ALL])
    See([PC.0.0.BARD_ALL])
    See([PC.0.0.DRUID_ALL])
    See([PC.0.0.CLERIC_ALL])
    See([PC.0.0.LONG_BOW])
    See([PC.0.0.SORCERER])
  RandomNumLT(30,16)
  See(Protagonist)
  RandomNumLT(26,10)
  OR(4)
    See([GOODCUTOFF.0.0.RANGER_ALL])
    See([GOODCUTOFF.0.0.DRUID_ALL])
    See([GOODCUTOFF.0.0.PALADIN_ALL])
    See([GOODCUTOFF.0.0.CLERIC_ALL])
  RandomNumLT(27,10)
  OR(3)
    See([GOODCUTOFF.0.0.MONK])
    See([GOODCUTOFF.0.0.BARD_ALL])
    See([GOODCUTOFF.0.0.THIEF_ALL])
  RandomNumLT(24,9)
  OR(3)
    See(StrongestOf)
    See(BestAC)
    See(LeastDamagedOf)
  RandomNumLT(25,9)
  See(WeakestOf)
  RandomNumLT(23,8)
  See(WorstAC)
  RandomNumLT(21,8)
  See(MostDamagedOf)
  RandomNumLT(32,11)
  OR(2)
    See(TenthNearest([GOODCUTOFF.0.0.LONG_BOW]))
    See(TenthNearest([GOODCUTOFF.0.0.SORCERER]))
  RandomNumLT(20,8)
  See(TenthNearestEnemyOf(Myself))
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  Specifics(LastSeenBy(Myself),SULDANESSALLAR)
  Race(LastSeenBy(Myself),ELF)
THEN
  RESPONSE #100
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_SILENCE_15_FOOT)
  !GlobalTimerNotExpired("BPT","LOCALS")
  OR(5)
    Class(LastSeenBy(Myself),DRUID_ALL)
    Class(LastSeenBy(Myself),BARD_ALL)
    Class(LastSeenBy(Myself),CLERIC_ALL)
    Class(LastSeenBy(Myself),LONG_BOW)
    Class(LastSeenBy(Myself),SORCERER)
  !Range(LastSeenBy(Myself),15)
  !StateCheck(LastSeenBy(Myself),STATE_SILENCED)
  RandomNumLT(6,6)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),CLERIC_SILENCE_15_FOOT)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_MISCAST_MAGIC)
  !GlobalTimerNotExpired("BPT","LOCALS")
  CheckStatLT(LastSeenBy(Myself),60,SPELLFAILUREMAGE)
  CheckStatLT(LastSeenBy(Myself),60,SPELLFAILUREPRIEST)
  OR(5)
    Class(LastSeenBy(Myself),DRUID_ALL)
    Class(LastSeenBy(Myself),BARD_ALL)
    Class(LastSeenBy(Myself),CLERIC_ALL)
    Class(LastSeenBy(Myself),LONG_BOW)
    Class(LastSeenBy(Myself),SORCERER)
  RandomNumLT(7,6)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),CLERIC_MISCAST_MAGIC)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_DISPEL_MAGIC)
  !GlobalTimerNotExpired("BPT","LOCALS")
  OR(6)
    StateCheck(LastSeenBy(Myself),STATE_HASTED)
    StateCheck(LastSeenBy(Myself),STATE_BLESS)
    StateCheck(LastSeenBy(Myself),STATE_CHANT)
    StateCheck(LastSeenBy(Myself),STATE_MIRRORIMAGE)
    StateCheck(LastSeenBy(Myself),STATE_BLUR)
    HasImmunityEffects(LastSeenBy(Myself))
  !Range(LastSeenBy(Myself),15)
  RandomNumLT(59,39)
THEN
  RESPONSE #100
    SetGlobal("BPT","LOCALS",6)
    Spell(NearestEnemyOf(Myself),CLERIC_DISPEL_MAGIC)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_CONFUSION)
  !GlobalTimerNotExpired("BPT","LOCALS")
  !StateCheck(LastSeenBy(Myself),STATE_CONFUSED)
  RandomNumLT(37,22)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),CLERIC_CONFUSION)
END

IF
  ActionListEmpty()
  HaveSpell(ENEMY_CLERIC_HARM)
  !GlobalTimerNotExpired("BPT","LOCALS")
  CheckStat(LastSeenBy(Myself),0,129)
  RandomNumLT(43,27)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),ENEMY_CLERIC_HARM)
END

IF
  ActionListEmpty()
  HaveSpell(ENEMY_CLERIC_SLAY_LIVING)
  !GlobalTimerNotExpired("BPT","LOCALS")
  CheckStat(LastSeenBy(Myself),0,129)
  RandomNumLT(42,26)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),ENEMY_CLERIC_SLAY_LIVING)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_FLAME_STRIKE)
  !GlobalTimerNotExpired("BPT","LOCALS")
  CheckStat(LastSeenBy(Myself),0,129)
  CheckStatLT(LastSeenBy(Myself),50,RESISTMAGICFIRE)
  RandomNumLT(39,25)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),CLERIC_FLAME_STRIKE)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_MENTAL_DOMINATION)
  !GlobalTimerNotExpired("BPT","LOCALS")
  !StateCheck(LastSeenBy(Myself),STATE_STUNNED)
  CheckStat(LastSeenBy(Myself),0,129)
  RandomNumLT(49,29)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),CLERIC_MENTAL_DOMINATION)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_HOLD_PERSON)
  !GlobalTimerNotExpired("BPT","LOCALS")
  CheckStat(LastSeenBy(Myself),0,129)
  CheckStat(LastSeenBy(Myself),0,HELD)
  !StateCheck(LastSeenBy(Myself),STATE_HELPLESS)
  General(LastSeenBy(Myself),HUMANOID)
  RandomNumLT(38,23)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),CLERIC_HOLD_PERSON)
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_CAUSE_SERIOUS_WOUNDS)
  !GlobalTimerNotExpired("BPT","LOCALS")
  CheckStat(LastSeenBy(Myself),0,181)
  RandomNumLT(56,29)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),CLERIC_CAUSE_SERIOUS_WOUNDS)
    AttackOneRound(LastSeenBy(Myself))
END

IF
  ActionListEmpty()
  HaveSpell(CLERIC_CHARM_PERSON)
  !GlobalTimerNotExpired("BPT","LOCALS")
  CheckStat(LastSeenBy(Myself),0,129)
  OR(2)
    General(LastSeenBy(Myself),HUMANOID)
    General(LastSeenBy(Myself),ANIMAL)
  !StateCheck(LastSeenBy(Myself),STATE_CHARMED)
  RandomNumLT(58,23)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    Spell(LastSeenBy(Myself),CLERIC_CHARM_PERSON)
END

IF
  ActionListEmpty()
  HPPercentLT(Myself,25)
  Range(LastHitter(Myself),10)
  !GlobalTimerNotExpired("BPW","LOCALS")
THEN
  RESPONSE #30
    DisplayStringHead(Myself,49767)  // ~No more~
    Shout(124)
    SetGlobalTimer("BPW","LOCALS",10)
    RunAwayFrom(LastHitter(Myself),40)
  RESPONSE #30
    DisplayStringHead(Myself,@3)
    Shout(124)
    SetGlobalTimer("BPW","LOCALS",10)
    Attack(LastHitter(Myself))
  RESPONSE #40
    DisplayStringHead(Myself,49766)  // ~I can't take this~
    Shout(123)
    SetGlobalTimer("BPW","LOCALS",10)
    AttackReevaluate(LastSeenBy(Myself),15)
END

IF
  ActionListEmpty()
  CheckStatGT(LastSeenBy(Myself),10,180)
  CheckStatLT(Myself,11,180)
THEN
  RESPONSE #100
    EquipRanged()
    AttackOneRound(LastSeenBy(Myself))
END

IF
  ActionListEmpty()
  OR(3)
    !Range(NearestEnemyOf(Myself),5)
    CheckStatGT(NearestEnemyOf(Myself),0,121)
    CheckStatGT(LastSeenBy(Myself),0,125)
THEN
  RESPONSE #100
    EquipRanged()
    AttackOneRound(LastSeenBy(Myself))
END

IF
  OR(2)
    CheckStatGT(NearestEnemyOf(Myself),0,121)
    CheckStatGT(LastSeenBy(Myself),0,125)
THEN
  RESPONSE #25
    Continue()
  RESPONSE #75
END

IF
  ActionListEmpty()
  !Range(LastSeenBy(Myself),8)
THEN
  RESPONSE #90
    EquipMostDamagingMelee()
    AttackOneRound(NearestEnemyOf(Myself))
  RESPONSE #90
    EquipMostDamagingMelee()
    AttackReevaluate(LastSeenBy(Myself),150)
END

IF
  ActionListEmpty()
THEN
  RESPONSE #100
    EquipMostDamagingMelee()
    AttackOneRound(LastSeenBy(Myself))
END

