-
Notifications
You must be signed in to change notification settings - Fork 0
/
nw_s0_darknessa.nss
74 lines (69 loc) · 2.46 KB
/
nw_s0_darknessa.nss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//::///////////////////////////////////////////////
//:: Darkness: On Enter
//:: NW_S0_DarknessA.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Creates a globe of darkness around those in the area
of effect.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Feb 28, 2002
//:://////////////////////////////////////////////
#include "x0_i0_spells"
#include "sha_subr_methds"
#include "x2_inc_spellhook"
void main()
{
int nMetaMagic = GetMetaMagicFeat();
effect eInvis = EffectInvisibility(INVISIBILITY_TYPE_DARKNESS);
effect eDark = EffectDarkness();
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
effect eLink = EffectLinkEffects(eDark, eDur);
effect eLink2 = EffectLinkEffects(eInvis, eDur);
int nDuration = GetCasterLevel(OBJECT_SELF);
//Enter Metamagic conditions
if (nMetaMagic == METAMAGIC_EXTEND)
{
nDuration = nDuration *2; //Duration is +100%
}
object oTarget = GetEnteringObject();
//--//Shayan's Subrace Engine
SetIsInDarkness(oTarget, TRUE);
//fail safe code
DelayCommand(220.0, SetIsInDarkness(oTarget, FALSE));
//End
// * July 2003: If has darkness then do not put it on it again
if (GetHasEffect(EFFECT_TYPE_DARKNESS, oTarget) == TRUE)
{
return;
}
if(GetIsObjectValid(oTarget) && oTarget != GetAreaOfEffectCreator())
{
if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, GetAreaOfEffectCreator()))
{
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetEffectSpellId(eLink)));
}
else
{
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetEffectSpellId(eLink), FALSE));
}
// Creatures immune to the darkness spell are not affected.
if ( ResistSpell(OBJECT_SELF,oTarget) != 2 )
{
//Fire cast spell at event for the specified target
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oTarget);
}
}
else if (oTarget == GetAreaOfEffectCreator())
{
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetEffectSpellId(eLink), FALSE));
// Creatures immune to the darkness spell are not affected.
if ( ResistSpell(OBJECT_SELF,oTarget) != 2 )
{
//Fire cast spell at event for the specified target
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink2, oTarget);
}
}
}