#include "x2_inc_itemprop"
void DrainMagic(object oPC)
{
   FloatingTextStringOnCreature("Your petty magicks are powerless against the Soul Gem!", GetFirstPC());
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_WILL_SAVING_THROW_USE), oPC);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_BREACH), oPC);
   // Bleach Armor
   object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
   object oCopy1 = CopyItemAndModify(oArmor, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH1, 166, TRUE);
   object oCopy2 = CopyItemAndModify(oCopy1, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH2, 166, TRUE);
   object oCopy3 = CopyItemAndModify(oCopy2, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER1, 166, TRUE);
   object oCopy4 = CopyItemAndModify(oCopy3, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER2, 166, TRUE);
   object oCopy5 = CopyItemAndModify(oCopy4, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL1, 164, TRUE);
   object oCopy6 = CopyItemAndModify(oCopy5, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL2, 164, TRUE);
   IPRemoveAllItemProperties(oCopy6, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oCopy6, DURATION_TYPE_TEMPORARY);
   AssignCommand(oPC, ActionEquipItem(oCopy6, INVENTORY_SLOT_CHEST));
   DestroyObject(oArmor, 0.0);
   DestroyObject(oCopy1, 0.0);
   DestroyObject(oCopy2, 0.0);
   DestroyObject(oCopy3, 0.0);
   DestroyObject(oCopy4, 0.0);
   DestroyObject(oCopy5, 0.0);
   // Bleach Helm
   object oHelm = GetItemInSlot(INVENTORY_SLOT_HEAD, oPC);
   oCopy1 = CopyItemAndModify(oHelm, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH1, 166, TRUE);
   oCopy2 = CopyItemAndModify(oCopy1, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_CLOTH2, 166, TRUE);
   oCopy3 = CopyItemAndModify(oCopy2, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER1, 166, TRUE);
   oCopy4 = CopyItemAndModify(oCopy3, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_LEATHER2, 166, TRUE);
   oCopy5 = CopyItemAndModify(oCopy4, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL1, 164, TRUE);
   oCopy6 = CopyItemAndModify(oCopy5, ITEM_APPR_TYPE_ARMOR_COLOR, ITEM_APPR_ARMOR_COLOR_METAL2, 164, TRUE);
   IPRemoveAllItemProperties(oCopy6, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oCopy6, DURATION_TYPE_TEMPORARY);
   AssignCommand(oPC, ActionEquipItem(oCopy6, INVENTORY_SLOT_HEAD));
   DestroyObject(oHelm, 0.0);
   DestroyObject(oCopy1, 0.0);
   DestroyObject(oCopy2, 0.0);
   DestroyObject(oCopy3, 0.0);
   DestroyObject(oCopy4, 0.0);
   DestroyObject(oCopy5, 0.0);
   // Remove magical properties from all equipped items
   object oArms = GetItemInSlot(INVENTORY_SLOT_ARMS, oPC);
   IPRemoveAllItemProperties(oArms, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oArms, DURATION_TYPE_TEMPORARY);
   object oArrows = GetItemInSlot(INVENTORY_SLOT_ARROWS, oPC);
   IPRemoveAllItemProperties(oArrows, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oArrows, DURATION_TYPE_TEMPORARY);
   object oBelt = GetItemInSlot(INVENTORY_SLOT_BELT, oPC);
   IPRemoveAllItemProperties(oBelt, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oBelt, DURATION_TYPE_TEMPORARY);
   object oBolts = GetItemInSlot(INVENTORY_SLOT_BOLTS, oPC);
   IPRemoveAllItemProperties(oBolts, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oBolts, DURATION_TYPE_TEMPORARY);
   object oBoots = GetItemInSlot(INVENTORY_SLOT_BOOTS, oPC);
   IPRemoveAllItemProperties(oBoots, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oBoots, DURATION_TYPE_TEMPORARY);
   object oBullets = GetItemInSlot(INVENTORY_SLOT_BULLETS, oPC);
   IPRemoveAllItemProperties(oBullets, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oBullets, DURATION_TYPE_TEMPORARY);
   object oCloak = GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC);
   IPRemoveAllItemProperties(oCloak, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oCloak, DURATION_TYPE_TEMPORARY);
   object oLHand = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
   IPRemoveAllItemProperties(oLHand, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oLHand, DURATION_TYPE_TEMPORARY);
   object oLRing = GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC);
   IPRemoveAllItemProperties(oLRing, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oLRing, DURATION_TYPE_TEMPORARY);
   object oNeck = GetItemInSlot(INVENTORY_SLOT_NECK, oPC);
   if (!(GetTag(oNeck) == "AmuletRecall")) //Don't destroy the Amulet of Recall!
    {
    IPRemoveAllItemProperties(oNeck, DURATION_TYPE_PERMANENT);
    IPRemoveAllItemProperties(oNeck, DURATION_TYPE_TEMPORARY);
    }
   object oRHand = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
   IPRemoveAllItemProperties(oRHand, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oRHand, DURATION_TYPE_TEMPORARY);
   object oRRing = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC);
   IPRemoveAllItemProperties(oRRing, DURATION_TYPE_PERMANENT);
   IPRemoveAllItemProperties(oRRing, DURATION_TYPE_TEMPORARY);
   // Remove magical properties from all other items in inventory (except the Amulet of Recall)
   object oItem = GetFirstItemInInventory(oPC);
   while (GetIsObjectValid(oItem))
    {
    if (!(GetTag(oItem) == "AmuletRecall")) //Don't destroy the Amulet of Recall!
     {
     IPRemoveAllItemProperties(oItem, DURATION_TYPE_PERMANENT);
     IPRemoveAllItemProperties(oItem, DURATION_TYPE_TEMPORARY);
     }
    oItem = GetNextItemInInventory(oPC);
    }
}

void main()
{
object oPC = GetFirstPC();
object oHench1 = GetHenchman(oPC, 1);
object oHench2 = GetHenchman(oPC, 2);

object oSound = GetNearestObjectByTag("SoulGemAttack");

object oTarget;
object oSpawn;
object oItem;
itemproperty iProp;

int nQuadrant = d8();
int nPCQuadrant = GetLocalInt(oPC, "SoulGemQuadrant");
int nHench1Quadrant = GetLocalInt(oHench1, "SoulGemQuadrant");
int nHench2Quadrant = GetLocalInt(oHench2, "SoulGemQuadrant");

int nForceField = GetLocalInt(GetFirstPC(), "ForceFieldDestroyed");
int nWillSave;

effect eDeath = EffectDeath();

if ((nQuadrant == 1)&&(!(nForceField == 1)))
 {
 oTarget = GetWaypointByTag("WP_SoulGemAttack1");
 oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "soulgemcone", GetLocation(oTarget));
 SoundObjectPlay(oSound);
 if (nPCQuadrant == nQuadrant)
  {
  nWillSave = WillSave(oPC, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oPC, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oPC);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oPC));
   }
  else
   {
   DrainMagic(oPC);
   }
  }
 if (nHench1Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench1, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench1, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench1);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench1));
   }
  else
   {
   DrainMagic(oHench1);
   }
  }
 if (nHench2Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench2, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench2, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench2);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench2));
   }
  else
   {
   DrainMagic(oHench2);
   }
  }
 DelayCommand(2.0, DestroyObject(GetNearestObjectByTag("SoulGemCone"), 0.0));
 return;
 }

else if ((nQuadrant == 2)&&(!(nForceField == 1)))
 {
 oTarget = GetWaypointByTag("WP_SoulGemAttack2");
 oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "soulgemcone", GetLocation(oTarget));
 SoundObjectPlay(oSound);
 if (nPCQuadrant == nQuadrant)
  {
  nWillSave = WillSave(oPC, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oPC, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oPC);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oPC));
   }
  else
   {
   DrainMagic(oPC);
   }
  }
 if (nHench1Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench1, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench1, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench1);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench1));
   }
  else
   {
   DrainMagic(oHench1);
   }
  }
 if (nHench2Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench2, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench2, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench2);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench2));
   }
  else
   {
   DrainMagic(oHench2);
   }
  }
 DelayCommand(2.0, DestroyObject(GetNearestObjectByTag("SoulGemCone"), 0.0));
 return;
 }

else if ((nQuadrant == 3)&&(!(nForceField == 1)))
 {
 oTarget = GetWaypointByTag("WP_SoulGemAttack3");
 oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "soulgemcone", GetLocation(oTarget));
 SoundObjectPlay(oSound);
  if (nPCQuadrant == nQuadrant)
  {
  nWillSave = WillSave(oPC, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oPC, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oPC);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oPC));
   }
  else
   {
   DrainMagic(oPC);
   }
  }
 if (nHench1Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench1, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench1, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench1);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench1));
   }
  else
   {
   DrainMagic(oHench1);
   }
  }
 if (nHench2Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench2, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench2, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench2);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench2));
   }
  else
   {
   DrainMagic(oHench2);
   }
  }
 DelayCommand(2.0, DestroyObject(GetNearestObjectByTag("SoulGemCone"), 0.0));
 return;
 }

else if ((nQuadrant == 4)&&(!(nForceField == 1)))
 {
 oTarget = GetWaypointByTag("WP_SoulGemAttack4");
 oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "soulgemcone", GetLocation(oTarget));
 SoundObjectPlay(oSound);
  if (nPCQuadrant == nQuadrant)
  {
  nWillSave = WillSave(oPC, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oPC, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oPC);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oPC));
   }
  else
   {
   DrainMagic(oPC);
   }
  }
 if (nHench1Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench1, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench1, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench1);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench1));
   }
  else
   {
   DrainMagic(oHench1);
   }
  }
 if (nHench2Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench2, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench2, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench2);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench2));
   }
  else
   {
   DrainMagic(oHench2);
   }
  }
 DelayCommand(2.0, DestroyObject(GetNearestObjectByTag("SoulGemCone"), 0.0));
 return;
 }

else if ((nQuadrant == 5)&&(!(nForceField == 1)))
 {
 oTarget = GetWaypointByTag("WP_SoulGemAttack5");
 oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "soulgemcone", GetLocation(oTarget));
 SoundObjectPlay(oSound);
  if (nPCQuadrant == nQuadrant)
  {
  nWillSave = WillSave(oPC, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oPC, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oPC);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oPC));
   }
  else
   {
   DrainMagic(oPC);
   }
  }
 if (nHench1Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench1, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench1, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench1);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench1));
   }
  else
   {
   DrainMagic(oHench1);
   }
  }
 if (nHench2Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench2, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench2, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench2);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench2));
   }
  else
   {
   DrainMagic(oHench2);
   }
  }
 DelayCommand(2.0, DestroyObject(GetNearestObjectByTag("SoulGemCone"), 0.0));
 return;
 }

else if ((nQuadrant == 6)&&(!(nForceField == 1)))
 {
 oTarget = GetWaypointByTag("WP_SoulGemAttack6");
 oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "soulgemcone", GetLocation(oTarget));
 SoundObjectPlay(oSound);
  if (nPCQuadrant == nQuadrant)
  {
  nWillSave = WillSave(oPC, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oPC, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oPC);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oPC));
   }
  else
   {
   DrainMagic(oPC);
   }
  }
 if (nHench1Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench1, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench1, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench1);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench1));
   }
  else
   {
   DrainMagic(oHench1);
   }
  }
 if (nHench2Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench2, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench2, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench2);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench2));
   }
  else
   {
   DrainMagic(oHench2);
   }
  }
 DelayCommand(2.0, DestroyObject(GetNearestObjectByTag("SoulGemCone"), 0.0));
 return;
 }

else if ((nQuadrant == 7)&&(!(nForceField == 1)))
 {
 oTarget = GetWaypointByTag("WP_SoulGemAttack7");
 oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "soulgemcone", GetLocation(oTarget));
 SoundObjectPlay(oSound);
  if (nPCQuadrant == nQuadrant)
  {
  nWillSave = WillSave(oPC, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oPC, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oPC);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oPC));
   }
  else
   {
   DrainMagic(oPC);
   }
  }
 if (nHench1Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench1, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench1, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench1);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench1));
   }
  else
   {
   DrainMagic(oHench1);
   }
  }
 if (nHench2Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench2, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench2, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench2);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench2));
   }
  else
   {
   DrainMagic(oHench2);
   }
  }
 DelayCommand(2.0, DestroyObject(GetNearestObjectByTag("SoulGemCone"), 0.0));
 return;
 }

else if ((nQuadrant == 8)&&(!(nForceField == 1)))
 {
 oTarget = GetWaypointByTag("WP_SoulGemAttack8");
 oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "soulgemcone", GetLocation(oTarget));
 SoundObjectPlay(oSound);
  if (nPCQuadrant == nQuadrant)
  {
  nWillSave = WillSave(oPC, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oPC, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oPC);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oPC));
   }
  else
   {
   DrainMagic(oPC);
   }
  }
 if (nHench1Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench1, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench1, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench1);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench1));
   }
  else
   {
   DrainMagic(oHench1);
   }
  }
 if (nHench2Quadrant == nQuadrant)
  {
  nWillSave = WillSave(oHench2, 15, SAVING_THROW_TYPE_DEATH, GetAreaOfEffectCreator(OBJECT_SELF));
  if (nWillSave == 0)
   {
   AssignCommand(oHench2, SetIsDestroyable(FALSE, FALSE, TRUE));
   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench2);
   DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oHench2));
   }
  else
   {
   DrainMagic(oHench2);
   }
  }
 DelayCommand(2.0, DestroyObject(GetNearestObjectByTag("SoulGemCone"), 0.0));
 return;
 }
else return;
}
