//::///////////////////////////////////////////////
//:: Name: M4Immunes.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This is the OnSpawn script for Morag's Protectors,
except the Protector Against the Lessers.
MrZork 2011/12/10: Modified to give appropriate
Protectors immunity (rather than vulnerability)
to magical, divine, and negative damage. Also
modified to remove the immunity from poison that
Morag's Venom protector gets from her helmet.
Also removed immunity from electrical attacks
from the Protector Against the Storm.
*/
// * all protectors are immune to magical damage, negative and divine
void main()
{
effect eImmunity = EffectDamageImmunityIncrease(DAMAGE_TYPE_MAGICAL,100);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eImmunity, OBJECT_SELF);
eImmunity = EffectDamageImmunityIncrease(DAMAGE_TYPE_NEGATIVE,100);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eImmunity, OBJECT_SELF);
eImmunity = EffectDamageImmunityIncrease(DAMAGE_TYPE_DIVINE,100);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eImmunity, OBJECT_SELF);
if (GetTag(OBJECT_SELF)=="M4Q1D08_IMM_POIS") // Protector Against Venom
{
object oItem = GetItemInSlot(INVENTORY_SLOT_HEAD,OBJECT_SELF);
itemproperty ipPoison = GetFirstItemProperty(oItem);
while (GetIsItemPropertyValid(ipPoison))
{
if (GetItemPropertyType(ipPoison)==ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS)
{
if (GetItemPropertySubType(ipPoison)==3) // from IPRP_IMMUNITY.2DA
{
RemoveItemProperty(oItem, ipPoison);
break;
}
}
ipPoison=GetNextItemProperty(oItem);
}
}
if (GetTag(OBJECT_SELF)=="M4Q1D08_IMM_ELEC") // Protector Against the Storm
{
object oItem = GetItemInSlot(INVENTORY_SLOT_BELT,OBJECT_SELF);
if (GetIsObjectValid(oItem))
{
DestroyObject(oItem);
}
}
}