Changes to nw_s0_enedrain

:://///////
:: Energy Drain
:: NW_S0_EneDrain.nss
:: Copyright (c) 2001 Bioware Corp.
:://////////
/*
Target loses 2d4 levels.
*/
:://////////
:: Created By: Preston Watamaniuk
:: Created On: Jan 7, 2002
:://////////
:: PKM-OEI 08.03.06 - VFX revision
:: AFW-OEI 04/05/2007: No longer get Fort save.
#include "x0_I0_SPELLS"
#include "nw_i0_invocatns"
#include "x2_inc_spellhook"

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 eVis = EffectVisualEffect( VFX_DUR_SPELL_ENERGY_DRAIN );
effect eBeam = EffectBeam( VFX_BEAM_NECROMANCY, OBJECT_SELF, BODY_NODE_HAND );
object oTarget = GetSpellTargetObject();
int nMetaMagic = GetMetaMagicFeat();
int nDrain = d4(2);
int nTouch = TouchAttackRanged(oTarget); //Should be touch attack
//Enter Metamagic conditions
if (nTouch==0) return;
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nDrain = 8;
Damage is at max
}
else if (nMetaMagic == METAMAGIC_EMPOWER)
{
nDrain = nDrain + (nDrain/2); //Damage/Healing is +50%
}
if (nTouch==2) nDrain*=2; //+100% crit bonus
effect eDrain = EffectNegativeLevel(nDrain);
eDrain = SupernaturalEffect(eDrain);
//eDrain = EffectLinkEffects( eDrain, eVis );
//eDrain = EffectLinkEffects( eDrain, eBeam );

if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_ENERGY_DRAIN));
if(!MyResistSpell(OBJECT_SELF, oTarget))
{
//if(!MySavingThrow(SAVING_THROW_FORT, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_NEGATIVE))
{
ApplyEffectToObject( DURATION_TYPE_PERMANENT, eDrain, oTarget );
ApplyEffectToObject( DURATION_TYPE_INSTANT, eVis, oTarget );
ApplyEffectToObject( DURATION_TYPE_TEMPORARY, eBeam, oTarget, 1.7 );

if (GetHasFeat(FEAT_ELDRITCH_SPELLWEAVE))
{
if ( nMetaMagic & METAMAGIC_INVOC_FRIGHTFUL_BLAST ) DoETMetaFrightfulBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_DRAINING_BLAST ) DoETMetaDrainingBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_BESHADOWED_BLAST ) DoETMetaBeshadowedBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_BEWITCHING_BLAST ) DoETMetaBewitchingBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_NOXIOUS_BLAST ) DoETMetaNoxiousBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_HINDERING_BLAST ) DoETMetaHinderingBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_BINDING_BLAST ) DoETMetaBindingBlast(OBJECT_SELF, oTarget);
}

}
}
}
}

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License