114 lines
3.8 KiB
Plaintext
114 lines
3.8 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Negative Energy Ray
|
|
//:: NW_S0_NegRay
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Fires a bolt of negative energy at the target
|
|
doing 1d6 damage. Does an additional 1d6
|
|
damage for 2 levels after level 1 (3,5,7,9) to
|
|
a maximum of 5d6 at level 9.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Preston Watamaniuk
|
|
//:: Created On: Sept 13, 2001
|
|
//:://////////////////////////////////////////////
|
|
|
|
//:: modified by mr_bumpkin Dec 4, 2003 for PRC stuff
|
|
|
|
//::Added code to maximize for Faith Healing and Blast Infidel
|
|
//::Aaon Graywolf - Jan 7, 2004
|
|
|
|
#include "spinc_common"
|
|
|
|
#include "NW_I0_SPELLS"
|
|
#include "x2_inc_spellhook"
|
|
|
|
void main()
|
|
{
|
|
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
|
|
SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_NECROMANCY);
|
|
/*
|
|
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
|
|
object oTarget = GetSpellTargetObject();
|
|
int CasterLvl = PRCGetCasterLevel(OBJECT_SELF);
|
|
|
|
int nCasterLevel = CasterLvl;
|
|
int nMetaMagic = GetMetaMagicFeat();
|
|
|
|
if(nCasterLevel > 9)
|
|
{
|
|
nCasterLevel = 9;
|
|
}
|
|
nCasterLevel = (nCasterLevel + 1) / 2;
|
|
int nDamage = d6(nCasterLevel);
|
|
|
|
//Enter Metamagic conditions
|
|
int iBlastFaith = BlastInfidelOrFaithHeal(OBJECT_SELF, oTarget, DAMAGE_TYPE_NEGATIVE, TRUE);
|
|
if (nMetaMagic == METAMAGIC_MAXIMIZE || iBlastFaith)
|
|
{
|
|
nDamage = 6 * nCasterLevel;//Damage is at max
|
|
}
|
|
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EMPOWER))
|
|
{
|
|
nDamage = nDamage + (nDamage/2); //Damage/Healing is +50%
|
|
}
|
|
effect eVis = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
|
|
effect eDam = EffectDamage(nDamage, DAMAGE_TYPE_NEGATIVE);
|
|
effect eHeal = EffectHeal(nDamage);
|
|
effect eVisHeal = EffectVisualEffect(VFX_IMP_HEALING_M);
|
|
effect eRay;
|
|
|
|
CasterLvl +=SPGetPenetr();
|
|
|
|
if(MyPRCGetRacialType(oTarget) != RACIAL_TYPE_UNDEAD)
|
|
{
|
|
if(!GetIsReactionTypeFriendly(oTarget))
|
|
{
|
|
//Fire cast spell at event for the specified target
|
|
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_NEGATIVE_ENERGY_RAY));
|
|
eRay = EffectBeam(VFX_BEAM_EVIL, OBJECT_SELF, BODY_NODE_HAND);
|
|
if (!MyPRCResistSpell(OBJECT_SELF, oTarget,CasterLvl))
|
|
{
|
|
//Make a saving throw check
|
|
if(/*Will Save*/ PRCMySavingThrow(SAVING_THROW_WILL, oTarget, (GetSpellSaveDC()+ GetChangesToSaveDC(oTarget,OBJECT_SELF)), SAVING_THROW_TYPE_NEGATIVE))
|
|
{
|
|
nDamage /= 2;
|
|
}
|
|
//Apply the VFX impact and effects
|
|
//DelayCommand(0.5, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
|
|
DelayCommand(0.5, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
|
|
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//Fire cast spell at event for the specified target
|
|
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_NEGATIVE_ENERGY_RAY, FALSE));
|
|
eRay = EffectBeam(VFX_BEAM_EVIL, OBJECT_SELF, BODY_NODE_HAND);
|
|
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVisHeal, oTarget);
|
|
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget);
|
|
}
|
|
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRay, oTarget, 1.7,FALSE);
|
|
|
|
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
|
|
// Getting rid of the integer used to hold the spells spell school
|
|
}
|