IF

	Detect([PC])

	Global("Display","LOCALS",0)

THEN

	RESPONSE #100

		SetGlobal("Display","LOCALS",1)

		DisplayStringHead(Myself,@285) // Who calls Chan, Princess of Air!

    SetGlobalTimer("action_interruptible","locals",1)

    Continue()

END



IF

  HotKey(K)

  Global("scriptoff","locals",0)

THEN

  RESPONSE #100

    SetGlobal("scriptoff","locals",1)

    DisplayStringHead(Myself,@1)

END



IF

  HotKey(K)

  Global("scriptoff","locals",1)

THEN

  RESPONSE #100

    SetGlobal("scriptoff","locals",0)

    DisplayStringHead(Myself,@2)

END



IF

  Global("scriptoff","locals",1)

THEN

  RESPONSE #100

END



IF

  OR(2)

    ActionListEmpty()

    GlobalTimerNotExpired("action_interruptible","locals")

  !GlobalTimerNotExpired("cast","locals")

  HaveSpellRES("tg#sumc")

THEN

  RESPONSE #100

    SetGlobalTimer("cast","locals",ONE_ROUND)

    SpellRES("tg#sumc",NearestEnemyOf(Myself))  // ~Gate Elemental Minion: Air~

END



IF

  See(NearestEnemyOf(Myself))

  OR(2)

    !Exists(LastAttackerOf(Myself))

    !See(LastAttackerOf(Myself))

  OR(4)

    !Exists(NearestEnemyOf(Myself))

    !Class(NearestEnemyOf(Myself),LONG_BOW)

    !Class(NearestEnemyOf(Myself),SORCERER)

    !See(NearestEnemyOf(Myself))

  OR(4)

    !Exists(SecondNearestEnemyOf(Myself))

    !Class(SecondNearestEnemyOf(Myself),LONG_BOW)

    !Class(SecondNearestEnemyOf(Myself),SORCERER)

    !See(SecondNearestEnemyOf(Myself))

  OR(4)

    !Exists(NearestEnemyOf(Myself))

    !Class(NearestEnemyOf(Myself),CLERIC_ALL)

    !Class(NearestEnemyOf(Myself),DRUID_ALL)

    !See(NearestEnemyOf(Myself))

  OR(4)

    !Exists(SecondNearestEnemyOf(Myself))

    !Class(SecondNearestEnemyOf(Myself),CLERIC_ALL)

    !Class(SecondNearestEnemyOf(Myself),DRUID_ALL)

    !See(SecondNearestEnemyOf(Myself))

  See(NearestEnemyOf(Myself))

  False()

THEN

  RESPONSE #100

END



IF

    ActionListEmpty()

  OR(2)

    Allegiance(Myself,GOODCUTOFF)

    Allegiance(LastSeenBy(Myself),EVILCUTOFF)

  OR(2)

    Allegiance(Myself,EVILCUTOFF)

    Allegiance(LastSeenBy(Myself),GOODCUTOFF)

THEN

  RESPONSE #100

END



IF

  ActionListEmpty()

  GlobalTimerExpired("action_interruptible","locals")

  GlobalTimerNotExpired("cast","locals")

  CheckStatLT(LastSeenBy(Myself),3,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)

THEN

  RESPONSE #100

    SetGlobalTimer("action_interruptible","locals",1)

    AttackOneRound(LastSeenBy(Myself))

END



IF

OR(2)

    ActionListEmpty()

    GlobalTimerNotExpired("action_interruptible","locals")

  !GlobalTimerNotExpired("cast","locals")

  HaveSpellRES("ca#cwlw") //whirlwind

  CheckStatLT(LastSeenBy,75,RESISTMAGIC)

THEN

  RESPONSE #100

    SetGlobalTimer("cast","locals",ONE_ROUND)

    SpellRES("ca#cwlw",LastSeenBy(Myself))

END



IF

OR(2)

    ActionListEmpty()

    GlobalTimerNotExpired("action_interruptible","locals")

  !GlobalTimerNotExpired("cast","locals")

  HaveSpellRES("ca#cckil") //cloudkill

  CheckStatGT(LastSeenBy,5,SAVEVSSPELL)

  CheckStatLT(LastSeenBy,75,RESISTMAGIC)

  Range(LastSeenBy,7)

THEN

  RESPONSE #100

    SetGlobalTimer("cast","locals",ONE_ROUND)

    SpellRES("ca#cckil",Myself)

END



IF

OR(2)

    ActionListEmpty()

    GlobalTimerNotExpired("action_interruptible","locals")

  !GlobalTimerNotExpired("cast","locals")

  HaveSpellRES("ca#cstin") //stinking cloud

  CheckStatGT(LastSeenBy,5,SAVEVSSPELL)

  CheckStatLT(LastSeenBy,75,RESISTMAGIC)

  Range(LastSeenBy,7)

THEN

  RESPONSE #100

    SetGlobalTimer("cast","locals",ONE_ROUND)

    SpellRES("ca#cstin",Myself)

END



IF

  ActionListEmpty()

  GlobalTimerExpired("action_interruptible","locals")

  GlobalTimerExpired("cast","locals")

  CheckStatLT(LastSeenBy(Myself),3,WIZARD_PROTECTION_FROM_MAGIC_WEAPONS)

THEN

  RESPONSE #100

    SetGlobalTimer("action_interruptible","locals",1)

    AttackOneRound(LastSeenBy(Myself))

END





