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

IF
  Global("BPSC","LOCALS",0)
  Race(LastSummonerOf(Myself),ELF)
  Specifics(LastSummonerOf(Myself),6)
THEN
  RESPONSE #100
    ChangeAIScript("",OVERRIDE)
    ChangeAIScript("",CLASS)
    ChangeAIScript("",RACE)
    ChangeAIScript("",GENERAL)
    ChangeAIScript("BPSUELF",DEFAULT)
END

IF
  Global("BPSC","LOCALS",0)
  Allegiance(LastSummonerOf(Myself),GOODCUTOFF)
  !Race(Myself,DEMONIC)
  HaveAnySpells()
THEN
  RESPONSE #100
    ChangeAIScript("",OVERRIDE)
    ChangeAIScript("GB-SMAGE",CLASS)
    ChangeAIScript("",RACE)
    ChangeAIScript("",GENERAL)
    ChangeAIScript("",DEFAULT)
END

IF
  Global("BPSC","LOCALS",0)
  Allegiance(LastSummonerOf(Myself),GOODCUTOFF)
  !Race(Myself,DEMONIC)
  !HaveAnySpells()
THEN
  RESPONSE #100
    ChangeAIScript("",OVERRIDE)
    ChangeAIScript("GB-SUMM",CLASS)
    ChangeAIScript("",RACE)
    ChangeAIScript("",GENERAL)
    ChangeAIScript("",DEFAULT)
END

IF
  OR(2)
    Heard([NEUTRAL],79)
    Heard([EVILCUTOFF],79)
  Allegiance(Myself,NEUTRAL)
  !Global("BP_PlotMan","LOCALS",1)
THEN
  RESPONSE #100
    Enemy()
END

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

IF
  Global("BP_EnemyTurn","LOCALS",0)
  !Allegiance(Myself,ENEMY)
  !Allegiance(Myself,PC)
  OR(2)
    AttackedBy([GOODCUTOFF],DEFAULT)
    Allegiance(LastAttackerOf(Myself),GOODCUTOFF)
THEN
  RESPONSE #100
    SetGlobal("BP_EnemyTurn","LOCALS",1)
    Enemy()
    Shout(151)
END

IF
  Global("BP_Enemy","LOCALS",0)
  !Allegiance(Myself,ENEMY)
  !Allegiance(Myself,GOODCUTOFF)
  OR(2)
    HitBy([GOODCUTOFF],CRUSHING)
    Allegiance(LastHitter(Myself),GOODCUTOFF)
THEN
  RESPONSE #100
    SetGlobal("BP_Enemy","LOCALS",1)
    Shout(151)
    Enemy()
END

//////////////CLOUDLIKE  EFFECTS//////////////////////

IF
  CheckStat(Myself,11,180) // I'm in a stinking cloud
  CheckStatGT(Myself,5,INT)
  !StateCheck(Myself,STATE_SLEEPING) // not yet affected
  CheckStatGT(Myself,4,SAVEVSSPELL) //and I got a reasonable chance of failing a save throw (25%+)
  OR(2)
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

IF
  CheckStatGT(Myself,11,180) // I'm in a web, entangle, or grease spell
  CheckStatLT(Myself,15,180)
  CheckStatGT(Myself,5,INT)
  !HasItemEquiped("ANTIWEB",Myself) // All spiders have this item, not the free action effect
  !Race(Myself,161) // Drider Race, not currently used but kept just in case
  CheckStatLT(Myself,1,131) // I don't have free action
  CheckStatLT(Myself,1,WEB) //and not webbed up
  CheckStatLT(Myself,1,ENTANGLE) //nor entangled --I can move
  CheckStatGT(Myself,4,SAVEVSSPELL) //and I got a reasonable chance of failing a save throw (25%+)
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

IF
  CheckStat(Myself,15,180) // I'm in an Ice Storm
  CheckStatGT(Myself,5,INT)
  CheckStatLT(Myself,100,RESISTCOLD) // Not Immune
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

IF
  CheckStat(Myself,16,180) // I'm in a Cloudkill or Death Fog
  CheckStatGT(Myself,5,INT)
  CheckStatLT(Myself,100,RESISTPOISON) // Not Immune
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

IF
  CheckStat(Myself,17,180) // I'm in a Death Fog
  CheckStatGT(Myself,5,INT)
  CheckStatLT(Myself,100,RESISTACID) // Not Immune
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

IF
  CheckStat(Myself,18,180) // Incendiary Cloud, Meteor Swarm or Fire Storm -- bad stuff
  CheckStatGT(Myself,5,INT)
  CheckStatLT(Myself,100,RESISTFIRE) // Not Immune
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

// This is to try and keep them from going back in to whomp somebody
IF
  CheckStatLT(Myself,11,180) // No longer in the cloud effects
  CheckStatGT(Myself,5,INT)
  GlobalLT("BOW","LOCALS",2)
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  !Range(LastSeenBy(Myself),16)
  Exists([EVILCUTOFF])
  !Range(NearestEnemyOf(Myself),2)
THEN
  RESPONSE #100
    EquipRanged()  //use your bow, then
    SmallWait(3)
    Continue()
END

//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////


IF
  OR(2)
    !Allegiance(Myself,EVILCUTOFF)
    !Detect([GOODCUTOFF])
THEN
  RESPONSE #100
END

IF
  TargetUnreachable(LastSeenBy(Myself))
  Delay(3)
THEN
  RESPONSE #100
    ClearActions(Myself)
    Continue()
END

IF
  General(Myself,UNDEAD)
  OR(2)
    TurnedBy([GOODCUTOFF.0.0.CLERIC_ALL])
    TurnedBy([GOODCUTOFF.0.0.PALADIN_ALL])
  Global("BPTURNED","LOCALS",0)
  !GlobalTimerNotExpired("BPTT","LOCALS")
THEN
  RESPONSE #100
    SetGlobal("BPTURNED","LOCALS",1)
    SetGlobalTimer("BPTT","LOCALS",FIVE_ROUNDS)
END

IF
  General(Myself,UNDEAD)
  OR(2)
    TurnedBy([GOODCUTOFF.0.0.CLERIC_ALL])
    TurnedBy([GOODCUTOFF.0.0.PALADIN_ALL])
  Global("BPTURNED","LOCALS",1)
  OR(2)
    !GlobalTimerNotExpired("BPTT","LOCALS")
    TookDamage()
THEN
  RESPONSE #100
    SetGlobalTimer("BPTT","LOCALS",0)
    SetGlobal("BPTURNED","LOCALS",0)
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
  General(Myself,UNDEAD)
  Global("BPTURNED","LOCALS",1)
  See([GOODCUTOFF])
  Range(LastSeenBy(Myself),15)
  !AttackedBy(LastSeenBy(Myself),DEFAULT)
THEN
  RESPONSE #100
    RunAwayFrom(LastSeenBy(Myself),10)
END

//////////////CLOUDLIKE  EFFECTS//////////////////////

IF
  CheckStat(Myself,11,180) // I'm in a stinking cloud
  CheckStatGT(Myself,5,INT)
  !StateCheck(Myself,STATE_SLEEPING) // not yet affected
  CheckStatGT(Myself,4,SAVEVSSPELL) //and I got a reasonable chance of failing a save throw (25%+)
  OR(2)
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

IF
  CheckStatGT(Myself,11,180) // I'm in a web,entangle, or grease spell
  CheckStatLT(Myself,15,180)
  CheckStatGT(Myself,5,INT)
  CheckStatLT(Myself,1,131) // I don't have free action
  CheckStatLT(Myself,1,WEB) //and not webbed up
  CheckStatLT(Myself,1,ENTANGLE) //nor entangled --I can move
  CheckStatGT(Myself,4,SAVEVSSPELL) //and I got a reasonable chance of failing a save throw (25%+)
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

IF
  CheckStat(Myself,15,180) // I'm in an Ice Storm
  CheckStatGT(Myself,5,INT)
  CheckStatLT(Myself,100,RESISTCOLD) // Not Immune
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

IF
  CheckStat(Myself,16,180) // I'm in a Cloudkill or Death Fog
  CheckStatGT(Myself,5,INT)
  CheckStatLT(Myself,100,RESISTPOISON) // Not Immune
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

IF
  CheckStat(Myself,17,180) // I'm in a Death Fog
  CheckStatGT(Myself,5,INT)
  CheckStatLT(Myself,100,RESISTACID) // Not Immune
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

IF
  CheckStat(Myself,18,180) // Incendiary Cloud, Meteor Swarm or Fire Storm -- bad stuff
  CheckStatGT(Myself,5,INT)
  CheckStatLT(Myself,100,RESISTFIRE) // Not Immune
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  Range(LastSeenBy(Myself),16)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    RunAwayFrom(LastSeenBy(Myself),30)
    SetInterrupt(TRUE)
END

// This is to try and keep them from going back in to whomp somebody
IF
  CheckStatLT(Myself,11,180) // No longer in the cloud effects
  CheckStatGT(Myself,5,INT)
  GlobalLT("BOW","LOCALS",2)
  OR(3)
    Detect([0.0.MORNINGSTAR.FAIRY_NYMPH.65])
    Detect(NearestEnemyOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
    Detect(NearestMyGroupOfType([0.0.MORNINGSTAR.FAIRY_NYMPH.65]))
  !Range(LastSeenBy(Myself),16)
  Exists([EVILCUTOFF])
  !Range(NearestEnemyOf(Myself),2)
THEN
  RESPONSE #100
    EquipRanged()  //use your bow, then
    SmallWait(3)
    Continue()
END

//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////


IF
  General(Myself,UNDEAD)
  Global("BPTURNED","LOCALS",1)
THEN
  RESPONSE #100
END

IF
  HasItem("potn55",Myself)
  !GlobalTimerNotExpired("POT","LOCALS")
  !General(Myself,UNDEAD)
  HPPercentLT(Myself,60)
THEN
  RESPONSE #100
    DisplayStringHead(Myself,46150)
    SetGlobalTimer("POT","LOCALS",ONE_ROUND)
    UseItem("potn55",Myself)
END

IF
  HasItem("potn52",Myself)
  !GlobalTimerNotExpired("POT","LOCALS")
  !General(Myself,UNDEAD)
  HPPercentLT(Myself,70)
THEN
  RESPONSE #100
    DisplayStringHead(Myself,46150)
    SetGlobalTimer("POT","LOCALS",ONE_ROUND)
    UseItem("potn52",Myself)
END

IF
  HasItem("POTN08",Myself)
  !GlobalTimerNotExpired("POT","LOCALS")
  HPPercentLT(Myself,85)
  !General(Myself,UNDEAD)
  RandomNumLT(201,80)
THEN
  RESPONSE #100
    SetGlobalTimer("POT","LOCALS",ONE_ROUND)
    UseItem("POTN08",Myself)
    DisplayStringHead(Myself,46150)
END

IF
  ActionListEmpty()
  HPPercentLT(Myself,35)
  CheckStatGT(Myself,7,INT)
  OR(2)
    General(Myself,HUMANOID)
    General(Myself,GIANTHUMANOID)
  !HasItem("POTN55",Myself)
  !HasItem("POTN52",Myself)
  !GlobalTimerNotExpired("BPW","LOCALS")
  Range([EVILCUTOFF],15)
THEN
  RESPONSE #80
    SetGlobalTimer("BPW","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,72808)
    Shout(123)
  RESPONSE #20
    Continue()
END

IF
  ActionListEmpty()
  HPPercentLT(Myself,35)
  CheckStatGT(Myself,7,INT)
  !General(Myself,HUMANOID)
  !General(Myself,GIANTHUMANOID)
  !HasItem("POTN55",Myself)
  !HasItem("POTN52",Myself)
  !GlobalTimerNotExpired("BPW","LOCALS")
  Range([EVILCUTOFF],15)
THEN
  RESPONSE #80
    SetGlobalTimer("BPW","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,@0)
    Shout(123)
  RESPONSE #20
    Continue()
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)
  CheckStatGT(Myself,7,INT)
  OR(2)
    General(Myself,HUMANOID)
    General(Myself,GIANTHUMANOID)
  Range([EVILCUTOFF],15)
  !GlobalTimerNotExpired("POIS","LOCALS")
  !HasItem("POTN17",Myself)
  !HasItem("POTN20",Myself)
THEN
  RESPONSE #100
    Shout(83)
    DisplayStringHead(Myself,@1)
    SetGlobalTimer("POIS","LOCALS",ONE_ROUND)
END

IF
  ActionListEmpty()
  StateCheck(Myself,STATE_POISONED)
  CheckStatGT(Myself,7,INT)
  !General(Myself,HUMANOID)
  !General(Myself,GIANTHUMANOID)
  Range([EVILCUTOFF],15)
  !GlobalTimerNotExpired("POIS","LOCALS")
  !HasItem("POTN17",Myself)
  !HasItem("POTN20",Myself)
THEN
  RESPONSE #100
    Shout(83)
    DisplayStringHead(Myself,@2)
    SetGlobalTimer("POIS","LOCALS",ONE_ROUND)
END

IF
  ActionListEmpty()
  HaveSpellRES("SPSHAD2")
  !GlobalTimerNotExpired("BPT","LOCALS")
  !StateCheck(Myself,0x400010)
  RandomNumLT(35,18)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    SpellRES("SPSHAD2",Myself)
END

IF
  ActionListEmpty()
  HasItem("ring05",Myself)
  !GlobalTimerNotExpired("BPT","LOCALS")
  !StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
  !StateCheck(Myself,STATE_INVISIBLE)
  RandomNumLT(40,17)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    UseItem("ring05",Myself)
END

IF
  ActionListEmpty()
  HasItem("potn10",Myself)
  !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)
    UseItem("potn10",Myself)
END

IF
  ActionListEmpty()
  HasItem("potn14",Myself)
  !GlobalTimerNotExpired("BPT","LOCALS")
  !StateCheck(Myself,STATE_HASTED)
  RandomNumLT(42,17)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,46150)
    UseItem("potn14",Myself)
END

IF
  ActionListEmpty()
  HasItem("POTN11",Myself)
  !GlobalTimerNotExpired("BPT","LOCALS")
  Class(Myself,FIGHTER)
  OR(4)
    See([EVILCUTOFF.0.0.FIGHTER_ALL])
    See([EVILCUTOFF.0.0.RANGER_ALL])
    See([EVILCUTOFF.0.0.PALADIN_ALL])
    See([EVILCUTOFF.0.0.MONK])
  RandomNumLT(41,15)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    DisplayStringHead(Myself,46150)
    UseItem("POTN11",Myself)
END

IF
  ActionListEmpty()
  HitBy([GOODCUTOFF],CRUSHING)
  !GlobalTimerNotExpired("RANG","LOCALS")
  CheckStatGT(Myself,7,INT)
  OR(2)
    General(Myself,GIANTHUMANOID)
    General(Myself,HUMANOID)
  !StateCheck(Myself,STATE_POISONED)
  OR(2)
    See(LastAttackerOf(Myself))
    See(LastHitter(Myself))
  OR(3)
    !Race(LastSeenBy(Myself),MORNINGSTAR)
    !Class(LastSeenBy(Myself),FAIRY_NYMPH)
    !Specifics(LastSeenBy(Myself),65)
  !Range(LastSeenBy(Myself),5)
  Exists(LastSeenBy(Myself))
  !TargetUnreachable(LastSeenBy(Myself))
  !InWeaponRange(LastSeenBy(Myself))
  HPGT(LastSeenBy(Myself),0)
THEN
  RESPONSE #50
    DisplayStringHead(Myself,@3)
    SetGlobalTimer("RANG","LOCALS",ONE_ROUND)
  RESPONSE #50
    DisplayStringHead(Myself,@4)
    SetGlobalTimer("RANG","LOCALS",ONE_ROUND)
  RESPONSE #25
    DisplayStringHead(Myself,@5)
    SetGlobalTimer("RANG","LOCALS",ONE_ROUND)
  RESPONSE #25
    DisplayStringHead(Myself,@6)
    SetGlobalTimer("RANG","LOCALS",ONE_ROUND)
  RESPONSE #50
    DisplayStringHead(Myself,@7)
    SetGlobalTimer("RANG","LOCALS",ONE_ROUND)
    MoveToObject(LastSeenBy(Myself))
    AttackOneRound(LastSeenBy(Myself))
    AttackOneRound(LastSeenBy(Myself))
END


IF
  OR(3)
    !Race(NearestEnemyOf(Myself),MORNINGSTAR)
    !Class(NearestEnemyOf(Myself),FAIRY_NYMPH)
    !Specifics(NearestEnemyOf(Myself),65)
  See(NearestEnemyOf(Myself))
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  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])
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  RandomNumLT(31,26)
  OR(6)
    See(NearestEnemyOf(Myself))
    See(WeakestOf)
    See(WorstAC)
    See(MostDamagedOf)
    See(LastAttackerOf(Myself))
    See(LastHitter(Myself))
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  OR(3)
    Allegiance(LastSeenBy(Myself),ENEMY)
    Allegiance(LastSeenBy(Myself),EVILCUTOFF)
    Allegiance(LastSeenBy(Myself),GOODBUTRED)
THEN
  RESPONSE #100
END


IF
  Race(LastSeenBy(Myself),MORNINGSTAR)
  Class(LastSeenBy(Myself),FAIRY_NYMPH)
  Specifics(LastSeenBy(Myself),65)
THEN
  RESPONSE #100
END

IF
  StateCheck(LastSeenBy(Myself),STATE_CHARMED)
THEN
  RESPONSE #80
    Continue()
  RESPONSE #20
END

IF
  ActionListEmpty()
  StateCheck(Myself,STATE_INVISIBLE)
  Class(Myself,THIEF_ALL)
  HPPercentGT(Myself,25)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    EquipMostDamagingMelee()
    MoveToObject(LastSeenBy(Myself))
    AttackOneRound(LastSeenBy(Myself))
END

IF
  ActionListEmpty()
  CheckStatGT(Myself,0,SCRIPTINGSTATE4)
THEN
  RESPONSE #100
    EquipMostDamagingMelee()
    AttackOneRound(LastSeenBy(Myself))
END

IF
  RandomNumLT(30,13)
  OR(6)
    See(NearestEnemyOfType([PC]))
    See(SecondNearestEnemyOfType([PC]))
    See(ThirdNearestEnemyOfType([PC]))
    See(FourthNearestEnemyOfType([PC]))
    See(FifthNearestEnemyOfType([PC]))
    See(SixthNearestEnemyOfType([PC]))
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  RandomNumGT(30,20)
  OR(6)
    See(NearestEnemyOfType([GOODCUTOFF]))
    See(SecondNearestEnemyOfType([GOODCUTOFF]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF]))
    See(FourthNearestEnemyOfType([GOODCUTOFF]))
    See(FifthNearestEnemyOfType([GOODCUTOFF]))
    See(SixthNearestEnemyOfType([GOODCUTOFF]))
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  RandomNumGT(30,15)
  RandomNumLT(30,19)
  See(Protagonist)
  False()
THEN
  RESPONSE #100
    Continue()
END
  
IF
  RandomNumLT(29,20)
  OR(7)
    See(NearestEnemyOfType([PC.0.0.RANGER_ALL]))
    See(NearestEnemyOfType([PC.0.0.PALADIN_ALL]))
    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]))
  OR(7)
    See(SecondNearestEnemyOfType([PC.0.0.RANGER_ALL]))
    See(SecondNearestEnemyOfType([PC.0.0.PALADIN_ALL]))
    See(SecondNearestEnemyOfType([PC.0.0.BARD_ALL]))
    See(SecondNearestEnemyOfType([PC.0.0.DRUID_ALL]))
    See(SecondNearestEnemyOfType([PC.0.0.CLERIC_ALL]))
    See(SecondNearestEnemyOfType([PC.0.0.LONG_BOW]))
    See(SecondNearestEnemyOfType([PC.0.0.SORCERER]))
  OR(7)
    See(ThirdNearestEnemyOfType([PC.0.0.RANGER_ALL]))
    See(ThirdNearestEnemyOfType([PC.0.0.PALADIN_ALL]))
    See(ThirdNearestEnemyOfType([PC.0.0.BARD_ALL]))
    See(ThirdNearestEnemyOfType([PC.0.0.DRUID_ALL]))
    See(ThirdNearestEnemyOfType([PC.0.0.CLERIC_ALL]))
    See(ThirdNearestEnemyOfType([PC.0.0.LONG_BOW]))
    See(ThirdNearestEnemyOfType([PC.0.0.SORCERER]))
  OR(7)
    See(FourthNearestEnemyOfType([PC.0.0.RANGER_ALL]))
    See(FourthNearestEnemyOfType([PC.0.0.PALADIN_ALL]))
    See(FourthNearestEnemyOfType([PC.0.0.BARD_ALL]))
    See(FourthNearestEnemyOfType([PC.0.0.DRUID_ALL]))
    See(FourthNearestEnemyOfType([PC.0.0.CLERIC_ALL]))
    See(FourthNearestEnemyOfType([PC.0.0.LONG_BOW]))
    See(FourthNearestEnemyOfType([PC.0.0.SORCERER]))
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  RandomNumLT(26,14)
  OR(12)
    See(NearestEnemyOfType([GOODCUTOFF.0.0.BARD_ALL]))
    See(NearestEnemyOfType([GOODCUTOFF.0.0.LONG_BOW]))
    See(NearestEnemyOfType([GOODCUTOFF.0.0.SORCERER]))
    See(SecondNearestEnemyOfType([GOODCUTOFF.0.0.BARD_ALL]))
    See(SecondNearestEnemyOfType([GOODCUTOFF.0.0.LONG_BOW]))
    See(SecondNearestEnemyOfType([GOODCUTOFF.0.0.SORCERER]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.BARD_ALL]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.LONG_BOW]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.SORCERER]))
    See(FourthNearestEnemyOfType([GOODCUTOFF.0.0.BARD_ALL]))
    See(FourthNearestEnemyOfType([GOODCUTOFF.0.0.LONG_BOW]))
    See(FourthNearestEnemyOfType([GOODCUTOFF.0.0.SORCERER]))
  RandomNumLT(27,10)
  OR(12)
    See(NearestEnemyOfType([GOODCUTOFF.0.0.RANGER_ALL]))
    See(NearestEnemyOfType([GOODCUTOFF.0.0.PALADIN_ALL]))
    See(NearestEnemyOfType([GOODCUTOFF.0.0.DRUID_ALL]))
    See(NearestEnemyOfType([GOODCUTOFF.0.0.CLERIC_ALL]))
    See(SecondNearestEnemyOfType([GOODCUTOFF.0.0.RANGER_ALL]))
    See(SecondNearestEnemyOfType([GOODCUTOFF.0.0.PALADIN_ALL]))
    See(SecondNearestEnemyOfType([GOODCUTOFF.0.0.DRUID_ALL]))
    See(SecondNearestEnemyOfType([GOODCUTOFF.0.0.CLERIC_ALL]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.RANGER_ALL]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.PALADIN_ALL]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.DRUID_ALL]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.CLERIC_ALL]))
  RandomNumLT(32,12)
  OR(9)
    See(NearestEnemyOfType([GOODCUTOFF.0.0.MONK]))
    See(NearestEnemyOfType([GOODCUTOFF.0.0.THIEF_ALL]))
    See(NearestEnemyOfType([GOODCUTOFF.0.0.BARD_ALL]))
    See(SecondNearestEnemyOfType([GOODCUTOFF.0.0.MONK]))
    See(SecondNearestEnemyOfType([GOODCUTOFF.0.0.THIEF_ALL]))
    See(SecondNearestEnemyOfType([GOODCUTOFF.0.0.BARD_ALL]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.MONK]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.THIEF_ALL]))
    See(ThirdNearestEnemyOfType([GOODCUTOFF.0.0.BARD_ALL]))
  False()
THEN
  RESPONSE #100
    Continue()
END



IF
  ActionListEmpty()
  Race(Myself,DWARF)
  Specifics(Myself,5)
  Global("BOW","LOCALS",2)
  !GlobalTimerNotExpired("BPT","LOCALS")
  GlobalLT("DGB","LOCALS",3)
  !Range(NearestEnemyOf(Myself),5)
THEN
  RESPONSE #100
    IncrementGlobal("DGB","LOCALS",1)
    SetGlobalTimer("BPT","LOCALS",12)
    ForceSpellRES("BOULDER",LastSeenBy(Myself))
END

IF
  ActionListEmpty()
  HaveSpellRES("SPDROWR3")
  !GlobalTimerNotExpired("BPT","LOCALS")
  Range(LastSeenBy(Myself),8)
  CheckStat(LastSeenBy(Myself),0,129)
  RandomNumLT(115,58)
THEN
  RESPONSE #100
    SetGlobalTimer("BPT","LOCALS",ONE_ROUND)
    SpellRES("SPDROWR3",LastSeenBy(Myself))
END

IF
  ActionListEmpty()
  Specifics(Myself,5)
  OR(2)
    Race(Myself,ELF)
    Race(Myself,161)
  !GlobalTimerNotExpired("KRSC","LOCALS")
  !GlobalTimerNotExpired("KRDT","LOCALS")
  !StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
  LevelLT(Myself,7)
  OR(2)
    !AreaType(OUTDOOR)
    !TimeOfDay(DAY)
THEN
  RESPONSE #50
    SetGlobalTimer("KRSC","LOCALS",ONE_ROUND)
    SetGlobalTimer("KRDT","LOCALS",ONE_TURN)
    SpellNoDec(LastSeenBy(Myself),INNATE_GLOBE_OF_DARKNESS)
  RESPONSE #50
    SetGlobalTimer("KRDT","LOCALS",ONE_ROUND)
    Continue()
  RESPONSE #50
    SetGlobalTimer("KRDT","LOCALS",14)
    Continue()
  RESPONSE #50
    SetGlobalTimer("KRSC","LOCALS",ONE_ROUND)
    SetGlobalTimer("KRDT","LOCALS",TWO_TURNS)
    SpellNoDec(LastSeenBy(Myself),INNATE_GLOBE_OF_DARKNESS)
END

IF
  ActionListEmpty()
  Specifics(Myself,5)
  OR(2)
    Race(Myself,ELF)
    Race(Myself,161)
  !GlobalTimerNotExpired("KRSC","LOCALS")
  !GlobalTimerNotExpired("KRDT","LOCALS")
  !StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
  LevelGT(Myself,6)
  OR(2)
    !AreaType(OUTDOOR)
    !TimeOfDay(DAY)
THEN
  RESPONSE #50
    SetGlobalTimer("KRSC","LOCALS",ONE_ROUND)
    SetGlobalTimer("KRDT","LOCALS",ONE_TURN)
    SpellNoDec(LastSeenBy(Myself),INNATE_IMPROVED_GLOBE_OF_DARKNESS)
  RESPONSE #50
    SetGlobalTimer("KRDT","LOCALS",TWO_ROUNDS)
    Continue()
  RESPONSE #50
    SetGlobalTimer("KRDT","LOCALS",32)
    Continue()
  RESPONSE #50
    SetGlobalTimer("KRSC","LOCALS",ONE_ROUND)
    SetGlobalTimer("KRDT","LOCALS",TWO_TURNS)
    SpellNoDec(LastSeenBy(Myself),INNATE_IMPROVED_GLOBE_OF_DARKNESS)
END

IF
  ActionListEmpty()
  Specifics(Myself,5)
  OR(2)
    Race(Myself,ELF)
    Race(Myself,161)
  !GlobalTimerNotExpired("KRSC","LOCALS")
  !GlobalTimerNotExpired("KRFF","LOCALS")
  !StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
  OR(2)
    !AreaType(OUTDOOR)
    !TimeOfDay(DAY)
THEN
  RESPONSE #50
    SetGlobalTimer("KRSC","LOCALS",ONE_ROUND)
    SetGlobalTimer("KRFF","LOCALS",ONE_TURN)
    SpellNoDec(LastSeenBy(Myself),INNATE_FAERIE_FIRE)
  RESPONSE #50
    SetGlobalTimer("KRFF","LOCALS",THREE_ROUNDS)
    Continue()
  RESPONSE #50
    SetGlobalTimer("KRFF","LOCALS",FOUR_ROUNDS)
    Continue()
  RESPONSE #50
    SetGlobalTimer("KRSC","LOCALS",ONE_ROUND)
    SetGlobalTimer("KRFF","LOCALS",TWO_TURNS)
    SpellNoDec(LastSeenBy(Myself),INNATE_FAERIE_FIRE)
END

IF
  ActionListEmpty()
  OR(2)
    Race(Myself,ELF)
    Race(Myself,161)
  Specifics(Myself,5)
  See(NearestEnemyOf(Myself))
  !GlobalTimerNotExpired("KRSC","LOCALS")
  !GlobalTimerNotExpired("KDL","LOCALS")
  !StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
  OR(2)
    !AreaType(OUTDOOR)
    !TimeOfDay(DAY)
THEN
  RESPONSE #50
    SetGlobalTimer("KRSC","LOCALS",ONE_ROUND)
    SetGlobalTimer("KRDL","LOCALS",ONE_TURN)
    SpellNoDec(LastSeenBy(Myself),INNATE_DANCING_LIGHTS)
  RESPONSE #50
    SetGlobalTimer("KRDL","LOCALS",ONE_ROUND)
    Continue()
  RESPONSE #50
    SetGlobalTimer("KRDL","LOCALS",TWO_ROUNDS)
    Continue()
  RESPONSE #50
    SetGlobalTimer("KRSC","LOCALS",ONE_ROUND)
    SetGlobalTimer("KRDL","LOCALS",TWO_TURNS)
    SpellNoDec(LastSeenBy(Myself),INNATE_DANCING_LIGHTS)
END

IF
  ActionListEmpty()
  General(Myself,UNDEAD)
  !Race(Myself,ELEMENTAL)
  !Race(Myself,SHADOW)
  !Race(Myself,WRAITH)
  !Race(Myself,MIST)
  !Race(Myself,SPECTRE)
  !Race(Myself,ZOMBIE)
  !Class(Myself,SKELETON)
  !GlobalTimerNotExpired("DEAD","LOCALS")
  !StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
  GlobalLT("UDEAD","LOCALS",6)
  RandomNumLT(127,64)
THEN
  RESPONSE #60
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),WIZARD_SPOOK)
  RESPONSE #75
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),WIZARD_BLINDNESS)
  RESPONSE #60
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),WIZARD_HORROR)
  RESPONSE #75
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),WIZARD_RAY_OF_ENFEEBLEMENT)
  RESPONSE #60
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),CLERIC_DOOM)
  RESPONSE #95
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
END

IF
  ActionListEmpty()
  General(Myself,UNDEAD)
  !Race(Myself,ELEMENTAL)
  !Race(Myself,SHADOW)
  !Race(Myself,ZOMBIE)
  !Class(Myself,SKELETON)
  !Race(Myself,WRAITH)
  !Race(Myself,MIST)
  !Race(Myself,SPECTRE)
  !GlobalTimerNotExpired("DEAD","LOCALS")
  GlobalLT("UDEAD","LOCALS",4)
  !StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
  LevelGT(Myself,9)
  RandomNumLT(126,64)
THEN
  RESPONSE #60
    SetGlobalTimer("DEAD","LOCALS",ONE_ROUND)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(Myself,WIZARD_IMPROVED_HASTE)
  RESPONSE #50
    SetGlobalTimer("DEAD","LOCALS",FOUR_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),INNATE_IMPROVED_GLOBE_OF_DARKNESS)
  RESPONSE #40
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),WIZARD_GREATER_MALISON)
  RESPONSE #30
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),SPECTATOR_SUGGESTION)
  RESPONSE #25
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),BEHOLDER_SLOW)
  RESPONSE #15
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),WIZARD_RAY_OF_ENFEEBLEMENT)
  RESPONSE #10
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),ENEMY_SUMMON_GHAST)
  RESPONSE #10
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),SUMMON_SHADOW)
  RESPONSE #95
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
END

IF
  ActionListEmpty()
  General(Myself,UNDEAD)
  !Race(Myself,ELEMENTAL)
  !Race(Myself,SHADOW)
  !Race(Myself,ZOMBIE)
  !Class(Myself,SKELETON)
  !Race(Myself,WRAITH)
  !Race(Myself,MIST)
  !Race(Myself,SPECTRE)
  !GlobalTimerNotExpired("DEAD","LOCALS")
  GlobalLT("UDEAD","LOCALS",2)
  !StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
  LevelGT(Myself,15)
  RandomNumLT(125,63)
THEN
  RESPONSE #55
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),CLERIC_UNHOLY_WORD)
  RESPONSE #30
    SetGlobalTimer("DEAD","LOCALS",FOUR_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),CLERIC_ANIMATE_DEAD)
    ReallyForceSpell(LastSeenBy(Myself),CLERIC_ANIMATE_DEAD)
  RESPONSE #25
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(LastSeenBy(Myself),WIZARD_FEEBLEMIND)
  RESPONSE #15
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
    IncrementGlobal("UDEAD","LOCALS",1)
    ReallyForceSpell(Myself,WIZARD_WAIL_OF_THE_BANSHEE)
  RESPONSE #95
    SetGlobalTimer("DEAD","LOCALS",THREE_ROUNDS)
END

IF
  ActionListEmpty()
  OR(2)
    Race(Myself,SPIDER)
    Race(Myself,161)
  HPGT(Myself,30)
  !GlobalTimerNotExpired("SPID","LOCALS")
  !StateCheck(LastSeenBy(Myself),STATE_IMPROVEDINVISIBILITY)
  !StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
  CheckStat(LastSeenBy(Myself),0,WEB)
  GlobalLT("SprayBottle","LOCALS",3)
  RandomNumLT(128,65)
THEN
  RESPONSE #60
    SetGlobalTimer("SPID","LOCALS",TWO_ROUNDS)
  RESPONSE #60
    SetGlobalTimer("SPID","LOCALS",FIVE_ROUNDS)
    IncrementGlobal("SprayBottle","LOCALS",1)
    ChangeClass(Myself,MAGE)
    ReallyForceSpell(LastSeenBy(Myself),WIZARD_WEB)
  RESPONSE #40
    SetGlobalTimer("SPID","LOCALS",THREE_ROUNDS)
    IncrementGlobal("SprayBottle","LOCALS",1)
    ChangeClass(Myself,MAGE)
    ReallyForceSpell(LastSeenBy(Myself),WIZARD_WEB)
  RESPONSE #20
    SetGlobalTimer("SPID","LOCALS",TWO_ROUNDS)
    IncrementGlobal("SprayBottle","LOCALS",1)
END


IF
  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)
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  RandomNumLT(32,25)
  OR(3)
    Heard(ThirdNearestMyGroupOfType([EVILCUTOFF]),124)
    Heard(SecondNearestMyGroupOfType([EVILCUTOFF]),124)
    Heard(NearestMyGroupOfType([EVILCUTOFF]),124)
  HPGT(LastHeardBy(Myself),1)
  Range(LastHeardBy(Myself),20)
  Exists(LastAttackerOf(LastHeardBy(Myself)))
  !Allegiance(LastAttackerOf(LastHeardBy(Myself)),EVILCUTOFF)
  !StateCheck(LastAttackerOf(LastHeardBy(Myself)),STATE_CHARMED)
  OR(3)
    !Race(LastAttackerOf(LastHeardBy(Myself)),MORNINGSTAR)
    !Class(LastAttackerOf(LastHeardBy(Myself)),FAIRY_NYMPH)
    !Specifics(LastAttackerOf(LastHeardBy(Myself)),65)
  OR(3)  
    !StateCheck(LastAttackerOf(LastHeardBy(Myself)),0x00400010)
    CheckStatGT(Myself,0,SEEINVISIBLE)
    CheckStatGT(Myself,0,118)
  See(LastAttackerOf(LastHeardBy(Myself)))
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  RandomNumLT(33,13)
  HitBy([0],0x0000)
  !Allegiance(LastHitter(Myself),EVILCUTOFF)
  !StateCheck(LastHitter(Myself),STATE_CHARMED)
  OR(3)
    !Race(LastHitter(Myself),MORNINGSTAR)
    !Class(LastHitter(Myself),FAIRY_NYMPH)
    !Specifics(LastHitter(Myself),65)
  OR(3)  
    !StateCheck(LastHitter(Myself),0x00400010)
    CheckStatGT(Myself,0,SEEINVISIBLE)
    CheckStatGT(Myself,0,118)
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  RandomNumGT(33,22)
  AttackedBy([0],DEFAULT)
  !Allegiance(LastAttackerOf(Myself),EVILCUTOFF)
  !StateCheck(LastAttackerOf(Myself),STATE_CHARMED)
  OR(3)
    !Race(LastAttackerOf(Myself),MORNINGSTAR)
    !Class(LastAttackerOf(Myself),FAIRY_NYMPH)
    !Specifics(LastAttackerOf(Myself),65)
  OR(3)  
    !StateCheck(LastAttackerOf(Myself),0x00400010)
    CheckStatGT(Myself,0,SEEINVISIBLE)
    CheckStatGT(Myself,0,118)
  See(LastAttackerOf(Myself))
  False()
THEN
  RESPONSE #100
    Continue()
END


IF
  ActionListEmpty()
  !GlobalTimerNotExpired("BPW","LOCALS")
  OR(2)
    General(Myself,GIANTHUMANOID)
    General(Myself,HUMANOID)
  CheckStatGT(Myself,7,INT)
  HPPercentLT(Myself,25)
  Range(LastHitter(Myself),10)
  OR(3)
    !Race(LastHitter(Myself),MORNINGSTAR)
    !Class(LastHitter(Myself),FAIRY_NYMPH)
    !Specifics(LastHitter(Myself),65)
THEN
  RESPONSE #30
    DisplayStringHead(Myself,49767)  // ~No more~
    Shout(124)
    SetGlobalTimer("BPW","LOCALS",10)
    RunAwayFrom(LastHitter(Myself),40)
  RESPONSE #30
    DisplayStringHead(Myself,49765)  // ~Slay my attacker!~
    Shout(124)
    SetGlobalTimer("BPW","LOCALS",10)
    AttackReevaluate(LastHitter(Myself),15)
  RESPONSE #40
    DisplayStringHead(Myself,49766)  // ~I can't take this~
    Shout(123)
    SetGlobalTimer("BPW","LOCALS",10)
    AttackReevaluate(LastSeenBy(Myself),15)
  RESPONSE #25
    DisplayStringHead(Myself,@8)
    SetGlobalTimer("BPW","LOCALS",10)
    Attack(LastHitter(Myself))
END

IF
  ActionListEmpty()
  !GlobalTimerNotExpired("BPW","LOCALS")
  !General(Myself,GIANTHUMANOID)
  !General(Myself,HUMANOID)
  CheckStatGT(Myself,7,INT)
  HPPercentLT(Myself,25)
  Range(LastHitter(Myself),10)
  OR(3)
    !Race(LastHitter(Myself),MORNINGSTAR)
    !Class(LastHitter(Myself),FAIRY_NYMPH)
    !Specifics(LastHitter(Myself),65)
THEN
  RESPONSE #30
    DisplayStringHead(Myself,@9)
    Shout(124)
    SetGlobalTimer("BPW","LOCALS",10)
    RunAwayFrom(LastHitter(Myself),40)
  RESPONSE #30
    DisplayStringHead(Myself,@10)
    Shout(124)
    SetGlobalTimer("BPW","LOCALS",10)
    AttackReevaluate(LastHitter(Myself),15)
  RESPONSE #25
    DisplayStringHead(Myself,@11)
    SetGlobalTimer("BPW","LOCALS",10)
    Attack(LastHitter(Myself))
END

IF
  ActionListEmpty()
  CheckStatGT(LastSeenBy(Myself),10,180)
  CheckStatLT(Myself,11,180)
  GlobalLT("BOW","LOCALS",2)
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)
  GlobalLT("BOW","LOCALS",2)
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)
  OR(3)
    !Race(NearestEnemyOf(Myself),MORNINGSTAR)
    !Class(NearestEnemyOf(Myself),FAIRY_NYMPH)
    !Specifics(NearestEnemyOf(Myself),65)
THEN
  RESPONSE #90
    EquipMostDamagingMelee()
    AttackOneRound(NearestEnemyOf(Myself))
  RESPONSE #90
    EquipMostDamagingMelee()
    AttackOneRound(NearestEnemyOf(Myself))
    AttackOneRound(NearestEnemyOf(Myself))
END

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

IF
  Global("BPSC","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal("BPSC","LOCALS",1)
END

