IF
  See(NearestEnemyOf(Myself))
  Global("Prepare","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal("Prepare","LOCALS",1)
    DisplayString(Myself,39968)  // ~Spell Trigger - Fired~
    DisplayString(Myself,7570)  // ~Protection from Energy~
    ApplySpell(Myself,WIZARD_PROTECTION_FROM_ENERGY)
END

IF
  See(NearestEnemyOf(Myself))
  !GlobalTimerNotExpired("DemiLichHowl","LOCALS")
THEN
  RESPONSE #100
    SetGlobalTimer("DemiLichHowl","LOCALS",ONE_TURN)
    ReallyForceSpell(Myself,DEMILICH_DEATH)
END

IF
  See([GOODCUTOFF.0.0.0.0.SUMMONED])
  Global("summon","LOCALS",0)
THEN
  RESPONSE #100
    FaceObject(LastSeenBy(Myself))
    ReallyForceSpell(LastSeenBy(Myself),WIZARD_DEATH_SPELL)
    SetGlobal("summon","LOCALS",1)
END

IF
  See(NearestEnemyOf(Myself))
  !StateCheck(NearestEnemyOf(Myself),STATE_BERSERK)
  GlobalLT("BP_SoulTrap","LOCALS",8)
  RandomNum(6,1)
  !GlobalTimerNotExpired("TRAPSOUL","LOCALS")
THEN
  RESPONSE #100
    ForceSpell(NearestEnemyOf(Myself),DEMILICH_TRAP_SOUL)
    IncrementGlobal("BP_SoulTrap","LOCALS",1)
    SetGlobalTimer("TRAPSOUL","LOCALS",4)
END

IF
  See(SecondNearestEnemyOf(Myself))
  !StateCheck(SecondNearestEnemyOf(Myself),STATE_BERSERK)
  GlobalLT("BP_SoulTrap","LOCALS",8)
  RandomNum(6,2)
  !GlobalTimerNotExpired("TRAPSOUL","LOCALS")
THEN
  RESPONSE #100
    ForceSpell(SecondNearestEnemyOf(Myself),DEMILICH_TRAP_SOUL)
    IncrementGlobal("BP_SoulTrap","LOCALS",1)
    SetGlobalTimer("TRAPSOUL","LOCALS",4)
END

IF
  See(ThirdNearestEnemyOf(Myself))
  !StateCheck(ThirdNearestEnemyOf(Myself),STATE_BERSERK)
  GlobalLT("BP_SoulTrap","LOCALS",8)
  RandomNum(6,3)
  !GlobalTimerNotExpired("TRAPSOUL","LOCALS")
THEN
  RESPONSE #100
    ForceSpell(ThirdNearestEnemyOf(Myself),DEMILICH_TRAP_SOUL)
    IncrementGlobal("BP_SoulTrap","LOCALS",1)
    SetGlobalTimer("TRAPSOUL","LOCALS",4)
END

IF
  See(FourthNearestEnemyOf(Myself))
  !StateCheck(FourthNearestEnemyOf(Myself),STATE_BERSERK)
  GlobalLT("BP_SoulTrap","LOCALS",8)
  RandomNum(6,4)
  !GlobalTimerNotExpired("TRAPSOUL","LOCALS")
THEN
  RESPONSE #100
    ForceSpell(FourthNearestEnemyOf(Myself),DEMILICH_TRAP_SOUL)
    IncrementGlobal("BP_SoulTrap","LOCALS",1)
    SetGlobalTimer("TRAPSOUL","LOCALS",4)
END

IF
  See(FifthNearestEnemyOf(Myself))
  !StateCheck(FifthNearestEnemyOf(Myself),STATE_BERSERK)
  GlobalLT("BP_SoulTrap","LOCALS",8)
  RandomNum(6,5)
  !GlobalTimerNotExpired("TRAPSOUL","LOCALS")
THEN
  RESPONSE #100
    ForceSpell(FifthNearestEnemyOf(Myself),DEMILICH_TRAP_SOUL)
    IncrementGlobal("BP_SoulTrap","LOCALS",1)
    SetGlobalTimer("TRAPSOUL","LOCALS",4)
END

IF
  See(SixthNearestEnemyOf(Myself))
  !StateCheck(SixthNearestEnemyOf(Myself),STATE_BERSERK)
  GlobalLT("BP_SoulTrap","LOCALS",8)
  RandomNum(6,6)
  !GlobalTimerNotExpired("TRAPSOUL","LOCALS")
THEN
  RESPONSE #100
    ForceSpell(SixthNearestEnemyOf(Myself),DEMILICH_TRAP_SOUL)
    IncrementGlobal("BP_SoulTrap","LOCALS",1)
    SetGlobalTimer("TRAPSOUL","LOCALS",4)
END

IF
  See(NearestEnemyOf(Myself))
THEN
  RESPONSE #100
    AttackReevaluate(NearestEnemyOf(Myself),45)
END

