-
Notifications
You must be signed in to change notification settings - Fork 0
/
nw_s0_masheal.nss
108 lines (99 loc) · 3.98 KB
/
nw_s0_masheal.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//::///////////////////////////////////////////////
//:: Mass Heal
//:: [NW_S0_MasHeal.nss]
//:: Copyright (c) 2000 Bioware Corp.
//:://////////////////////////////////////////////
//:: Heals all friendly targets within 10ft to full
//:: unless they are undead.
//:: If undead they reduced to 1d4 HP.
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: April 11, 2001
//:: Modified by: Shayan 27/03/2005 (For Subrace Engine)
//:://////////////////////////////////////////////
#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"
#include "sha_subr_methds"
void main()
{
/*
Spellcast Hook Code
Added 2003-06-23 by GeorgZ
If you want to make changes to all spells,
check x2_inc_spellhook.nss to find out more
*/
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
// End of Spell Cast Hook
//Declare major variables
effect eKill;
effect eVis = EffectVisualEffect(VFX_IMP_SUNSTRIKE);
effect eHeal;
effect eVis2 = EffectVisualEffect(VFX_IMP_HEALING_G);
effect eStrike = EffectVisualEffect(VFX_FNF_LOS_HOLY_10);
int nTouch, nModify, nDamage, nHeal;
int nMetaMagic = GetMetaMagicFeat();
float fDelay;
location lLoc = GetSpellTargetLocation();
//Apply VFX area impact
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eStrike, lLoc);
//Get first target in spell area
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, lLoc);
while(GetIsObjectValid(oTarget))
{
fDelay = GetRandomDelay();
//-------Check to see if the target is an undead
if ((Subrace_GetIsUndead(oTarget) || GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD) && !GetIsReactionTypeFriendly(oTarget))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_MASS_HEAL));
//Make a touch attack
nTouch = TouchAttackRanged(oTarget);
if (nTouch > 0)
{
if(!GetIsReactionTypeFriendly(oTarget) || Subrace_GetIsUndead(oTarget))
{
//Make an SR check
if (!MyResistSpell(OBJECT_SELF, oTarget, fDelay))
{
//Roll damage
nModify = d4();
//make metamagic check
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nModify = 1;
}
//Detemine the damage to inflict to the undead
nDamage = GetCurrentHitPoints(oTarget) - nModify;
//Set the damage effect
eKill = EffectDamage(nDamage, DAMAGE_TYPE_POSITIVE);
//Apply the VFX impact and damage effect
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eKill, oTarget));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
}
}
}
}
else
{
//Make a faction check
if(GetIsFriend(oTarget) && GetRacialType(oTarget) != RACIAL_TYPE_UNDEAD)
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_MASS_HEAL, FALSE));
//Determine amount to heal
nHeal = GetMaxHitPoints(oTarget);
//Set the damage effect
eHeal = EffectHeal(nHeal);
//Apply the VFX impact and heal effect
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oTarget));
}
}
//Get next target in the spell area
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, lLoc);
}
}