IF
  HPLT(Myself,20)
  Global("DeathScriptIlla","AR6200",0)
THEN
  RESPONSE #100
    SetInterrupt(FALSE)
    SetGlobal("DeathScriptIlla","AR6200",1)
    ClearActions(Myself)
    CreateVisualEffectObject("ICRMPARI",Myself)
    CreateVisualEffectObject("SPROTECT",Myself)
    ActionOverride("finmel01",ClearActions(Myself))
    ActionOverride("finmel01",DestroyItem("finilla"))  // <Invalid Strref -1>
    ReallyForceSpellDeadRES("melspl10","finmel01")
    Kill(Myself)
END

IF
  Global("IMPRISON","LOCALS",1)
  Global("IllaseraImprisoned","AR6200",0)
THEN
  RESPONSE #100
    ClearActions(Myself)
    SetInterrupt(FALSE)
    SetGlobal("IMPRISON","LOCALS",0)
    SetGlobal("IllaseraImprisoned","AR6200",1)
    DisplayStringHead(Myself,46151)  // ~help!~
    SetInterrupt(TRUE)
END

IF
  Global("CloseCombat","LOCALS",1)
  GlobalTimerExpired("attacked","LOCALS")
THEN
  RESPONSE #100
    SetGlobal("CloseCombat","LOCALS",0)
    SetGlobalTimer("SafeForAWhile","LOCALS",6)
END

IF
  Global("CloseCombat","LOCALS",0)
  Global("safe","LOCALS",0)
  GlobalTimerExpired("SafeForAWhile","LOCALS")
THEN
  RESPONSE #100
    SetGlobal("safe","LOCALS",1)
END

IF
  Global("CloseCombat","LOCALS",0)
  OR(2)
    HitBy([ANYONE],CRUSHING)
    AttackedBy([ANYONE],DEFAULT)
  Range(NearestEnemyOf(Myself),8)
THEN
  RESPONSE #100
    SetGlobal("CloseCombat","LOCALS",1)
    SetGlobal("safe","LOCALS",0)
    SetGlobalTimer("attacked","LOCALS",5)
END

IF
  Allegiance(Myself,ENEMY)
  See([GOODCUTOFF.0.0.MAGE_ALL])
  !GlobalTimerNotExpired("InitialTactic","LOCALS")
THEN
  RESPONSE #100
    SetGlobalTimer("InitialTactic","LOCALS",1000)
    SetGlobalTimer("Ethereal","LOCALS",24)
    SetGlobalTimer("invis","LOCALS",5)
    ForceSpellRES("illainv",Myself)  // ~Ethereal~
END

IF
  HPPercentLT(Myself,50)
  HaveSpell(CLERIC_CURE_CRITICAL_WOUNDS)
  StateCheck(Myself,STATE_INVISIBLE)
  !GlobalTimerNotExpired("Spell","LOCALS")
  !Difficulty(EASIEST)
THEN
  RESPONSE #100
    SetGlobalTimer("Spell","LOCALS",6)
    RemoveSpell(CLERIC_CURE_CRITICAL_WOUNDS)
    ForceSpell(Myself,CLERIC_CURE_CRITICAL_WOUNDS)
  RESPONSE #100
    SetGlobalTimer("Spell","LOCALS",6)
    Spell(Myself,CLERIC_CURE_CRITICAL_WOUNDS)
END

IF
  HPPercentLT(Myself,50)
  !GlobalTimerNotExpired("Spell","LOCALS")
  HasItem("POTN55",Myself)  // ~Potion of Superior Healing~
  OR(2)
    StateCheck(Myself,STATE_INVISIBLE)
    !Range(NearestEnemyOf(Myself),12)
THEN
  RESPONSE #100
    SetGlobalTimer("Spell","LOCALS",6)
    DisplayStringHead(Myself,46150)  // ~quaffs a potion~
    UseItem("POTN55",Myself)  // ~Potion of Superior Healing~
END

IF
  Allegiance(Myself,ENEMY)
  CheckStatLT(Myself,40,RESISTCRUSHING)
  !StateCheck(Myself,STATE_INVISIBLE)
  OR(2)
    HPPercentLT(Myself,100)
    Range(NearestEnemyOf(Myself),8)
  !GlobalTimerNotExpired("Spell","LOCALS")
  HaveSpellRES("SPCL907")
THEN
  RESPONSE #100
    SetGlobalTimer("Spell","LOCALS",6)
    SpellRES("SPCL907",Myself)  // ~Hardiness~
END

IF
  Allegiance(Myself,ENEMY)
  HaveSpellRES("SPCL900")
  HasItemEquiped("SW2H12",Myself)
  !GlobalTimerNotExpired("Spell","LOCALS")
  !StateCheck(Myself,STATE_INVISIBLE)
THEN
  RESPONSE #100
    SetGlobalTimer("Spell","LOCALS",6)
    SpellRES("SPCL900",Myself)  // ~Whirlwind Attack~
END

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

IF
  Global("CloseAttack","LOCALS",1)
  Range(NearestEnemyOf(Myself),8)
  Range(SecondNearestEnemyOf(Myself),8)
THEN
  RESPONSE #100
    SetGlobal("BecomeEthereal","LOCALS",1)
    Continue()
END

IF
  Range(NearestEnemyOf(Myself),8)
  OR(2)
    CheckStatGT(NearestEnemyOf(Myself),4,NUMBEROFATTACKS)
    StateCheck(NearestEnemyOf(Myself),STATE_HASTED)
THEN
  RESPONSE #100
    SetGlobal("BecomeEthereal","LOCALS",1)
    Continue()
END

IF
  HPPercentLT(Myself,50)
  Range(NearestEnemyOf(Myself),12)
THEN
  RESPONSE #100
    SetGlobal("BecomeEthereal","LOCALS",1)
    Continue()
  RESPONSE #100
    Continue()
END

IF
  OR(2)
    CheckStatLT(Myself,50,RESISTMAGIC)
    CheckStatGT(Myself,0,180)
THEN
  RESPONSE #100
    SetGlobal("BecomeEthereal","LOCALS",1)
    Continue()
  RESPONSE #200
    Continue()
END

IF
  Allegiance(Myself,GOODCUTOFF)
  !StateCheck([EVILCUTOFF.0.0.MAGE_ALL],STATE_SILENCED)
  !StateCheck([EVILCUTOFF.0.0.MAGE_ALL],STATE_STUNNED)
  !StateCheck([EVILCUTOFF.0.0.MAGE_ALL],STATE_PANIC)
  !StateCheck([EVILCUTOFF.0.0.MAGE_ALL],STATE_SLEEPING)
  CheckStatLT([EVILCUTOFF.0.0.MAGE_ALL],40,SPELLFAILUREMAGE)
  HPGT([EVILCUTOFF.0.0.MAGE_ALL],0)
  See([EVILCUTOFF.0.0.MAGE_ALL])
THEN
  RESPONSE #100
    SetGlobal("BecomeEthereal","LOCALS",1)
    Continue()
  RESPONSE #300
    Continue()
END

IF
  Allegiance(Myself,EVILCUTOFF)
  !StateCheck([GOODCUTOFF.0.0.MAGE_ALL],STATE_SILENCED)
  !StateCheck([GOODCUTOFF.0.0.MAGE_ALL],STATE_STUNNED)
  !StateCheck([GOODCUTOFF.0.0.MAGE_ALL],STATE_PANIC)
  !StateCheck([GOODCUTOFF.0.0.MAGE_ALL],STATE_SLEEPING)
  CheckStatLT([GOODCUTOFF.0.0.MAGE_ALL],40,SPELLFAILUREMAGE)
  HPGT([GOODCUTOFF.0.0.MAGE_ALL],0)
  See([GOODCUTOFF.0.0.MAGE_ALL])
THEN
  RESPONSE #100
    SetGlobal("BecomeEthereal","LOCALS",1)
    Continue()
  RESPONSE #300
    Continue()
END

IF
  !StateCheck(Myself,STATE_INVISIBLE)
  !StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
  Global("BecomeEthereal","LOCALS",1)
  !GlobalTimerNotExpired("Ethereal","LOCALS")
  DifficultyGT(EASY)
THEN
  RESPONSE #100
    SetGlobalTimer("Ethereal","LOCALS",24)
    SetGlobalTimer("invis","LOCALS",5)
    ForceSpellRES("illainv",Myself)  // ~Ethereal~
END

IF
  !StateCheck(Myself,STATE_INVISIBLE)
  !StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
  Global("BecomeEthereal","LOCALS",1)
  !GlobalTimerNotExpired("Ethereal","LOCALS")
  Difficulty(EASY)
THEN
  RESPONSE #100
    SetGlobalTimer("Ethereal","LOCALS",30)
    SetGlobalTimer("invis","LOCALS",5)
    ForceSpellRES("illainv",Myself)  // ~Ethereal~
END

IF
  !StateCheck(Myself,STATE_INVISIBLE)
  !StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
  Global("BecomeEthereal","LOCALS",1)
  !GlobalTimerNotExpired("Ethereal","LOCALS")
  Difficulty(EASIEST)
THEN
  RESPONSE #100
    SetGlobalTimer("Ethereal","LOCALS",45)
    SetGlobalTimer("invis","LOCALS",5)
    ForceSpellRES("illainv",Myself)  // ~Ethereal~
END

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

IF
  OR(2)
    !GlobalTimerNotExpired("invis","LOCALS")
    !StateCheck(Myself,STATE_INVISIBLE)
  OR(3)
    StateCheck("finyaga",STATE_SLOWED)  // ~Yaga-Shura~
    StateCheck("finyaga",STATE_STUNNED)  // ~Yaga-Shura~
    StateCheck("finyaga",STATE_CONFUSED)  // ~Yaga-Shura~
  HPPercentGT("finyaga",75)  // ~Yaga-Shura~
  Global("safe","LOCALS",1)
  RandomNum(2,1)
  See("finyaga")  // ~Yaga-Shura~
THEN
  RESPONSE #100
    SetGlobalTimer("xyxAttack","LOCALS",2)
    SetGlobal("xyxManeuvered","LOCALS",0)
    SelectWeaponAbility(SLOT_WEAPON0,0)
    AttackOneRound("finyaga")
END

IF
  OR(2)
    !GlobalTimerNotExpired("invis","LOCALS")
    !StateCheck(Myself,STATE_INVISIBLE)
  OR(3)
    StateCheck("finabaz",STATE_SLOWED)  // ~Abazigal~
    StateCheck("finabaz",STATE_STUNNED)  // ~Abazigal~
    StateCheck("finabaz",STATE_CONFUSED)  // ~Abazigal~
  HPPercentGT("finabaz",75)  // ~Abazigal~
  Global("safe","LOCALS",1)
  RandomNum(2,1)
  See("finabaz")  // ~Abazigal~
THEN
  RESPONSE #100
    SetGlobalTimer("xyxAttack","LOCALS",2)
    SetGlobal("xyxManeuvered","LOCALS",0)
    SelectWeaponAbility(SLOT_WEAPON0,0)
    AttackOneRound("finabaz")
END

IF
  OR(2)
    See(SixthNearestEnemyOf(Myself))
    See(Player1)
  False()
THEN
  RESPONSE #100
END

IF
  !StateCheck([GOODCUTOFF.0.0.BARD_ALL],STATE_SILENCED)
  !StateCheck([GOODCUTOFF.0.0.BARD_ALL],STATE_STUNNED)
  !StateCheck([GOODCUTOFF.0.0.BARD_ALL],STATE_PANIC)
  !StateCheck([GOODCUTOFF.0.0.BARD_ALL],STATE_SLEEPING)
  CheckStatLT([GOODCUTOFF.0.0.BARD_ALL],40,SPELLFAILUREMAGE)
  See([GOODCUTOFF.0.0.BARD_ALL])
  False()
THEN
  RESPONSE #100
END

IF
  !StateCheck([GOODCUTOFF.0.0.DRUID_ALL],STATE_SILENCED)
  !StateCheck([GOODCUTOFF.0.0.DRUID_ALL],STATE_STUNNED)
  !StateCheck([GOODCUTOFF.0.0.DRUID_ALL],STATE_PANIC)
  !StateCheck([GOODCUTOFF.0.0.DRUID_ALL],STATE_SLEEPING)
  CheckStatLT([GOODCUTOFF.0.0.DRUID_ALL],40,SPELLFAILUREPRIEST)
  See([GOODCUTOFF.0.0.DRUID_ALL])
  False()
THEN
  RESPONSE #100
END

IF
  !StateCheck(SecondNearest([GOODCUTOFF.0.0.CLERIC_ALL]),STATE_SILENCED)
  !StateCheck(SecondNearest([GOODCUTOFF.0.0.CLERIC_ALL]),STATE_STUNNED)
  !StateCheck(SecondNearest([GOODCUTOFF.0.0.CLERIC_ALL]),STATE_PANIC)
  !StateCheck(SecondNearest([GOODCUTOFF.0.0.CLERIC_ALL]),STATE_SLEEPING)
  CheckStatLT(SecondNearest([GOODCUTOFF.0.0.CLERIC_ALL]),40,SPELLFAILUREPRIEST)
  See(SecondNearest([GOODCUTOFF.0.0.CLERIC_ALL]))
  False()
THEN
  RESPONSE #100
END

IF
  !StateCheck([GOODCUTOFF.0.0.CLERIC_ALL],STATE_SILENCED)
  !StateCheck([GOODCUTOFF.0.0.CLERIC_ALL],STATE_STUNNED)
  !StateCheck([GOODCUTOFF.0.0.CLERIC_ALL],STATE_PANIC)
  !StateCheck([GOODCUTOFF.0.0.CLERIC_ALL],STATE_SLEEPING)
  CheckStatLT([GOODCUTOFF.0.0.CLERIC_ALL],40,SPELLFAILUREPRIEST)
  See([GOODCUTOFF.0.0.CLERIC_ALL])
  False()
THEN
  RESPONSE #100
END

IF
  !StateCheck(SecondNearest([GOODCUTOFF.0.0.MAGE_ALL]),STATE_SILENCED)
  !StateCheck(SecondNearest([GOODCUTOFF.0.0.MAGE_ALL]),STATE_STUNNED)
  !StateCheck(SecondNearest([GOODCUTOFF.0.0.MAGE_ALL]),STATE_PANIC)
  !StateCheck(SecondNearest([GOODCUTOFF.0.0.MAGE_ALL]),STATE_SLEEPING)
  CheckStatLT(SecondNearest([GOODCUTOFF.0.0.MAGE_ALL]),40,SPELLFAILUREMAGE)
  See(SecondNearest([GOODCUTOFF.0.0.MAGE_ALL]))
  False()
THEN
  RESPONSE #100
END

IF
  !StateCheck([GOODCUTOFF.0.0.MAGE_ALL],STATE_SILENCED)
  !StateCheck([GOODCUTOFF.0.0.MAGE_ALL],STATE_STUNNED)
  !StateCheck([GOODCUTOFF.0.0.MAGE_ALL],STATE_PANIC)
  !StateCheck([GOODCUTOFF.0.0.MAGE_ALL],STATE_SLEEPING)
  CheckStatLT([GOODCUTOFF.0.0.MAGE_ALL],40,SPELLFAILUREMAGE)
  See([GOODCUTOFF.0.0.MAGE_ALL])
  False()
THEN
  RESPONSE #100
END

IF
  HPPercentLT("finabaz",50)  // ~Abazigal~
  !Dead("finabaz")  // ~Abazigal~
  RandomNum(3,1)
  See(LastAttackerOf("finabaz"))  // ~Abazigal~
  False()
THEN
  RESPONSE #100
END

IF
  HPPercentLT("finyaga",50)  // ~Yaga-Shura~
  !Dead("finyaga")  // ~Yaga-Shura~
  RandomNum(3,1)
  See(LastAttackerOf("finyaga"))  // ~Yaga-Shura~
  False()
THEN
  RESPONSE #100
END

IF
  HPPercentLT("finsend",50)  // ~Sendai~
  !Dead("finsend")  // ~Sendai~
  RandomNum(2,1)
  See(LastAttackerOf("finsend"))  // ~Sendai~
  False()
THEN
  RESPONSE #100
END

IF
  HPPercentGT([GOODCUTOFF.0.0.0.0.SUMMONED],25)
  LevelGT([GOODCUTOFF.0.0.0.0.SUMMONED],6)
  See([GOODCUTOFF.0.0.0.0.SUMMONED])
  False()
THEN
  RESPONSE #100
END

IF
  !HasItemEquiped("SHLD24",SixthNearestEnemyOf(Myself))
  !CheckStatGT(SixthNearestEnemyOf(Myself),0,122)
  !CheckStatGT(SixthNearestEnemyOf(Myself),0,128)
  OR(2)
    !Gender(SixthNearestEnemyOf(Myself),SUMMONED)
    LevelGT(SixthNearestEnemyOf(Myself),9)
  OR(3)
    CheckStatGT(SixthNearestEnemyOf(Myself),-5,ARMORCLASS)
    StateCheck(SixthNearestEnemyOf(Myself),STATE_STUNNED)
    HPPercentLT(SixthNearestEnemyOf(Myself),25)
  !CheckStatLT(SixthNearestEnemyOf(Myself),-9,ARMORCLASS)
  See(SixthNearestEnemyOf(Myself))
  False()
THEN
  RESPONSE #100
END

IF
  !HasItemEquiped("SHLD24",ThirdNearestEnemyOf(Myself))
  !CheckStatGT(ThirdNearestEnemyOf(Myself),0,122)
  !CheckStatGT(ThirdNearestEnemyOf(Myself),0,128)
  OR(2)
    !Gender(ThirdNearestEnemyOf(Myself),SUMMONED)
    LevelGT(ThirdNearestEnemyOf(Myself),9)
  OR(3)
    CheckStatGT(ThirdNearestEnemyOf(Myself),-5,ARMORCLASS)
    StateCheck(ThirdNearestEnemyOf(Myself),STATE_STUNNED)
    HPPercentLT(ThirdNearestEnemyOf(Myself),25)
  !CheckStatLT(ThirdNearestEnemyOf(Myself),-9,ARMORCLASS)
  See(ThirdNearestEnemyOf(Myself))
  False()
THEN
  RESPONSE #100
END

IF
  !HasItemEquiped("SHLD24",NearestEnemyOf(Myself))
  !CheckStatGT(NearestEnemyOf(Myself),0,122)
  !CheckStatGT(NearestEnemyOf(Myself),0,128)
  OR(2)
    !Gender(NearestEnemyOf(Myself),SUMMONED)
    LevelGT(NearestEnemyOf(Myself),9)
  OR(3)
    CheckStatGT(NearestEnemyOf(Myself),-5,ARMORCLASS)
    StateCheck(NearestEnemyOf(Myself),STATE_STUNNED)
    HPPercentLT(NearestEnemyOf(Myself),25)
  !CheckStatLT(NearestEnemyOf(Myself),-9,ARMORCLASS)
  See(NearestEnemyOf(Myself))
  False()
THEN
  RESPONSE #100
END

IF
  Range(LastAttackerOf(Myself),8)
  HPGT(LastAttackerOf(Myself),0)
  Global("CloseCombat","LOCALS",1)
  !StateCheck(LastAttackerOf(Myself),STATE_PANIC)
  !StateCheck(LastAttackerOf(Myself),STATE_STUNNED)
  !StateCheck(LastAttackerOf(Myself),STATE_HELPLESS)
  !StateCheck(LastAttackerOf(Myself),STATE_SLEEPING)
  OR(2)
    HasItemEquiped("SHLD24",LastAttackerOf(Myself))
    CheckStatGT(LastAttackerOf(Myself),0,122)
  See(LastAttackerOf(Myself))
  False()
THEN
  RESPONSE #100
END

IF
  Range(SecondNearestEnemyOf(Myself),8)
  !HasItemEquiped("SHLD24",SecondNearestEnemyOf(Myself))
  !CheckStatGT(SecondNearestEnemyOf(Myself),0,122)
  CheckStatGT(SecondNearestEnemyOf(Myself),4,NUMBEROFATTACKS)
  !StateCheck(SecondNearestEnemyOf(Myself),STATE_PANIC)
  !StateCheck(SecondNearestEnemyOf(Myself),STATE_STUNNED)
  !StateCheck(SecondNearestEnemyOf(Myself),STATE_HELPLESS)
  !StateCheck(SecondNearestEnemyOf(Myself),STATE_SLEEPING)
  See(SecondNearestEnemyOf(Myself))
  False()
THEN
  RESPONSE #100
END

IF
  Range(NearestEnemyOf(Myself),8)
  !HasItemEquiped("SHLD24",NearestEnemyOf(Myself))
  !CheckStatGT(NearestEnemyOf(Myself),0,122)
  CheckStatGT(NearestEnemyOf(Myself),4,NUMBEROFATTACKS)
  !StateCheck(NearestEnemyOf(Myself),STATE_PANIC)
  !StateCheck(NearestEnemyOf(Myself),STATE_STUNNED)
  !StateCheck(NearestEnemyOf(Myself),STATE_HELPLESS)
  !StateCheck(NearestEnemyOf(Myself),STATE_SLEEPING)
  See(NearestEnemyOf(Myself))
  False()
THEN
  RESPONSE #100
END

IF
  Allegiance(LastSeenBy(Myself),EVILCUTOFF)
  See([GOODCUTOFF])
THEN
  RESPONSE #100
    MoveToObject([GOODCUTOFF])
END

IF
  OR(2)
    !Allegiance(LastSeenBy(Myself),GOODCUTOFF)
    !See([GOODCUTOFF])
THEN
  RESPONSE #100
    MoveToObject(Player1)
END

IF
  StateCheck(LastSeenBy(Myself),STATE_DEAD)
  See(NearestEnemyOf(Myself))
THEN
  RESPONSE #100
    AttackOneRound(NearestEnemyOf(Myself))
END

IF
  StateCheck(LastSeenBy(Myself),STATE_DEAD)
  !See(NearestEnemyOf(Myself))
THEN
  RESPONSE #100
    MoveToObject(Player1)
END

IF
  OR(2)
    !GlobalTimerNotExpired("invis","LOCALS")
    !StateCheck(Myself,STATE_INVISIBLE)
  OR(2)
    Gender(LastSeenBy(Myself),SUMMONED)
    Gender(LastSeenBy(Myself),ILLUSIONARY)
THEN
  RESPONSE #100
    SelectWeaponAbility(SLOT_WEAPON0,0)
    AttackOneRound(LastSeenBy(Myself))
  RESPONSE #50
    Continue()
END

IF
  OR(2)
    !GlobalTimerNotExpired("invis","LOCALS")
    !StateCheck(Myself,STATE_INVISIBLE)
  Range(LastSeenBy(Myself),8)
  !HasItemEquiped("shld24",LastSeenBy(Myself))
  !CheckStatGT(LastSeenBy(Myself),0,122)
THEN
  RESPONSE #100
    SelectWeaponAbility(SLOT_WEAPON2,0)
    AttackOneRound(LastSeenBy(Myself))
  RESPONSE #50
    Continue()
END

IF
  !Range(LastSeenBy(Myself),8)
  !HasItemEquiped("shld24",LastSeenBy(Myself))
  !CheckStatGT(LastSeenBy(Myself),0,122)
  OR(2)
    !GlobalTimerNotExpired("invis","LOCALS")
    !StateCheck(Myself,STATE_INVISIBLE)
  OR(2)
    Class(LastSeenBy(Myself),LONG_BOW)
    Class(LastSeenBy(Myself),BARD_ALL)
  OR(6)
    CheckStatGT(LastSeenBy(Myself),0,STONESKINS)
    CheckStatGT(LastSeenBy(Myself),0,0)
    CheckStatGT(LastSeenBy(Myself),0,126)
    CheckStat(LastSeenBy(Myself),0,SPELLFAILUREMAGE)
    StateCheck(LastSeenBy(Myself),STATE_MIRRORIMAGE)
    CheckStatGT(LastSeenBy(Myself),0,IMPROVEDHASTE)
  !StateCheck(LastSeenBy(Myself),STATE_SLOWED)
  !StateCheck(LastSeenBy(Myself),STATE_STUNNED)
  !StateCheck(LastSeenBy(Myself),STATE_HELPLESS)
  !StateCheck(LastSeenBy(Myself),STATE_SLEEPING)
  !StateCheck(LastSeenBy(Myself),STATE_SILENCED)
  !StateCheck(LastSeenBy(Myself),STATE_CONFUSED)
  !StateCheck(LastSeenBy(Myself),STATE_CHARMED)
  !StateCheck(LastSeenBy(Myself),STATE_FEEBLEMINDED)
  !CheckStatGT(LastSeenBy(Myself),0,WEB)
  !CheckStatGT(LastSeenBy(Myself),0,ENTANGLE)
  !CheckStatGT(LastSeenBy(Myself),0,HELD)
  !CheckStatGT(LastSeenBy(Myself),0,GREASE)
THEN
  RESPONSE #100
    SelectWeaponAbility(SLOT_WEAPON0,0)
    AttackOneRound(LastSeenBy(Myself))
  RESPONSE #100
    Continue()
END

IF
  !Range(LastSeenBy(Myself),8)
  !HasItemEquiped("shld24",LastSeenBy(Myself))
  !CheckStatGT(LastSeenBy(Myself),0,122)
  OR(2)
    !GlobalTimerNotExpired("invis","LOCALS")
    !StateCheck(Myself,STATE_INVISIBLE)
  OR(2)
    Class(LastSeenBy(Myself),CLERIC_ALL)
    Class(LastSeenBy(Myself),DRUID_ALL)
  OR(4)
    CheckStatGT(LastSeenBy(Myself),0,STONESKINS)
    CheckStat(LastSeenBy(Myself),0,SPELLFAILUREPRIEST)
    StateCheck(LastSeenBy(Myself),STATE_DRAWUPONHOLYMIGHT)
    CheckStatGT(LastSeenBy(Myself),0,IMPROVEDHASTE)
  !StateCheck(LastSeenBy(Myself),STATE_SLOWED)
  !StateCheck(LastSeenBy(Myself),STATE_STUNNED)
  !StateCheck(LastSeenBy(Myself),STATE_HELPLESS)
  !StateCheck(LastSeenBy(Myself),STATE_SLEEPING)
  !StateCheck(LastSeenBy(Myself),STATE_SILENCED)
  !StateCheck(LastSeenBy(Myself),STATE_CONFUSED)
  !StateCheck(LastSeenBy(Myself),STATE_CHARMED)
  !StateCheck(LastSeenBy(Myself),STATE_FEEBLEMINDED)
  !CheckStatGT(LastSeenBy(Myself),0,WEB)
  !CheckStatGT(LastSeenBy(Myself),0,ENTANGLE)
  !CheckStatGT(LastSeenBy(Myself),0,HELD)
  !CheckStatGT(LastSeenBy(Myself),0,GREASE)
THEN
  RESPONSE #100
    SelectWeaponAbility(SLOT_WEAPON0,0)
    AttackOneRound(LastSeenBy(Myself))
  RESPONSE #100
    Continue()
END

IF
  !Range(LastSeenBy(Myself),8)
  !HasItemEquiped("shld24",LastSeenBy(Myself))
  !CheckStatGT(LastSeenBy(Myself),0,122)
  OR(2)
    !GlobalTimerNotExpired("invis","LOCALS")
    !StateCheck(Myself,STATE_INVISIBLE)
  OR(12)
    CheckStatGT(LastSeenBy(Myself),0,129)
    CheckStatGT(LastSeenBy(Myself),0,MINORGLOBE)
    CheckStatGT(LastSeenBy(Myself),0,116)
    CheckStatGT(LastSeenBy(Myself),0,164)
    CheckStatGT(LastSeenBy(Myself),0,177)
    CheckStatGT(LastSeenBy(Myself),0,162)
    CheckStatGT(LastSeenBy(Myself),0,117)
    CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE5)
    CheckStatGT(LastSeenBy(Myself),0,SCRIPTINGSTATE2)
    CheckStatGT(LastSeenBy(Myself),0,IMPROVEDHASTE)
    StateCheck(LastSeenBy(Myself),STATE_HASTED)
    StateCheck(LastSeenBy(Myself),0)
  !StateCheck(LastSeenBy(Myself),STATE_SLOWED)
  !StateCheck(LastSeenBy(Myself),STATE_STUNNED)
  !StateCheck(LastSeenBy(Myself),STATE_HELPLESS)
  !StateCheck(LastSeenBy(Myself),STATE_SLEEPING)
  !StateCheck(LastSeenBy(Myself),STATE_SILENCED)
  !StateCheck(LastSeenBy(Myself),STATE_CONFUSED)
  !StateCheck(LastSeenBy(Myself),STATE_CHARMED)
  !StateCheck(LastSeenBy(Myself),STATE_FEEBLEMINDED)
  !CheckStatGT(LastSeenBy(Myself),0,WEB)
  !CheckStatGT(LastSeenBy(Myself),0,ENTANGLE)
  !CheckStatGT(LastSeenBy(Myself),0,HELD)
  !CheckStatGT(LastSeenBy(Myself),0,GREASE)
THEN
  RESPONSE #100
    SelectWeaponAbility(SLOT_WEAPON0,0)
    AttackOneRound(LastSeenBy(Myself))
  RESPONSE #200
    Continue()
END

IF
  OR(2)
    !GlobalTimerNotExpired("invis","LOCALS")
    !StateCheck(Myself,STATE_INVISIBLE)
  HPPercentLT(Myself,50)
  !HasItemEquiped("shld24",LastSeenBy(Myself))
  !CheckStatGT(LastSeenBy(Myself),0,122)
THEN
  RESPONSE #100
    SelectWeaponAbility(SLOT_WEAPON1,0)
    AttackOneRound(LastSeenBy(Myself))
  RESPONSE #50
    Continue()
END

IF
  OR(2)
    !GlobalTimerNotExpired("invis","LOCALS")
    !StateCheck(Myself,STATE_INVISIBLE)
  !Range(LastSeenBy(Myself),8)
  !HasItemEquiped("shld24",LastSeenBy(Myself))
  !CheckStatGT(LastSeenBy(Myself),0,122)
THEN
  RESPONSE #100
    SelectWeaponAbility(SLOT_WEAPON2,0)
    AttackOneRound(LastSeenBy(Myself))
  RESPONSE #75
    SelectWeaponAbility(SLOT_WEAPON1,0)
    AttackOneRound(LastSeenBy(Myself))
  RESPONSE #25
    SelectWeaponAbility(SLOT_WEAPON0,0)
    AttackOneRound(LastSeenBy(Myself))
END

IF
  OR(2)
    !GlobalTimerNotExpired("invis","LOCALS")
    !StateCheck(Myself,STATE_INVISIBLE)
  Range(LastSeenBy(Myself),8)
  !HasItemEquiped("shld24",LastSeenBy(Myself))
  !CheckStatGT(LastSeenBy(Myself),0,122)
THEN
  RESPONSE #100
    SelectWeaponAbility(SLOT_WEAPON2,0)
    AttackOneRound(LastSeenBy(Myself))
  RESPONSE #50
    SelectWeaponAbility(SLOT_WEAPON1,0)
    AttackOneRound(LastSeenBy(Myself))
  RESPONSE #50
    SelectWeaponAbility(SLOT_WEAPON3,0)
    AttackOneRound(LastSeenBy(Myself))
END

IF
  Range(LastSeenBy(Myself),8)
  OR(2)
    HasItemEquiped("shld24",LastSeenBy(Myself))
    CheckStatGT(LastSeenBy(Myself),0,122)
THEN
  RESPONSE #100
    SelectWeaponAbility(SLOT_WEAPON3,0)
    AttackOneRound(LastSeenBy(Myself))
END

IF
  True()
THEN
  RESPONSE #100
    RandomWalkContinuous()
END

