PRC8/nwn/nwnprc/trunk/spells/sp_grscrying.nss
Jaysyn904 6ec137a24e Updated AMS marker feats
Updated AMS marker feats.  Removed arcane & divine marker feats.  Updated Dread Necromancer for epic progression. Updated weapon baseitem models.  Updated new weapons for crafting & npc equip.
 Updated prefix.  Updated release archive.
2024-02-11 14:01:05 -05:00

155 lines
8.1 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Greater Scrying
//:: sp_grscrying.nss
//:://////////////////////////////////////////////
/*
A spell that allows the caster to scry either
on any creature in the area they're in, or to
scry on any PC.
*/
//:://////////////////////////////////////////////
//:: Created By: Stratovarius
//:: Created On: April 30, 2007
//:://////////////////////////////////////////////
#include "inc_dynconv"
#include "prc_inc_spells"
#include "prc_add_spell_dc"
void ApplyScryEffects(object oPC)
{
if(DEBUG) DoDebug("prc_inc_scry: ApplyScryEffects():\n"
+ "oPC = '" + GetName(oPC) + "'"
);
// The Scryer is not supposed to be visible, nor can he move or cast
// He also can't take damage from scrying
effect eLink = EffectSpellImmunity(SPELL_ALL_SPELLS);
// Damage immunities
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_ACID, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_BLUDGEONING, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_COLD, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_DIVINE, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_ELECTRICAL, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_FIRE, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_MAGICAL, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_NEGATIVE, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_PIERCING, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_POSITIVE, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_SLASHING, 100));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_SONIC, 100));
// Specific immunities
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_ABILITY_DECREASE));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_BLINDNESS));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_DEAFNESS));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_CRITICAL_HIT));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_DEATH));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_DISEASE));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_ENTANGLE));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_SLOW));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_KNOCKDOWN));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_NEGATIVE_LEVEL));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_PARALYSIS));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_SILENCE));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_SNEAK_ATTACK));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_TRAP));
eLink = EffectLinkEffects(eLink, EffectImmunity(IMMUNITY_TYPE_MIND_SPELLS));
// Random stuff
eLink = EffectLinkEffects(eLink, EffectCutsceneGhost());
eLink = EffectLinkEffects(eLink, EffectCutsceneImmobilize());
eLink = EffectLinkEffects(eLink, EffectEthereal());
eLink = EffectLinkEffects(eLink, EffectAttackDecrease(50));
eLink = EffectLinkEffects(eLink, EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY));
// Permanent until Scry ends
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ExtraordinaryEffect(eLink), oPC, GetLocalFloat(oPC, "ScryDuration") + 6.0);
// Create array for storing a list of the nerfed weapons in
array_create(oPC, "Scry_Nerfed");
object oWeapon;
itemproperty ipNoDam = ItemPropertyNoDamage();
oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
if(IPGetIsMeleeWeapon(oWeapon)){
if(!GetItemHasItemProperty(oWeapon, ITEM_PROPERTY_NO_DAMAGE)){
//SetLocalInt(oWeapon, "BaelnornProjection_NoDamage", TRUE);
AddItemProperty(DURATION_TYPE_PERMANENT, ipNoDam, oWeapon);
array_set_object(oPC, "Scry_Nerfed", array_get_size(oPC, "Scry_Nerfed"), oWeapon);
}
// Check left hand only if right hand had a weapon
oWeapon = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
if(IPGetIsMeleeWeapon(oWeapon)){
if(!GetItemHasItemProperty(oWeapon, ITEM_PROPERTY_NO_DAMAGE)){
//SetLocalInt(oWeapon, "BaelnornProjection_NoDamage", TRUE);
AddItemProperty(DURATION_TYPE_PERMANENT, ipNoDam, oWeapon);
array_set_object(oPC, "Scry_Nerfed", array_get_size(oPC, "Scry_Nerfed"), oWeapon);
}}
}else if(IPGetIsRangedWeapon(oWeapon)){
if(!GetItemHasItemProperty(oWeapon, ITEM_PROPERTY_NO_DAMAGE)){
//SetLocalInt(oWeapon, "BaelnornProjection_NoDamage", TRUE);
AddItemProperty(DURATION_TYPE_PERMANENT, ipNoDam, oWeapon);
array_set_object(oPC, "Scry_Nerfed", array_get_size(oPC, "Scry_Nerfed"), oWeapon);
}}
oWeapon = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oPC);
if(GetIsObjectValid(oWeapon)){
if(!GetItemHasItemProperty(oWeapon, ITEM_PROPERTY_NO_DAMAGE)){
//SetLocalInt(oWeapon, "BaelnornProjection_NoDamage", TRUE);
AddItemProperty(DURATION_TYPE_PERMANENT, ipNoDam, oWeapon);
array_set_object(oPC, "Scry_Nerfed", array_get_size(oPC, "Scry_Nerfed"), oWeapon);
}}
oWeapon = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oPC);
if(GetIsObjectValid(oWeapon)){
if(!GetItemHasItemProperty(oWeapon, ITEM_PROPERTY_NO_DAMAGE)){
//SetLocalInt(oWeapon, "BaelnornProjection_NoDamage", TRUE);
AddItemProperty(DURATION_TYPE_PERMANENT, ipNoDam, oWeapon);
array_set_object(oPC, "Scry_Nerfed", array_get_size(oPC, "Scry_Nerfed"), oWeapon);
}}
oWeapon = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oPC);
if(GetIsObjectValid(oWeapon)){
if(!GetItemHasItemProperty(oWeapon, ITEM_PROPERTY_NO_DAMAGE)){
//SetLocalInt(oWeapon, "BaelnornProjection_NoDamage", TRUE);
AddItemProperty(DURATION_TYPE_PERMANENT, ipNoDam, oWeapon);
array_set_object(oPC, "Scry_Nerfed", array_get_size(oPC, "Scry_Nerfed"), oWeapon);
}}
}
void main()
{
object oPC = OBJECT_SELF;
DeleteLocalInt(oPC, "X2_L_LAST_SPELLSCHOOL_VAR");
SetLocalInt(oPC, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_DIVINATION);
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
//Declare major variables
object oTarget;
int nCasterLvl = PRCGetCasterLevel(oPC);
int nSpell = PRCGetSpellId();
int nDC = PRCGetSaveDC(oTarget, oPC);
float fDur = HoursToSeconds(nCasterLvl);
int nMetaMagic = PRCGetMetaMagicFeat();
//Make Metamagic check for extend
if ((nMetaMagic & METAMAGIC_EXTEND))
{
fDur = fDur * 2;
}
SetLocalInt(oPC, "ScryCasterLevel", nCasterLvl);
SetLocalInt(oPC, "ScrySpellId", nSpell);
SetLocalInt(oPC, "ScrySpellDC", nDC);
SetLocalFloat(oPC, "ScryDuration", fDur);
//AssignCommand(oPC, ClearAllActions(TRUE));
StartDynamicConversation("prc_scry_conv", oPC, DYNCONV_EXIT_NOT_ALLOWED, FALSE, TRUE, oPC);
// Apply the immunity effects
ApplyScryEffects(oPC);
DeleteLocalInt(oPC, "X2_L_LAST_SPELLSCHOOL_VAR");
// Getting rid of the integer used to hold the spells spell school
}