IF
  Die()
  Global("agaenemy","GLOBAL",1)
THEN
  RESPONSE #100
    SetGlobal("agaenemy","GLOBAL",0)
END

IF
  OR(2)
    Dead("agaurora")
    Exists("agaurora")
THEN
  RESPONSE #100
    DestroySelf()
END

IF
  Global("agamorph","LOCALS",0)
  Global("ag_aslface","LOCALS",1)
THEN
  RESPONSE #100
    Face(10)
    SetGlobal("ag_aslface","LOCALS",0)    
END

IF
  !StateCheck(Myself,STATE_CHARMED)
  Global("agtenemy","GLOBAL",1)
  !Global("agaenemy","GLOBAL",1)
THEN
  RESPONSE #100
    SetGlobal("agaenemy","GLOBAL",1)
    Enemy()
END

IF
  !Allegiance(Myself,ENEMY)
  !StateCheck(Myself,STATE_CHARMED)
  Global("agaenemy","GLOBAL",1)
THEN
  RESPONSE #100
    Enemy()
END

IF
  OnCreation()
  !TimeLT(6)
  !TimeGT(21)
THEN
  RESPONSE #100
    SetGlobal("agaslinv","LOCALS",1)
    Deactivate(Myself)
END

//Aurora appears at night if not active
IF
  OR(2)
    TimeLT(6)
    TimeGT(21)
  Global("agaslinv","LOCALS",1)
THEN
  RESPONSE #100
    Activate(Myself)
    SetGlobal("agaslinv","LOCALS",0)
END

//Aurora disappears in the daytime
IF
  !TimeLT(6)
  !TimeGT(21)
  Global("agaslinv","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal("agaslinv","LOCALS",1)
    Deactivate(Myself)
END

IF
  HPPercentLT(Myself,10)
  Global("agamorph","LOCALS",1)
  !HasItem("potn52",Myself)
THEN
  RESPONSE #100
    EscapeArea()
END

IF
  HPPercentLT(Myself,50)
  !GlobalTimerNotExpired("agc","LOCALS")
  HasItem("potn52",Myself)
THEN
  RESPONSE #100
    UseItem("potn52",Myself)
    SetGlobalTimer("agc","LOCALS",6)
END

IF
  StateCheck(Myself,STATE_POISONED)
  !GlobalTimerNotExpired("agc","LOCALS")
  HasItem("potn20",Myself)
THEN
  RESPONSE #100
    UseItem("potn20",Myself)
    SetGlobalTimer("agc","LOCALS",6)
END

IF
  AttackedBy([GOODCUTOFF],DEFAULT)
  !Allegiance(Myself,ENEMY)
THEN
  RESPONSE #100
    SetGlobal("agaenemy","GLOBAL",1)
    Enemy()
END

IF
  OR(4)
    !Allegiance(Myself,ENEMY)
    !IsActive(Myself)
    StateCheck(Myself,STATE_INVISIBLE)
    StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
THEN
  RESPONSE #100
    NoAction()
END

IF
  Global("agamorph","LOCALS",0)
THEN
  RESPONSE #100
    Polymorph(FIGHTER_FEMALE_HUMAN)
    JumpToPoint([544.174])
    SetGlobal("agamorph","LOCALS",1)
END

IF
  !GlobalTimerNotExpired("agc","LOCALS")
  HasItem("potn11",Myself)
THEN
  RESPONSE #100
    UseItem("potn11",Myself)
    SetGlobalTimer("agc","LOCALS",6)
END

IF
  !GlobalGT("agasw","LOCALS",0)
  !GlobalTimerNotExpired("agc","LOCALS")
THEN
  RESPONSE #100
    SetGlobalTimer("agc","LOCALS",6)
    SetGlobal("agasw","LOCALS",1)
    Spell(Myself,4900)
END

IF
  !See([GOODCUTOFF.0.0.MAGE_ALL])
  !See([GOODCUTOFF.0.0.CLERIC_ALL])
  !See([GOODCUTOFF.0.0.DRUID_ALL])
  !See([GOODCUTOFF.0.0.BARD_ALL])
  !See([GOODCUTOFF])
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  GlobalTimerNotExpired("agc","LOCALS")
THEN
  RESPONSE #100
    AttackOneRound(LastSeenBy())
END

IF
  !GlobalTimerNotExpired("agc","LOCALS")
THEN
  RESPONSE #100
    Attack(LastSeenBy())
END
