1. //::///////////////////////////////////////////////
  2. //:: Name: M4Immunes.nss
  3. //:: Copyright (c) 2001 Bioware Corp.
  4. //:://////////////////////////////////////////////
  5. /*
  6.     This is the OnSpawn script for Morag's Protectors,
  7.     except the Protector Against the Lessers.
  8.  
  9.     MrZork 2011/12/10: Modified to give appropriate
  10.     Protectors immunity (rather than vulnerability)
  11.     to magical, divine, and negative damage. Also
  12.     modified to remove the immunity from poison that
  13.     Morag's Venom protector gets from her helmet.
  14.     Also removed immunity from electrical attacks
  15.     from the Protector Against the Storm.
  16. */
  17.  
  18. // * all protectors are immune to magical damage, negative and divine
  19. void main()
  20.     {
  21.     effect eImmunity = EffectDamageImmunityIncrease(DAMAGE_TYPE_MAGICAL,100);
  22.     ApplyEffectToObject(DURATION_TYPE_PERMANENT, eImmunity, OBJECT_SELF);
  23.  
  24.     eImmunity = EffectDamageImmunityIncrease(DAMAGE_TYPE_NEGATIVE,100);
  25.     ApplyEffectToObject(DURATION_TYPE_PERMANENT, eImmunity, OBJECT_SELF);
  26.  
  27.     eImmunity = EffectDamageImmunityIncrease(DAMAGE_TYPE_DIVINE,100);
  28.     ApplyEffectToObject(DURATION_TYPE_PERMANENT, eImmunity, OBJECT_SELF);
  29.  
  30.     if (GetTag(OBJECT_SELF)=="M4Q1D08_IMM_POIS")    // Protector Against Venom
  31.         {
  32.         object oItem = GetItemInSlot(INVENTORY_SLOT_HEAD,OBJECT_SELF);
  33.         itemproperty ipPoison = GetFirstItemProperty(oItem);
  34.         while (GetIsItemPropertyValid(ipPoison))
  35.             {
  36.             if (GetItemPropertyType(ipPoison)==ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS)
  37.                 {
  38.                 if (GetItemPropertySubType(ipPoison)==3)    // from IPRP_IMMUNITY.2DA
  39.                     {
  40.                     RemoveItemProperty(oItem, ipPoison);
  41.                     break;
  42.                     }
  43.                 }
  44.             ipPoison=GetNextItemProperty(oItem);
  45.             }
  46.         }
  47.  
  48.     if (GetTag(OBJECT_SELF)=="M4Q1D08_IMM_ELEC")    // Protector Against the Storm
  49.         {
  50.         object oItem = GetItemInSlot(INVENTORY_SLOT_BELT,OBJECT_SELF);
  51.         if (GetIsObjectValid(oItem))
  52.             {
  53.             DestroyObject(oItem);
  54.             }
  55.         }
  56.  
  57.     }
  58.