Files
PRC8/nwn/nwnprc/trunk/newspellbook/inv_dra_darkness.nss
Jaysyn904 d375a56267 2026/05/25 Memorial Day Update
Attune Gem was using the wrong prereqs.
Attune Gem didn't handle radial spells properly.
Attune Gem incorrectly allowed divine spells.
Attune Gem was checking the wrong resref for vanilla gems.
Attune Gem didn't handle stacks of gems properly.
Updated Attune Gem's TLK entry.
PRCGetSaveDC() wasn't using PRCGetSpellCastItem().
Damning Darkness' vfx_persistent.2da entry was typoed.
Damning Darkness was checking the wrong object for inventory item for validity.
Darkness invocation was checking the wrong object for inventory item for validity.
Deeper Darkness was checking the wrong object for inventory item for validity.
Darkness was checking the wrong object for inventory item for validity.
Fixed Dragon's Tooth range & save.
Hopefully fixed Seize Items' VFX.
Fixed Acolyte of the Skin's DR.
Updated PRC8 Changelog doc.
2026-05-26 00:21:58 -04:00

77 lines
2.5 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name Darkness
//:: FileName inv_dra_darkness.nss
//::///////////////////////////////////////////////
/*
Least Invocation
2nd Level Spell
You can create magical darkness in a 20' radius.
All creatures within the darkness can only see in
it using Ultravision, True Seeing, blindsense, or
blindsight.
*/
//::///////////////////////////////////////////////
#include "prc_sp_func"
#include "prc_inc_sp_tch"
#include "inv_inc_invfunc"
#include "inv_invokehook"
void main()
{
if(!PreInvocationCastCode()) return;
object oCaster = OBJECT_SELF;
object oTarget = PRCGetSpellTargetObject();
object oItemTarget = oTarget;
int nCasterLevel = GetInvokerLevel(oCaster, GetInvokingClass());
int iAttackRoll = 1;
effect eAOE = EffectAreaOfEffect(AOE_PER_DARKNESS);
if(GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
{ //touch attack roll if target creature is not an ally
if(!spellsIsTarget(oTarget, SPELL_TARGET_ALLALLIES, oCaster))
iAttackRoll = PRCDoMeleeTouchAttack(oTarget);
if(iAttackRoll > 0)
{
oItemTarget = GetItemInSlot(INVENTORY_SLOT_CHEST, oTarget);
if(!GetIsObjectValid(oItemTarget))
{
//no armor, check other slots
int i;
for(i=0;i<14;i++)
{
oItemTarget = GetItemInSlot(i, oTarget);
if(GetIsObjectValid(oItemTarget))
break;//end for loop
}
}
}
}
int nCasterLvl = nCasterLevel;
int nDuration = nCasterLvl;//10min/level for PnP
//Create an instance of the AOE Object using the Apply Effect function
//placeables get an effect
//or if no equipment
if(!GetPRCSwitch(PRC_PNP_DARKNESS))
{
if (iAttackRoll > 0)
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, GetLocation(oTarget), RoundsToSeconds(nDuration));
}
else if(GetObjectType(oTarget) == OBJECT_TYPE_PLACEABLE
|| !GetIsObjectValid(oItemTarget))
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eAOE, oTarget, RoundsToSeconds(nDuration),TRUE,-1,nCasterLvl);
else
{
//otherwise items get an IP
itemproperty ipDarkness = ItemPropertyAreaOfEffect(IP_CONST_AOE_DARKNESS, nCasterLvl);
IPSafeAddItemProperty(oItemTarget, ipDarkness, TurnsToSeconds(nDuration*10));
//this applies the effects relating to it
DelayCommand(0.1, VoidCheckPRCLimitations(oItemTarget, OBJECT_INVALID));
}
}